change AllowAgentForwarding in SSHD configuration if, necessary
authorPeter Müller <peter.mueller@ipfire.org>
Mon, 8 Apr 2019 16:35:00 +0000 (16:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Apr 2019 20:15:35 +0000 (21:15 +0100)
Fixes #11931

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/misc-progs/sshctrl.c

index 3007497..476dbc9 100644 (file)
@@ -76,6 +76,11 @@ int main(int argc, char *argv[])
                                else
                                                strlcat(command, "s/^Port .*$/Port 222/", STRING_SIZE - 1 );
 
+                               if(findkey(kv, "SSH_AGENT_FORWARDING", buffer) && !strcmp(buffer,"on"))
+                                               strlcat(command, "s/^AllowAgentForwarding .*$/AllowAgentForwarding yes/;", STRING_SIZE - 1 );
+                               else
+                                               strlcat(command, "s/^AllowAgentForwarding .*$/AllowAgentForwarding no/;", STRING_SIZE - 1 );
+
                                freekeyvalues(kv);
 
                                snprintf(buffer, STRING_SIZE - 1, "' /etc/ssh/sshd_config >&%d", config_fd );