Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 56ef29e

Browse files
committedAug 12, 2024
rebase on main
1 parent 1352640 commit 56ef29e

20 files changed

+2428
-4
lines changed
 

‎docs/admin-old/auth.md

+250
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
# Authentication
2+
3+
![OIDC with Coder Sequence Diagram](../images/oidc-sequence-diagram.svg).
4+
5+
By default, Coder is accessible via password authentication. Coder does not
6+
recommend using password authentication in production, and recommends using an
7+
authentication provider with properly configured multi-factor authentication
8+
(MFA). It is your responsibility to ensure the auth provider enforces MFA
9+
correctly.
10+
11+
The following steps explain how to set up GitHub OAuth or OpenID Connect.
12+
13+
## GitHub
14+
15+
### Step 1: Configure the OAuth application in GitHub
16+
17+
First,
18+
[register a GitHub OAuth app](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/).
19+
GitHub will ask you for the following Coder parameters:
20+
21+
- **Homepage URL**: Set to your Coder deployments
22+
[`CODER_ACCESS_URL`](../cli/server.md#--access-url) (e.g.
23+
`https://coder.domain.com`)
24+
- **User Authorization Callback URL**: Set to `https://coder.domain.com`
25+
26+
> Note: If you want to allow multiple coder deployments hosted on subdomains
27+
> e.g. coder1.domain.com, coder2.domain.com, to be able to authenticate with the
28+
> same GitHub OAuth app, then you can set **User Authorization Callback URL** to
29+
> the `https://domain.com`
30+
31+
Note the Client ID and Client Secret generated by GitHub. You will use these
32+
values in the next step.
33+
34+
Coder will need permission to access user email addresses. Find the "Account
35+
Permissions" settings for your app and select "read-only" for "Email addresses".
36+
37+
### Step 2: Configure Coder with the OAuth credentials
38+
39+
Navigate to your Coder host and run the following command to start up the Coder
40+
server:
41+
42+
```shell
43+
coder server --oauth2-github-allow-signups=true --oauth2-github-allowed-orgs="your-org" --oauth2-github-client-id="8d1...e05" --oauth2-github-client-secret="57ebc9...02c24c"
44+
```
45+
46+
> For GitHub Enterprise support, specify the
47+
> `--oauth2-github-enterprise-base-url` flag.
48+
49+
Alternatively, if you are running Coder as a system service, you can achieve the
50+
same result as the command above by adding the following environment variables
51+
to the `/etc/coder.d/coder.env` file:
52+
53+
```env
54+
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
55+
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
56+
CODER_OAUTH2_GITHUB_CLIENT_ID="8d1...e05"
57+
CODER_OAUTH2_GITHUB_CLIENT_SECRET="57ebc9...02c24c"
58+
```
59+
60+
**Note:** To allow everyone to signup using GitHub, set:
61+
62+
```env
63+
CODER_OAUTH2_GITHUB_ALLOW_EVERYONE=true
64+
```
65+
66+
Once complete, run `sudo service coder restart` to reboot Coder.
67+
68+
If deploying Coder via Helm, you can set the above environment variables in the
69+
`values.yaml` file as such:
70+
71+
```yaml
72+
coder:
73+
env:
74+
- name: CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS
75+
value: "true"
76+
- name: CODER_OAUTH2_GITHUB_CLIENT_ID
77+
value: "533...des"
78+
- name: CODER_OAUTH2_GITHUB_CLIENT_SECRET
79+
value: "G0CSP...7qSM"
80+
# If setting allowed orgs, comment out CODER_OAUTH2_GITHUB_ALLOW_EVERYONE and its value
81+
- name: CODER_OAUTH2_GITHUB_ALLOWED_ORGS
82+
value: "your-org"
83+
# If allowing everyone, comment out CODER_OAUTH2_GITHUB_ALLOWED_ORGS and it's value
84+
#- name: CODER_OAUTH2_GITHUB_ALLOW_EVERYONE
85+
# value: "true"
86+
```
87+
88+
To upgrade Coder, run:
89+
90+
```shell
91+
helm upgrade <release-name> coder-v2/coder -n <namespace> -f values.yaml
92+
```
93+
94+
> We recommend requiring and auditing MFA usage for all users in your GitHub
95+
> organizations. This can be enforced from the organization settings page in the
96+
> "Authentication security" sidebar tab.
97+
98+
## OpenID Connect
99+
100+
The following steps through how to integrate any OpenID Connect provider (Okta,
101+
Active Directory, etc.) to Coder.
102+
103+
### Step 1: Set Redirect URI with your OIDC provider
104+
105+
Your OIDC provider will ask you for the following parameter:
106+
107+
- **Redirect URI**: Set to `https://coder.domain.com/api/v2/users/oidc/callback`
108+
109+
### Step 2: Configure Coder with the OpenID Connect credentials
110+
111+
Navigate to your Coder host and run the following command to start up the Coder
112+
server:
113+
114+
```shell
115+
coder server --oidc-issuer-url="https://issuer.corp.com" --oidc-email-domain="your-domain-1,your-domain-2" --oidc-client-id="533...des" --oidc-client-secret="G0CSP...7qSM"
116+
```
117+
118+
If you are running Coder as a system service, you can achieve the same result as
119+
the command above by adding the following environment variables to the
120+
`/etc/coder.d/coder.env` file:
121+
122+
```env
123+
CODER_OIDC_ISSUER_URL="https://issuer.corp.com"
124+
CODER_OIDC_EMAIL_DOMAIN="your-domain-1,your-domain-2"
125+
CODER_OIDC_CLIENT_ID="533...des"
126+
CODER_OIDC_CLIENT_SECRET="G0CSP...7qSM"
127+
```
128+
129+
Once complete, run `sudo service coder restart` to reboot Coder.
130+
131+
If deploying Coder via Helm, you can set the above environment variables in the
132+
`values.yaml` file as such:
133+
134+
```yaml
135+
coder:
136+
env:
137+
- name: CODER_OIDC_ISSUER_URL
138+
value: "https://issuer.corp.com"
139+
- name: CODER_OIDC_EMAIL_DOMAIN
140+
value: "your-domain-1,your-domain-2"
141+
- name: CODER_OIDC_CLIENT_ID
142+
value: "533...des"
143+
- name: CODER_OIDC_CLIENT_SECRET
144+
value: "G0CSP...7qSM"
145+
```
146+
147+
To upgrade Coder, run:
148+
149+
```shell
150+
helm upgrade <release-name> coder-v2/coder -n <namespace> -f values.yaml
151+
```
152+
153+
## OIDC Claims
154+
155+
When a user logs in for the first time via OIDC, Coder will merge both the
156+
claims from the ID token and the claims obtained from hitting the upstream
157+
provider's `userinfo` endpoint, and use the resulting data as a basis for
158+
creating a new user or looking up an existing user.
159+
160+
To troubleshoot claims, set `CODER_VERBOSE=true` and follow the logs while
161+
signing in via OIDC as a new user. Coder will log the claim fields returned by
162+
the upstream identity provider in a message containing the string
163+
`got oidc claims`, as well as the user info returned.
164+
165+
> **Note:** If you need to ensure that Coder only uses information from the ID
166+
> token and does not hit the UserInfo endpoint, you can set the configuration
167+
> option `CODER_OIDC_IGNORE_USERINFO=true`.
168+
169+
### Email Addresses
170+
171+
By default, Coder will look for the OIDC claim named `email` and use that value
172+
for the newly created user's email address.
173+
174+
If your upstream identity provider users a different claim, you can set
175+
`CODER_OIDC_EMAIL_FIELD` to the desired claim.
176+
177+
> **Note** If this field is not present, Coder will attempt to use the claim
178+
> field configured for `username` as an email address. If this field is not a
179+
> valid email address, OIDC logins will fail.
180+
181+
### Email Address Verification
182+
183+
Coder requires all OIDC email addresses to be verified by default. If the
184+
`email_verified` claim is present in the token response from the identity
185+
provider, Coder will validate that its value is `true`. If needed, you can
186+
disable this behavior with the following setting:
187+
188+
```env
189+
CODER_OIDC_IGNORE_EMAIL_VERIFIED=true
190+
```
191+
192+
> **Note:** This will cause Coder to implicitly treat all OIDC emails as
193+
> "verified", regardless of what the upstream identity provider says.
194+
195+
### Usernames
196+
197+
When a new user logs in via OIDC, Coder will by default use the value of the
198+
claim field named `preferred_username` as the the username.
199+
200+
If your upstream identity provider uses a different claim, you can set
201+
`CODER_OIDC_USERNAME_FIELD` to the desired claim.
202+
203+
> **Note:** If this claim is empty, the email address will be stripped of the
204+
> domain, and become the username (e.g. `example@coder.com` becomes `example`).
205+
> To avoid conflicts, Coder may also append a random word to the resulting
206+
> username.
207+
208+
## OIDC Login Customization
209+
210+
If you'd like to change the OpenID Connect button text and/or icon, you can
211+
configure them like so:
212+
213+
```env
214+
CODER_OIDC_SIGN_IN_TEXT="Sign in with Gitea"
215+
CODER_OIDC_ICON_URL=https://gitea.io/images/gitea.png
216+
```
217+
218+
To change the icon and text above the OpenID Connect button, see application
219+
name and logo url in [appearance](./appearance.md) settings.
220+
221+
## Disable Built-in Authentication
222+
223+
To remove email and password login, set the following environment variable on
224+
your Coder deployment:
225+
226+
```env
227+
CODER_DISABLE_PASSWORD_AUTH=true
228+
```
229+
230+
## SCIM (enterprise)
231+
232+
Coder supports user provisioning and deprovisioning via SCIM 2.0 with header
233+
authentication. Upon deactivation, users are
234+
[suspended](./users.md#suspend-a-user) and are not deleted.
235+
[Configure](./configure.md) your SCIM application with an auth key and supply it
236+
the Coder server.
237+
238+
```env
239+
CODER_SCIM_API_KEY="your-api-key"
240+
```
241+
242+
## TLS
243+
244+
If your OpenID Connect provider requires client TLS certificates for
245+
authentication, you can configure them like so:
246+
247+
```env
248+
CODER_TLS_CLIENT_CERT_FILE=/path/to/cert.pem
249+
CODER_TLS_CLIENT_KEY_FILE=/path/to/key.pem
250+
```

‎docs/admin-old/healthcheck.md

Whitespace-only changes.

‎docs/admin-old/users.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Users
2+
3+
This article walks you through the user roles available in Coder and creating
4+
and managing users.
5+
6+
## Roles
7+
8+
Coder offers these user roles in the community edition:
9+
10+
| | Auditor | User Admin | Template Admin | Owner |
11+
| ----------------------------------------------------- | ------- | ---------- | -------------- | ----- |
12+
| Add and remove Users | || ||
13+
| Manage groups (enterprise) | || ||
14+
| Change User roles | | | ||
15+
| Manage **ALL** Templates | | |||
16+
| View **ALL** Workspaces | | |||
17+
| Update and delete **ALL** Workspaces | | | ||
18+
| Run [external provisioners](./provisioners.md) | | |||
19+
| Execute and use **ALL** Workspaces | | | ||
20+
| View all user operation [Audit Logs](./audit-logs.md) || | ||
21+
22+
A user may have one or more roles. All users have an implicit Member role that
23+
may use personal workspaces.
24+
25+
## Security notes
26+
27+
A malicious Template Admin could write a template that executes commands on the
28+
host (or `coder server` container), which potentially escalates their privileges
29+
or shuts down the Coder server. To avoid this, run
30+
[external provisioners](./provisioners.md).
31+
32+
In low-trust environments, we do not recommend giving users direct access to
33+
edit templates. Instead, use
34+
[CI/CD pipelines to update templates](../templates/change-management.md) with
35+
proper security scans and code reviews in place.
36+
37+
## User status
38+
39+
Coder user accounts can have different status types: active, dormant, and
40+
suspended.
41+
42+
### Active user
43+
44+
An _active_ user account in Coder is the default and desired state for all
45+
users. When a user's account is marked as _active_, they have complete access to
46+
the Coder platform and can utilize all of its features and functionalities
47+
without any limitations. Active users can access workspaces, templates, and
48+
interact with Coder using CLI.
49+
50+
### Dormant user
51+
52+
A user account is set to _dormant_ status when they have not yet logged in, or
53+
have not logged into the Coder platform for the past 90 days. Once the user logs
54+
in to the platform, the account status will switch to _active_.
55+
56+
Dormant accounts do not count towards the total number of licensed seats in a
57+
Coder subscription, allowing organizations to optimize their license usage.
58+
59+
### Suspended user
60+
61+
When a user's account is marked as _suspended_ in Coder, it means that the
62+
account has been temporarily deactivated, and the user is unable to access the
63+
platform.
64+
65+
Only user administrators or owners have the necessary permissions to manage
66+
suspended accounts and decide whether to lift the suspension and allow the user
67+
back into the Coder environment. This level of control ensures that
68+
administrators can enforce security measures and handle any compliance-related
69+
issues promptly.
70+
71+
Similar to dormant users, suspended users do not count towards the total number
72+
of licensed seats.

‎docs/admin/infrastructure/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ Guides for setting up and scaling Coder infrastructure.
44

55
## Architecture
66

7-
Coder is a self-hosted platform that runs on your own infrastructure. For large deployments, we recommend running the control plane on Kubernetes. Workspaces can be run as VMs or Kubernetes pods. The control plane (`coderd`) runs in a single region. However, workspace proxies, provisioners, and workspaces can run across regions or even cloud providers.
7+
Coder is a self-hosted platform that runs on your own infrastructure. For large deployments, we recommend running the control plane on Kubernetes. Workspaces can be run as VMs or Kubernetes pods. The control plane (`coderd`) runs in a single region. However, workspace proxies, provisioners, and workspaces can run across regions or even cloud providers for the optimal developer experience.
8+
9+
Learn more about Coder's architecture and concepts: [Concepts](./architecture.md)
810

911
### Kubernetes
1012

13+
- [Kubernetes Best Practices](#)
1114
- [Multi-region architecture](#)
1215
- Reference Architectures
1316
-
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.