Skip to content

Commit 51c1ed6

Browse files
committed
fix: Remove "coder" user and group from systemd service
This caused an inability to listen on privileged ports and read certs from LetsEncrypt. It seems more hurtful rather than helpful, so removing the restriction seems reasonable.
1 parent d371a66 commit 51c1ed6

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

cli/start.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ func start() *cobra.Command {
161161
client.HTTPClient.Transport = &http.Transport{
162162
TLSClientConfig: tlsConfig,
163163
}
164+
client.URL = accessURLParsed
164165
}
165166

166167
provisionerDaemons := make([]*provisionerd.Server, 0)
@@ -211,15 +212,13 @@ func start() *cobra.Command {
211212
// such as via the systemd service.
212213
_ = config.URL().Write(client.URL.String())
213214

214-
hasFirstUser, err := client.HasFirstUser(cmd.Context())
215-
if err != nil {
216-
return xerrors.Errorf("check for first user: %w", err)
217-
}
218-
219215
_, _ = fmt.Fprintf(cmd.OutOrStdout(), cliui.Styles.Paragraph.Render(cliui.Styles.Wrap.Render(cliui.Styles.Prompt.String()+`Started in `+
220216
cliui.Styles.Field.Render("production")+` mode. All data is stored in the PostgreSQL provided! Press `+cliui.Styles.Field.Render("ctrl+c")+` to gracefully shutdown.`))+"\n")
221217

222-
if !hasFirstUser {
218+
hasFirstUser, err := client.HasFirstUser(cmd.Context())
219+
if !hasFirstUser && err == nil {
220+
// This could fail for a variety of TLS-related reasons.
221+
// This is a helpful starter message, and not critical for user interaction.
223222
_, _ = fmt.Fprint(cmd.OutOrStdout(), cliui.Styles.Paragraph.Render(cliui.Styles.Wrap.Render(cliui.Styles.FocusedPrompt.String()+`Run `+cliui.Styles.Code.Render("coder login "+client.URL.String())+" in a new terminal to get started.\n")))
224223
}
225224
}

coder.service

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ StartLimitBurst=3
1010
[Service]
1111
Type=notify
1212
EnvironmentFile=/etc/coder.d/coder.env
13-
User=coder
14-
Group=coder
1513
ProtectSystem=full
1614
ProtectHome=read-only
1715
PrivateTmp=yes
1816
PrivateDevices=yes
1917
SecureBits=keep-caps
20-
AmbientCapabilities=CAP_IPC_LOCK CAP_NET_BIND_SERVICE
21-
CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
18+
AmbientCapabilities=CAP_IPC_LOCK
19+
CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK CAP_NET_BIND_SERVICE
2220
NoNewPrivileges=yes
2321
ExecStart=/usr/bin/coder start
2422
Restart=on-failure

0 commit comments

Comments
 (0)