strlcat(command, "s/^PasswordAuthentication .*$/PasswordAuthentication yes/;", STRING_SIZE - 1 );
if(findkey(kv, "ENABLE_SSH_PORTFW", buffer) && !strcmp(buffer,"on"))
- strlcat(command, "s/^AllowTcpForwarding .*$/AllowTcpForwarding yes/;", STRING_SIZE - 1 );
+ strlcat(command, "s/^AllowTcpForwarding .*$/AllowTcpForwarding yes/;" "s/^PermitOpen .*$/PermitOpen any/;", STRING_SIZE - 1 );
else
- strlcat(command, "s/^AllowTcpForwarding .*$/AllowTcpForwarding no/;", STRING_SIZE - 1 );
-
+ strlcat(command, "s/^AllowTcpForwarding .*$/AllowTcpForwarding no/;" "s/^PermitOpen .*$/PermitOpen none/;", STRING_SIZE - 1 );
+
if(findkey(kv, "SSH_PORT", buffer) && !strcmp(buffer,"on"))
- strlcat(command, "s/^Port .*$/Port 22/", STRING_SIZE - 1 );
+ strlcat(command, "s/^Port .*$/Port 22/;", STRING_SIZE - 1 );
+ 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/^Port .*$/Port 222/", STRING_SIZE - 1 );
+ strlcat(command, "s/^AllowAgentForwarding .*$/AllowAgentForwarding no/;", STRING_SIZE - 1 );
freekeyvalues(kv);
return 0;
}
else if (strcmp(argv[1], "tempstart") == 0) {
+ if (!is_valid_argument_num(argv[2])) {
+ fprintf(stderr, "Invalid time '%s'\n", argv[2]);
+ exit(2);
+ }
+
safe_system("/usr/local/bin/sshctrl");
sleep(5);
unlink("/var/ipfire/remote/enablessh");