This commit is contained in:
Victor LABORIE 2018-03-27 16:39:03 +02:00
parent 0927e79954
commit d565374c5d

6
bkctld
View file

@ -22,7 +22,7 @@ Subcommands:
sync <jailname>|all Sync jail <jailname> or all to another node
status [<jailname>] Print status of <jailname> (default all jail)
key <jailname> [<keyfile>] Set or get ssh pubic key of <jailname>
port <jailname> [<ssh_port>|auto] Set or get ssh port of <jailname>
port <jailname> [<port>|auto] Set or get ssh port of <jailname>
ip <jailname> [<ip>|all] Set or get allowed(s) ip(s) of <jailname>
inc Make incremental inc of all jails
rm Remove old incremtal inc of all jails
@ -137,9 +137,7 @@ set_port() {
if [ "$port" = "auto" ]; then
port=$(grep -h Port ${JAILDIR}/*/${SSHD_CONFIG} 2>/dev/null | grep -Eo "[0-9]+" | sort -n | tail -1)
port=$((port+1))
if [ ! $port -gt 1 ]; then
port=2222
fi
[ "${port}" -le 1 ] && port=2222
fi
sed -i "s/^Port .*/Port ${port}/" ${JAILDIR}/$jail/${SSHD_CONFIG}
set_firewall $jail