@@ -9,18 +9,18 @@ to validate accounts by email, domain or group.
99[](http://travis-ci.org/bitly/oauth2_proxy)
1010
1111
12−
12+
1313
1414## Architecture
1515
16−
16+
1717
1818## Installation
1919
20201. Download [Prebuilt Binary](https://github.com/bitly/oauth2_proxy/releases) (current release is `v1.1.1`) or build with `$ go get github.com/bitly/oauth2_proxy` which will put the binary in `$GOROOT/bin`
21−2. Register an OAuth Application with a Provider
22−3. Configure Oauth2 Proxy using config file, command line options, or environment variables
23−4. Deploy behind a SSL endpoint (example provided for Nginx)
21+2. Select a Provider and Register an OAuth Application with a Provider
22+3. Configure OAuth2 Proxy using config file, command line options, or environment variables
23+4. Configure SSL or Deploy behind a SSL endpoint (example provided for Nginx)
2424
2525## OAuth Provider Configuration
2626
@@ -76,6 +76,10 @@ For LinkedIn, the registration steps are:
7676
7777The [MyUSA](https://alpha.my.usa.gov) authentication service ([GitHub](https://github.com/18F/myusa))
7878
79+## Email Authentication
80+
81+To authorize by email domain use `--email-domain=yourcompany.com`. To authorize individual email addresses use `--authenticated-emails-file=/path/to/file` with one email per line. To authorize all email addresse use `--email-domain=*`.
82+
7983## Configuration
8084
8185`oauth2_proxy` can be configured via [config file](#config-file), [command line options](#command-line-options) or [environment variables](#environment-variables).
@@ -107,18 +111,21 @@ Usage of oauth2_proxy:
107111 -github-team="": restrict logins to members of this team
108112 -htpasswd-file="": additionally authenticate against a htpasswd file. Entries must be created with "htpasswd -s" for SHA encryption
109113 -http-address="127.0.0.1:4180": [http://]<addr>:<port> or unix://<path> to listen on for HTTP clients
114+ -https-address=":443": <addr>:<port> to listen on for HTTPS clients
110115 -login-url="": Authentication endpoint
111116 -pass-access-token=false: pass OAuth access_token to upstream via X-Forwarded-Access-Token header
112117 -pass-basic-auth=true: pass HTTP Basic Auth, X-Forwarded-User and X-Forwarded-Email information to upstream
113118 -pass-host-header=true: pass the request Host Header to upstream
114119 -profile-url="": Profile access endpoint
115− -provider="": Oauth provider (defaults to Google)
120+ -provider="google": OAuth provider
116121 -proxy-prefix="/oauth2": the url root path that this proxy should be nested under (e.g. /<oauth2>/sign_in)
117122 -redeem-url="": Token redemption endpoint
118123 -redirect-url="": the OAuth Redirect URL. ie: "https://internalapp.yourcompany.com/oauth2/callback"
119124 -request-logging=true: Log requests to stdout
120125 -scope="": Oauth scope specification
121126 -skip-auth-regex=: bypass authentication for requests path's that match (may be given multiple times)
127+ -tls-cert="": path to certificate file
128+ -tls-key="": path to private key file
122129 -upstream=: the http url(s) of the upstream endpoint. If multiple, routing is based on path
123130 -validate-url="": Access token validation endpoint
124131 -version=false: print version string
@@ -130,10 +137,32 @@ See below for provider specific options
130137
131138The environment variables `OAUTH2_PROXY_CLIENT_ID`, `OAUTH2_PROXY_CLIENT_SECRET`, `OAUTH2_PROXY_COOKIE_SECRET`, `OAUTH2_PROXY_COOKIE_DOMAIN` and `OAUTH2_PROXY_COOKIE_EXPIRE` can be used in place of the corresponding command-line arguments.
132139
133−### Example Nginx Configuration
140+## SSL Configuration
141+
142+There are two recommended configurations.
143+
144+1) Configure SSL Terminiation with OAuth2 Proxy by providing a `--tls-cert=/path/to/cert.pem` and `--tls-key=/path/to/cert.key`.
145+
146+The command line to run `oauth2_proxy` in this configuration would look like this:
147+
148+```bash
149+./oauth2_proxy \
150+ --email-domain="yourcompany.com" \
151+ --upstream=http://127.0.0.1:8080/ \
152+ --tls-cert=/path/to/cert.pem \
153+ --tls-key=/path/to/cert.key \
154+ --cookie-secret=... \
155+ --cookie-secure=true \
156+ --provider=... \
157+ --client-id=... \
158+ --client-secret=...
159+```
160+
161+
162+2) Configure SSL Termination with [Nginx](http://nginx.org/) (example config below) or Amazon ELB, or ....
134163
135−This example has a [Nginx](http://nginx.org/) SSL endpoint proxying to `oauth2_proxy` on port `4180`.
136−`oauth2_proxy` then authenticates requests for an upstream application running on port `8080`. The external
164+Nginx will listen on port `443` and handle SSL connections while proxying to `oauth2_proxy` on port `4180`.
165+`oauth2_proxy` which will then authenticate requests for an upstream application. The external
137166endpoint for this example would be `https://internal.yourcompany.com/`.
138167
139168An example Nginx config follows. Note the use of `Strict-Transport-Security` header to pin requests to SSL
@@ -159,7 +188,7 @@ server {
159188}
160189```
161190
162−The command line to run `oauth2_proxy` would look like this:
191+The command line to run `oauth2_proxy` in this configuration would look like this:
163192
164193```bash
165194./oauth2_proxy \
@@ -167,6 +196,7 @@ The command line to run `oauth2_proxy` would look like this:
167196 --upstream=http://127.0.0.1:8080/ \
168197 --cookie-secret=... \
169198 --cookie-secure=true \
199+ --provider=... \
170200 --client-id=... \
171201 --client-secret=...
172202```
@@ -174,7 +204,7 @@ The command line to run `oauth2_proxy` would look like this:
174204
175205## Endpoint Documentation
176206
177−OAuth2 Proxy responds directly to the following endpoints. All other endpoints will be proxied upstream when authenticated.
207+OAuth2 Proxy responds directly to the following endpoints. All other endpoints will be proxied upstream when authenticated. The `/oauth2` prefix can be changed with the `--proxy-prefix` config variable.
178208
179209* /robots.txt - returns a 200 OK response that disallows all User-agents from all paths; see [robotstxt.org](http://www.robotstxt.org/) for more info
180210* /ping - returns an 200 OK response