gitolite/src/triggers/post-compile/ssh-authkeys-shell-users
John Keeping 4abadc2b54 Grant shell access to all keys for shell users
If a user has multiple keys, ssh-authkeys-shell-users will only add the
"-s" flag to the first key it finds.  Change the substitution to apply
to all matching lines and hence grant shell access to all of the user's
keys.

Signed-off-by: John Keeping <john@keeping.me.uk>
2012-06-03 13:00:38 +05:30

32 lines
639 B
Perl
Executable file

#!/usr/bin/perl
use strict;
use warnings;
use File::Temp qw(tempfile);
use lib $ENV{GL_LIBDIR};
use Gitolite::Rc;
use Gitolite::Common;
$|++;
my $akfile = "$ENV{HOME}/.ssh/authorized_keys";
my $sufile = $rc{SHELL_USERS_LIST} or exit 0;
-r $sufile or _die "'$sufile' not readable";
# ----------------------------------------------------------------------
my $aktext = slurp($akfile);
for my $su ( shell_users() ) {
$aktext =~ s(/gitolite-shell $su([" ].*?),no-pty )(/gitolite-shell -s $su$1 )g;
}
_print( $akfile, $aktext );
sub shell_users {
my @ret = grep { not /^#/ } slurp($sufile);
chomp(@ret);
return @ret;
}