mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add PSK for external provisionerd auth (#8877)
Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
+14
-4
@@ -494,6 +494,15 @@ func addTelemetryHeader(client *codersdk.Client, inv *clibase.Invocation) {
|
||||
// InitClient sets client to a new client.
|
||||
// It reads from global configuration files if flags are not set.
|
||||
func (r *RootCmd) InitClient(client *codersdk.Client) clibase.MiddlewareFunc {
|
||||
return r.initClientInternal(client, false)
|
||||
}
|
||||
|
||||
func (r *RootCmd) InitClientMissingTokenOK(client *codersdk.Client) clibase.MiddlewareFunc {
|
||||
return r.initClientInternal(client, true)
|
||||
}
|
||||
|
||||
// nolint: revive
|
||||
func (r *RootCmd) initClientInternal(client *codersdk.Client, allowTokenMissing bool) clibase.MiddlewareFunc {
|
||||
if client == nil {
|
||||
panic("client is nil")
|
||||
}
|
||||
@@ -508,7 +517,7 @@ func (r *RootCmd) InitClient(client *codersdk.Client) clibase.MiddlewareFunc {
|
||||
rawURL, err := conf.URL().Read()
|
||||
// If the configuration files are absent, the user is logged out
|
||||
if os.IsNotExist(err) {
|
||||
return (errUnauthenticated)
|
||||
return errUnauthenticated
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -524,9 +533,10 @@ func (r *RootCmd) InitClient(client *codersdk.Client) clibase.MiddlewareFunc {
|
||||
r.token, err = conf.Session().Read()
|
||||
// If the configuration files are absent, the user is logged out
|
||||
if os.IsNotExist(err) {
|
||||
return (errUnauthenticated)
|
||||
}
|
||||
if err != nil {
|
||||
if !allowTokenMissing {
|
||||
return errUnauthenticated
|
||||
}
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -373,6 +373,10 @@ updating, and deleting workspace resources.
|
||||
--provisioner-daemon-poll-jitter duration, $CODER_PROVISIONER_DAEMON_POLL_JITTER (default: 100ms)
|
||||
Random jitter added to the poll interval.
|
||||
|
||||
--provisioner-daemon-psk string, $CODER_PROVISIONER_DAEMON_PSK
|
||||
Pre-shared key to authenticate external provisioner daemons to Coder
|
||||
server.
|
||||
|
||||
--provisioner-daemons int, $CODER_PROVISIONER_DAEMONS (default: 3)
|
||||
Number of provisioner daemons to create on start. If builds are stuck
|
||||
in queued state for a long time, consider increasing this.
|
||||
|
||||
+3
@@ -327,6 +327,9 @@ provisioning:
|
||||
# Time to force cancel provisioning tasks that are stuck.
|
||||
# (default: 10m0s, type: duration)
|
||||
forceCancelInterval: 10m0s
|
||||
# Pre-shared key to authenticate external provisioner daemons to Coder server.
|
||||
# (default: <unset>, type: string)
|
||||
daemonPSK: ""
|
||||
# Enable one or more experiments. These are not ready for production. Separate
|
||||
# multiple experiments with commas, or enter '*' to opt-in to all available
|
||||
# experiments.
|
||||
|
||||
Reference in New Issue
Block a user