Expose the authorized keys tmate feature (#18)
* Expose the authorized keys tmate feature Described here: https://tmate.io/ in "Access Control" The variable accepts the file content in raw format (with \n) and dumps it into a file which tmate reads * Use echo instead of printf * Add missing quote * Only setup tmate settings if debug is activated
This commit is contained in:
@@ -214,6 +214,9 @@ func registerCompile(app *kingpin.Application) {
|
||||
cmd.Flag("tmate-server-ed25519-fingerprint", "tmate server rsa fingerprint").
|
||||
StringVar(&c.Tmate.ED25519)
|
||||
|
||||
cmd.Flag("tmate-authorized-keys", "tmate authorized keys").
|
||||
StringVar(&c.Tmate.AuthorizedKeys)
|
||||
|
||||
// shared pipeline flags
|
||||
c.Flags = internal.ParseFlags(cmd)
|
||||
}
|
||||
|
||||
@@ -108,12 +108,13 @@ type Config struct {
|
||||
}
|
||||
|
||||
Tmate struct {
|
||||
Enabled bool `envconfig:"DRONE_TMATE_ENABLED" default:"false"`
|
||||
Image string `envconfig:"DRONE_TMATE_IMAGE" default:"drone/drone-runner-docker:1"`
|
||||
Server string `envconfig:"DRONE_TMATE_HOST"`
|
||||
Port string `envconfig:"DRONE_TMATE_PORT"`
|
||||
RSA string `envconfig:"DRONE_TMATE_FINGERPRINT_RSA"`
|
||||
ED25519 string `envconfig:"DRONE_TMATE_FINGERPRINT_ED25519"`
|
||||
Enabled bool `envconfig:"DRONE_TMATE_ENABLED" default:"false"`
|
||||
Image string `envconfig:"DRONE_TMATE_IMAGE" default:"drone/drone-runner-docker:1"`
|
||||
Server string `envconfig:"DRONE_TMATE_HOST"`
|
||||
Port string `envconfig:"DRONE_TMATE_PORT"`
|
||||
RSA string `envconfig:"DRONE_TMATE_FINGERPRINT_RSA"`
|
||||
ED25519 string `envconfig:"DRONE_TMATE_FINGERPRINT_ED25519"`
|
||||
AuthorizedKeys string `envconfig:"DRONE_TMATE_AUTHORIZED_KEYS"`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,12 +142,13 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
|
||||
ShmSize: config.Resources.ShmSize,
|
||||
},
|
||||
Tmate: compiler.Tmate{
|
||||
Image: config.Tmate.Image,
|
||||
Enabled: config.Tmate.Enabled,
|
||||
Server: config.Tmate.Server,
|
||||
Port: config.Tmate.Port,
|
||||
RSA: config.Tmate.RSA,
|
||||
ED25519: config.Tmate.ED25519,
|
||||
Image: config.Tmate.Image,
|
||||
Enabled: config.Tmate.Enabled,
|
||||
Server: config.Tmate.Server,
|
||||
Port: config.Tmate.Port,
|
||||
RSA: config.Tmate.RSA,
|
||||
ED25519: config.Tmate.ED25519,
|
||||
AuthorizedKeys: config.Tmate.AuthorizedKeys,
|
||||
},
|
||||
Environ: provider.Combine(
|
||||
provider.Static(config.Runner.Environ),
|
||||
|
||||
@@ -348,6 +348,9 @@ func registerExec(app *kingpin.Application) {
|
||||
cmd.Flag("tmate-server-ed25519-fingerprint", "tmate server rsa fingerprint").
|
||||
StringVar(&c.Tmate.ED25519)
|
||||
|
||||
cmd.Flag("tmate-authorized-keys", "tmate authorized keys").
|
||||
StringVar(&c.Tmate.AuthorizedKeys)
|
||||
|
||||
cmd.Flag("debug", "enable debug logging").
|
||||
BoolVar(&c.Debug)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user