Rewrite admin interface from sudo to sshd forced command. gitery-admin users can be registered by adding restrict,command="/usr/libexec/gitery-admin/gitery-admin" ssh-keytype ssh-key comment lines to root's authorized_keys file.
23 lines
410 B
Bash
Executable File
23 lines
410 B
Bash
Executable File
#!/bin/sh -e
|
|
|
|
. gitery-admin-sh-functions
|
|
|
|
usage()
|
|
{
|
|
echo "$PROG: $*" >&2
|
|
echo "usage: $PROG <NAME> < IDENTITY"
|
|
exit 1
|
|
}
|
|
|
|
set_name "$1"
|
|
shift
|
|
|
|
load_identity
|
|
|
|
AUTH="/etc/openssh/authorized_keys/$IT_NAME"
|
|
[ -w "$AUTH" ] ||
|
|
fatal "error changing $NAME: authorized keys file '$AUTH' doesn't exist"
|
|
|
|
echo "restrict $IDENTITY" >> "$AUTH" ||
|
|
fatal "error creating authorized keys file '$AUTH' for user $IT_NAME"
|