Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions cmd/authdaemon/authdaemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ var (

func AuthDaemonCmd() *cobra.Command {
opts := struct {
PreSharedKey string
Port int
PrincipalsFile string
CACertPath string
PreSharedKey string
Port int
PrincipalsFile string
CACertPath string
GenerateRandomPassword bool
}{}

cmd := &cobra.Command{
Expand All @@ -57,6 +58,7 @@ func AuthDaemonCmd() *cobra.Command {
cmd.Flags().IntVar(&opts.Port, "port", defaultPort, "TCP listen port for the HTTPS server")
cmd.Flags().StringVar(&opts.PrincipalsFile, "principals-file", defaultPrincipalsPath, "Path to the principals file")
cmd.Flags().StringVar(&opts.CACertPath, "ca-cert-path", defaultCACertPath, "Path to the CA certificate file")
cmd.Flags().BoolVar(&opts.GenerateRandomPassword, "generate-random-password", false, "Generate a random password for authenticated users")

cmd.AddCommand(PrincipalsCmd())

Expand Down Expand Up @@ -112,17 +114,19 @@ func runPrincipals(principalsPath, username string) {
}

func runAuthDaemon(opts struct {
PreSharedKey string
Port int
PrincipalsFile string
CACertPath string
PreSharedKey string
Port int
PrincipalsFile string
CACertPath string
GenerateRandomPassword bool
}) {
cfg := authdaemonpkg.Config{
Port: opts.Port,
PresharedKey: opts.PreSharedKey,
PrincipalsFilePath: opts.PrincipalsFile,
CACertPath: opts.CACertPath,
Force: true,
Port: opts.Port,
PresharedKey: opts.PreSharedKey,
PrincipalsFilePath: opts.PrincipalsFile,
CACertPath: opts.CACertPath,
Force: true,
GenerateRandomPassword: opts.GenerateRandomPassword,
}

srv, err := authdaemonpkg.NewServer(cfg)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/charmbracelet/huh v0.8.0
github.com/charmbracelet/lipgloss v1.1.0
github.com/creack/pty v1.1.24
github.com/fosrl/newt v1.10.0
github.com/fosrl/newt v1.10.1
github.com/fosrl/olm v1.4.3
github.com/mattn/go-isatty v0.0.20
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/fosrl/newt v1.10.0 h1:k4bJGcUvGcyoO8QNBi5/RGbLpLC1ZUdau3Hecic+71A=
github.com/fosrl/newt v1.10.0/go.mod h1:d1+yYMnKqg4oLqAM9zdbjthjj2FQEVouiACjqU468ck=
github.com/fosrl/newt v1.10.1 h1:3RZqYhJDDBWZHViVeDl4hWwWVJFtvFJB+wL+AF99neA=
github.com/fosrl/newt v1.10.1/go.mod h1:d1+yYMnKqg4oLqAM9zdbjthjj2FQEVouiACjqU468ck=
github.com/fosrl/olm v1.4.3 h1:hmAWfrJzpiwtvzw/B6xmCmeqK1OW0BJ2FUbEa7ztlmU=
github.com/fosrl/olm v1.4.3/go.mod h1:aC1oieI0tadd66zY7RDjXT3PPsR54mYS0FYMsHqFqs8=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down
Loading