From 71bae1308b20eea52a57df97b46749db0b5d2f73 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 1 Mar 2015 20:18:22 -0800 Subject: [PATCH] User.pm: add no-pty to each key in ssh keys file Unlike various other forwarding directives, there is no global server directive to disable pty allocation. Instead no-pty must be prefixed to each and every ssh key. Ugh. Make User.pm allow an optional "no-pty " prefix when reading each ssh key from the user's key file and write out each key with a "no-pty " prefix when writing keys to the user's key file. --- Girocco/User.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Girocco/User.pm b/Girocco/User.pm index cbcc66b..7e875d3 100644 --- a/Girocco/User.pm +++ b/Girocco/User.pm @@ -120,8 +120,8 @@ sub _sshkey_load { my $authtype = ''; while () { chomp; - if (/^ssh-(?:dss|rsa) /) { - push @keys, $_; + if (/^(?:no-pty )?(ssh-(?:dss|rsa) .*)$/) { + push @keys, $1; } elsif (/^# ([A-Z]+)AUTH ([0-9a-f]+) (\d+)/) { my $expire = $3; $auth = $2 unless (time >= $expire); @@ -152,8 +152,7 @@ sub _sshkey_save { my $typestr = $self->{authtype} ? uc($self->{authtype}) : 'REPO'; print F "# ${typestr}AUTH $self->{auth} $expire\n"; } - print F $self->{keys}; - print F "\n" if $self->{keys}; + print F map("no-pty $_\n", split(/\n/, $self->{keys})); close F; chmod 0664, jailed_file($self->_sshkey_path); } -- 2.11.4.GIT