Loading authorized/authorized.go +2 −2 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ func Run(args []string) int { fmt.Fprintf(os.Stderr, "ERROR: %s\n", err) return 1 } fmt.Printf("command=\"%s --user %s --fp %s\",restrict %s %s\n", fmt.Printf("command=\"%s --user %s --fp %s\",restrict,pty %s %s\n", bulletin, sshKey.Login, fp, keyType, keyBase64) return 0 } Loading @@ -84,7 +84,7 @@ func Run(args []string) int { fmt.Fprintf(os.Stderr, "ERROR: %s\n", err) return 1 } fmt.Printf("command=\"%s --onboard --fp %s --pubkey %s:%s\",restrict %s %s\n", fmt.Printf("command=\"%s --onboard --fp %s --pubkey %s:%s\",restrict,pty %s %s\n", bulletin, fp, keyType, keyBase64, keyType, keyBase64) return 0 } Loading batch/batch.go +1 −1 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ func MigrateKeysWithQueries(q *storage.Queries) error { } // Write this entry back in the new secure format. newLine := fmt.Sprintf("command=\"%s --user %s\",restrict %s", newLine := fmt.Sprintf("command=\"%s --user %s\",restrict,pty %s", bulletin, login, keyLine) rewriteLines = append(rewriteLines, newLine) migrated++ Loading key/key.go +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import ( "golang.org/x/sys/unix" ) var keytemplate = `command="%s --user %s",restrict %s` var keytemplate = `command="%s --user %s",restrict,pty %s` // Add adds an ssh key to the `authorized_keys` file. func Add(login, public string) error { Loading repl/command.go +6 −2 Original line number Diff line number Diff line Loading @@ -1015,7 +1015,11 @@ The following actions are available: Action: ActionUserNoadmin, }, "LIST": { Description: ` Lists all the users. Must be an admin.`, Description: ` Lists all the users. Must be an admin. Each user is shown with flags [a, m, d, p] where: a = admin, m = moderator, d = disabled, p = prompt A value of 1 means the flag is set, 0 means it is not.`, Action: ActionUserList, }, "NAME": { Loading repl/show.go +6 −4 Original line number Diff line number Diff line Loading @@ -128,13 +128,15 @@ func ActionShowUser(cmd *dclish.Command) error { return nil } } var showLogin int64 var showDisabled int64 if cmd.Flags["/LOGIN"].Value == "true" { if this.User.Admin == 0 { fmt.Println("ERROR: You are not an admin.") return nil } showLogin = 1 showDisabled = 0 } else { showDisabled = 1 } folder := this.Folder if cmd.Flags["/FOLDER"].Set { Loading Loading @@ -169,7 +171,7 @@ func ActionShowUser(cmd *dclish.Command) error { // Actually do the thing. ctx := storage.Context() if cmd.Flags["/LOGIN"].Set && cmd.Flags["/FOLDER"].Set { rows, err := this.Q.GetLastReadByEnabled(ctx, folder.Name, showLogin) rows, err := this.Q.GetLastReadByEnabled(ctx, folder.Name, showDisabled) if err != nil { fmt.Printf("ERROR: Failed to get list (%s).\n", err) return nil Loading Loading @@ -197,7 +199,7 @@ func ActionShowUser(cmd *dclish.Command) error { fmt.Println("User Folder Message #") fmt.Printf("%-12s %-25s % 4d\n", r.Author, folder.Name, r.ID) } else if cmd.Flags["/LOGIN"].Set { rows, err := this.Q.GetLastLoginByEnabled(ctx, showLogin) rows, err := this.Q.GetLastLoginByEnabled(ctx, showDisabled) if err != nil { fmt.Printf("ERROR: Failed to get list (%s).\n", err) return nil Loading Loading
authorized/authorized.go +2 −2 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ func Run(args []string) int { fmt.Fprintf(os.Stderr, "ERROR: %s\n", err) return 1 } fmt.Printf("command=\"%s --user %s --fp %s\",restrict %s %s\n", fmt.Printf("command=\"%s --user %s --fp %s\",restrict,pty %s %s\n", bulletin, sshKey.Login, fp, keyType, keyBase64) return 0 } Loading @@ -84,7 +84,7 @@ func Run(args []string) int { fmt.Fprintf(os.Stderr, "ERROR: %s\n", err) return 1 } fmt.Printf("command=\"%s --onboard --fp %s --pubkey %s:%s\",restrict %s %s\n", fmt.Printf("command=\"%s --onboard --fp %s --pubkey %s:%s\",restrict,pty %s %s\n", bulletin, fp, keyType, keyBase64, keyType, keyBase64) return 0 } Loading
batch/batch.go +1 −1 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ func MigrateKeysWithQueries(q *storage.Queries) error { } // Write this entry back in the new secure format. newLine := fmt.Sprintf("command=\"%s --user %s\",restrict %s", newLine := fmt.Sprintf("command=\"%s --user %s\",restrict,pty %s", bulletin, login, keyLine) rewriteLines = append(rewriteLines, newLine) migrated++ Loading
key/key.go +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import ( "golang.org/x/sys/unix" ) var keytemplate = `command="%s --user %s",restrict %s` var keytemplate = `command="%s --user %s",restrict,pty %s` // Add adds an ssh key to the `authorized_keys` file. func Add(login, public string) error { Loading
repl/command.go +6 −2 Original line number Diff line number Diff line Loading @@ -1015,7 +1015,11 @@ The following actions are available: Action: ActionUserNoadmin, }, "LIST": { Description: ` Lists all the users. Must be an admin.`, Description: ` Lists all the users. Must be an admin. Each user is shown with flags [a, m, d, p] where: a = admin, m = moderator, d = disabled, p = prompt A value of 1 means the flag is set, 0 means it is not.`, Action: ActionUserList, }, "NAME": { Loading
repl/show.go +6 −4 Original line number Diff line number Diff line Loading @@ -128,13 +128,15 @@ func ActionShowUser(cmd *dclish.Command) error { return nil } } var showLogin int64 var showDisabled int64 if cmd.Flags["/LOGIN"].Value == "true" { if this.User.Admin == 0 { fmt.Println("ERROR: You are not an admin.") return nil } showLogin = 1 showDisabled = 0 } else { showDisabled = 1 } folder := this.Folder if cmd.Flags["/FOLDER"].Set { Loading Loading @@ -169,7 +171,7 @@ func ActionShowUser(cmd *dclish.Command) error { // Actually do the thing. ctx := storage.Context() if cmd.Flags["/LOGIN"].Set && cmd.Flags["/FOLDER"].Set { rows, err := this.Q.GetLastReadByEnabled(ctx, folder.Name, showLogin) rows, err := this.Q.GetLastReadByEnabled(ctx, folder.Name, showDisabled) if err != nil { fmt.Printf("ERROR: Failed to get list (%s).\n", err) return nil Loading Loading @@ -197,7 +199,7 @@ func ActionShowUser(cmd *dclish.Command) error { fmt.Println("User Folder Message #") fmt.Printf("%-12s %-25s % 4d\n", r.Author, folder.Name, r.ID) } else if cmd.Flags["/LOGIN"].Set { rows, err := this.Q.GetLastLoginByEnabled(ctx, showLogin) rows, err := this.Q.GetLastLoginByEnabled(ctx, showDisabled) if err != nil { fmt.Printf("ERROR: Failed to get list (%s).\n", err) return nil Loading