Skip to content

Commit a1b1b74

Browse files
authored
sso_*: various documentation additions (buzzfeed#315)
* sso_*: documentation touch ups * sso_proxy: add some headings * fix indentation * typo alert
1 parent b008111 commit a1b1b74

File tree

4 files changed

+88
-9
lines changed

4 files changed

+88
-9
lines changed

docs/sso_config.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ For example, the following config would have the following environment variables
3232
* **to** is the cname of the proxied service (this tells sso proxy where to proxy requests that come in on the from field)
3333
* **type** declares the type of route to use, right now there is just *simple* and *rewrite*.
3434
* **options** are a set of options that can be added to your configuration.
35-
* **allowed groups** optional list of authorized google groups that can access the service. If not specified, anyone within an email domain is allowed to access the service. *Note*: We do not support nested group authentication at this time. Groups must be made up of email addresses associated with individual's accounts. See [#133](https://github.com/buzzfeed/sso/issues/133).
36-
* **allowed_email_domains** optional list of authorized email domains that can access the service.
37-
* **allowed_email_addresses** optional list of authorized email addresses that can access the service.
35+
* **allowed_groups** optional list of authorized google groups that can access the service. *Note*: We do not support nested group authentication at this time. Groups must be made up of email addresses associated with individual's accounts. See [#133](https://github.com/buzzfeed/sso/issues/133).
36+
* **allowed_email_domains** optional list of authorized email domains that can access the service. Set to `*` to allow any email domain.
37+
* **allowed_email_addresses** optional list of authorized email addresses that can access the service. Set to `*` to allow any email address.
3838
* **flush_interval** sets an interval to periodically flush the buffered response to the client. If specified, SSO Proxy will not timeout requests to this upstream and will stream the response to the client. NOTE: Use with extreme caution.
39-
* **header_overrides** overrides any heads set either by SSO proxy itself or upstream applications. Useful for modifying browser security headers.
39+
* **header_overrides** overrides any headers set either by SSO proxy itself or upstream applications. Useful for modifying browser security headers.
4040
* **inject_request_headers** adds headers to the request before the request is sent to the proxied service. Useful for adding basic auth headers if needed.
4141
* **provider_slug** determines which identity provider this upstream will use. This provider must first be configured within `sso_auth`.
4242
* **skip_auth_regex** skips authentication for paths matching these regular expressions. NOTE: Use with extreme caution.
@@ -45,6 +45,9 @@ For example, the following config would have the following environment variables
4545
from their parent routing config if not specified here (e.g. *options*).
4646
* **cluster name <identifier>** are cluster-specific settings. Any configuration specified in the default field can be override here with cluster specific configuration.
4747

48+
Note: From the perspective of request validations, if a request meets the requirements set in any of `allowed_groups`, `allowed_email_domains`, and `allowed_email_addresses`,
49+
then it will be deemed valid. It need only pass _one_, not all of them.
50+
4851
### Route Types
4952

5053
There are currently two route types used by SSO to route requests, *simple* and *rewrite*.
@@ -99,7 +102,7 @@ export SSO_CONFIG_FOOBAR_SIGNING_KEY="sha256:shared-secret-value"
99102
```
100103
would be the signing key for the `foobar` upstream service, use the sha256 with the `shared-secret-value` as it's signing key value.
101104

102-
This signs the request using defined signature headers found in https://github.com/buzzfeed/sso/blob/main/sso_proxy/oauthproxy.go#L25.
105+
This signs the request using defined signature headers found in the `SignatureHeaders` variable at https://github.com/buzzfeed/sso/blob/main/internal/proxy/oauthproxy.go#L27-L39.
103106
Specific implementation details can be found at https://github.com/18F/hmacauth
104107

105108
### Headers
@@ -120,7 +123,8 @@ Optional:
120123

121124
#### Security Headers
122125

123-
`sso_proxy` adds the following headers to every outgoing request, to ensure a baseline level of browser security for every service that it protects. These headers _cannot_ be overridden by upstream services, but _can_ be overridden in the `HEADER_OVERRIDES` environment variable.
126+
`sso_proxy` adds the following headers to every outgoing request, to ensure a baseline level of browser security for every service that it protects.
127+
These headers _cannot_ be overridden by upstream services themselves, but _can_ be overridden in invdividual upstream configurations by setting the `header_overrides` variable.
124128

125129
* `Strict-Transport-Security`
126130
* `X-Content-Type-Options`
@@ -144,7 +148,7 @@ The **session\_ttl\_valid** option controls the amount of time it will take for
144148
will make an _internal request_ to `sso_auth` (i.e. invisible to the
145149
end user) to revalidate & refresh the session.
146150

147-
The **sessioni\_ttl\_lifetime** option controls the maximum lifetime of a
151+
The **session\_ttl\_lifetime** option controls the maximum lifetime of a
148152
`sso_proxy` session, after which a user will be 301 redirected to
149153
`sso_auth` to go through the 3rd party OAuth2 flow again.
150154

docs/sso_proxy_config.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Available Configuration Variables
2+
We currently use environment variables to read configuration options, below is a list of environment variables and
3+
their corresponding types that the sso proxy will read.
4+
5+
Defaults for the below settings can be found here: https://github.com/buzzfeed/sso/blob/main/internal/proxy/configuration.go#L61-L105
6+
7+
8+
## Session and Server configuration
9+
10+
### Session
11+
```
12+
SESSION_COOKIE_NAME - string - name associated with the session cookie
13+
SESSION_COOKIE_SECRET - string - seed string for secure cookies
14+
SESSION_COOKIE_DOMAIN - string - cookie domain to force cookies to (ie: .yourcompany.com)*
15+
SESSION_COOKIE_SECURE - bool - set secure (HTTPS) cookie flag
16+
SESSION_COOKIE_HTTPONLY - bool - set 'httponly' cookie flag
17+
SESSION_TTL_LIFETIME - time.Duration - 'time-to-live' of a session lifetime
18+
SESSION_TTL_VALID - time.Duration - 'time-to-live' of a valid session
19+
SESSION_TTL_GRACEPERIOD - time.Duration - time period in which session data can be reused while the provider is unavailable.
20+
```
21+
22+
### Server
23+
```
24+
SERVER_PORT - string - port the http server listens on
25+
SERVER_TIMEOUT_SHUTDOWN - time.Duration - time to allow in-flight requests to complete before server shutdown
26+
SERVER_TIMEOUT_READ - time.Duration - read request timeout
27+
SERVER_TIMEOUT_WRITE - time.Duration - write request timeout
28+
```
29+
30+
### Client
31+
```
32+
CLIENT_ID - string - the OAuth Client ID: ie: "123456.apps.googleusercontent.com"
33+
CLIENT_SECRET - string - the OAuth Client secret
34+
```
35+
36+
### Request Signer
37+
```
38+
REQUESTSIGNER_KEY - string - RSA private key used for digitally signing requests
39+
```
40+
41+
## Upstream and Provider Configuration
42+
43+
### Upstream
44+
For further upstream configuration, see https://github.com/buzzfeed/sso/blob/main/docs/sso_config.md.
45+
```
46+
UPSTREAM_DEFAULT_EMAIL_DOMAINS - []string - default setting for upstream `allowed_email_domains` variable
47+
UPSTREAM_DEFAULT_EMAIL_ADDRESSES - []string - default setting for upstream `allowed_email_addresses` variable
48+
UPSTREAM_DEFAULT_GROUPS - []string - default setting for upstream `allowed groups` variable
49+
UPSTREAM_DEFAULT_TIMEOUT - time.Duration - default setting for upstream `timeout` variable
50+
UPSTREAM_DEFAULT_TCP_RESET_DEADLINE - time.Duration - default time period to wait for a response from an upstream
51+
UPSTREAM_DEFAULT_PROVIDER - string - default setting for the upstream `provider_slug` variable
52+
UPSTREAM_CONFIGS_FILE - string - path to the file containing upstream configurations
53+
UPSTREAM_SCHEME - string - the scheme used for upstreams (e.g. `https`)
54+
UPSTREAM_CLUSTER - string - the cluster in which this is running, used within upstream configuration
55+
```
56+
57+
## Provider
58+
```
59+
PROVIDER_TYPE - string - string - the 'type' of upstream provider to use (at this time, only a provider type of 'sso' is supported)
60+
PROVIDER_URL_EXTERNAL - string - the external URL for the upstream provider in this environment (e.g. "https://sso-auth.example.com")
61+
PROVIDER_URL_INTERNAL - string - the internal URL for the upstream provider in this environment (e.g. "https://sso-auth-int.example.com")
62+
PROVIDER_SCOPE - string - OAuth `scope` sent with provider requests
63+
```
64+
65+
## Logging and Monitoring Configuration
66+
### StatsD
67+
```
68+
METRICS_STATSD_PORT - int - port that statsdclient listens on
69+
METRICS_STATSD_HOST - string - hostname that statsd client uses
70+
```
71+
72+
### Logging
73+
```
74+
LOGGING_ENABLE - bool - enable request logging
75+
```

internal/proxy/configuration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import (
4949
// UPSTREAM_DEFAULT_TIMEOUT
5050
// UPSTREAM_DEFAULT_TCP_RESET_DEADLINE
5151
// UPSTREAM_DEFAULT_PROVIDER
52-
// UPSTREAM_CONFIGS_FILE
52+
// UPSTREAM_CONFIGFILE
5353
// UPSTREAM_SCHEME
5454
// UPSTREAM_CLUSTER
5555
//

quickstart/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
# (Optional) Allow specific google email address to log in for demo purposes
3535
# - UPSTREAM_DEFAULT_EMAIL_ADDRESSES=*
3636

37-
- UPSTREAM_CONFIGSFILE=/sso/upstream_configs.yml
37+
- UPSTREAM_CONFIGFILE=/sso/upstream_configs.yml
3838
- PROVIDER_URL_EXTERNAL=http://sso-auth.localtest.me
3939
- PROVIDER_URL_INTERNAL=http://host.docker.internal
4040

0 commit comments

Comments
 (0)