pico

created pr with 84.1 on 2025-12-01T05:25:52Z · by c8ef7d19
added 84.2 on 2025-12-13T00:51:45Z · by c8ef7d19
1: 659964e ! 1: af4cda9 feat: access control using ssh certs
-: ------- > 2: d9a74df chore: logging and cleanup
added 84.3 on 2025-12-13T02:02:13Z · by c8ef7d19
1: af4cda9 < -: ------- feat: access control using ssh certs
2: d9a74df ! 1: bb8ef88 feat: access control using ssh certs
cmds
checkout latest patchset:
ssh pr.pico.sh print 84 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 84.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 84
+2 -1 pkg/apps/pico/ssh.go #
......@@ -76,7 +76,8 @@ func StartSshServer() {
7676 promPort,
7777 "ssh_data/term_info_ed25519",
7878 func(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) {
79- perms, _ := sshAuth.PubkeyAuthHandler(conn, key)
79+ perms, err := sshAuth.PubkeyAuthHandler(conn, key)
80+ logger.Warn("pubkey auth handler", "err", err)
8081 if perms == nil {
8182 perms = &ssh.Permissions{
8283 Extensions: map[string]string{
+7 -7 pkg/shared/ssh.go #
......@@ -42,7 +42,7 @@ func (r *SshAuthHandler) PubkeyAuthHandler(conn ssh.ConnMetadata, key ssh.Public
4242 cert, ok := key.(*ssh.Certificate)
4343 if ok {
4444 if cert.CertType != ssh.UserCert {
45- return nil, fmt.Errorf("ssh: cert has type %d", cert.CertType)
45+ return nil, fmt.Errorf("ssh-cert has type %d", cert.CertType)
4646 }
4747
4848 found := false
......@@ -53,16 +53,16 @@ func (r *SshAuthHandler) PubkeyAuthHandler(conn ssh.ConnMetadata, key ssh.Public
5353 }
5454 }
5555 if !found {
56- return nil, fmt.Errorf("ssh: principals not valid")
56+ return nil, fmt.Errorf("ssh-cert principals not valid")
5757 }
5858
5959 clock := time.Now
6060 unixNow := clock().Unix()
6161 if after := int64(cert.ValidAfter); after < 0 || unixNow < int64(cert.ValidAfter) {
62- return nil, fmt.Errorf("ssh: cert is not yet valid")
62+ return nil, fmt.Errorf("ssh-cert is not yet valid")
6363 }
6464 if before := int64(cert.ValidBefore); cert.ValidBefore != uint64(ssh.CertTimeInfinity) && (unixNow >= before || before < 0) {
65- return nil, fmt.Errorf("ssh: cert has expired")
65+ return nil, fmt.Errorf("ssh-cert has expired")
6666 }
6767
6868 pubkey = utils.KeyForKeyText(cert.SignatureKey)
......@@ -82,9 +82,9 @@ func (r *SshAuthHandler) PubkeyAuthHandler(conn ssh.ConnMetadata, key ssh.Public
8282 }
8383
8484 // TODO: fix since we don't always have access to public key record here
85- if !user.PublicKey.IsValid() {
86- return nil, fmt.Errorf("public key has been revoked")
87- }
85+ // if !user.PublicKey.IsValid() {
86+ // return nil, fmt.Errorf("public key has been revoked")
87+ // }
8888
8989 if user.Name == "" {
9090 log.Error("username is not set")
Back to top