vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Let remote admin create a bot account
338a19dd7e42c2bf42c206318197f4b53c3e9fd7 · Keenan Nemetz · 6d ago · parent 70291860
server/ssh/admin.go +13−2
| @@ -178,17 +178,28 @@ func (s *Server) adminAccount(action string, args []string, actor string, in io. | |||
| 178 | 178 | case "create": | |
| 179 | 179 | f, err := parseAdminFlags(args, | |
| 180 | 180 | adminFlagSpec{long: "no-key", boolean: true}, | |
| 181 | adminFlagSpec{long: "bot", boolean: true}, | ||
| 181 | 182 | adminFlagSpec{long: "role"}) | |
| 182 | 183 | if err != nil { | |
| 183 | 184 | return nil, nil, err | |
| 184 | 185 | } | |
| 185 | 186 | if len(f.rest) != 1 { | |
| 186 | return nil, nil, &adminUsageError{msg: "usage: vole-admin account create [--no-key] [--role <role>] <name> (public key on stdin unless --no-key)"} | ||
| 187 | return nil, nil, &adminUsageError{msg: "usage: vole-admin account create [--no-key] [--bot] [--role <role>] <name> (public key on stdin unless --no-key)"} | ||
| 187 | 188 | } | |
| 188 | 189 | role, err := access.ParseRole(f.one("role")) | |
| 189 | 190 | if err != nil { | |
| 190 | 191 | return nil, nil, err | |
| 191 | 192 | } | |
| 193 | // A bot has no browser sign-in, so an invitation would be a secret it could | ||
| 194 | // never use. The local CLI refuses this too; refuse it here rather than | ||
| 195 | // create an account nobody can act as. | ||
| 196 | if f.has("bot") && f.has("no-key") { | ||
| 197 | return nil, nil, &adminUsageError{msg: "a bot account has no browser sign-in, so it needs a key: send a public key on stdin instead of passing --no-key"} | ||
| 198 | } | ||
| 199 | create := s.cfg.Identity.CreateWithRole | ||
| 200 | if f.has("bot") { | ||
| 201 | create = s.cfg.Identity.CreateBot | ||
| 202 | } | ||
| 192 | 203 | if f.has("no-key") { | |
| 193 | 204 | a, inv, err := s.cfg.Identity.CreateWithInviteRole(f.rest[0], role, actor, 0) | |
| 194 | 205 | if err != nil { | |
| @@ -204,7 +215,7 @@ func (s *Server) adminAccount(action string, args []string, actor string, in io. | |||
| 204 | 215 | if err != nil { | |
| 205 | 216 | return nil, nil, err | |
| 206 | 217 | } | |
| 207 | a, err := s.cfg.Identity.CreateWithRole(f.rest[0], role, key, actor) | ||
| 218 | a, err := create(f.rest[0], role, key, actor) | ||
| 208 | 219 | if err != nil { | |
| 209 | 220 | return nil, nil, err | |
| 210 | 221 | } | |