fixed knockd
This commit is contained in:
parent
ae1cc72a2b
commit
6d5d610189
@ -1,15 +1,10 @@
|
|||||||
[options]
|
[options]
|
||||||
UseSyslog
|
logfile = /var/log/knockd.log
|
||||||
|
|
||||||
[openSSH]
|
|
||||||
sequence = 7000,8000,9000
|
|
||||||
seq_timeout = 5
|
|
||||||
command = /sbin/iptables -A INPUT -s %IP% -p tcp --dport 22 -j ACCEPT
|
|
||||||
tcpflags = syn
|
|
||||||
|
|
||||||
[closeSSH]
|
|
||||||
sequence = 9000,8000,7000
|
|
||||||
seq_timeout = 5
|
|
||||||
command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 22 -j ACCEPT
|
|
||||||
tcpflags = syn
|
|
||||||
|
|
||||||
|
[SSH]
|
||||||
|
sequence = 7000,8000,9000
|
||||||
|
seq_timeout = 5
|
||||||
|
start_command = ufw allow from %IP% to any port 22
|
||||||
|
tcpflags = syn
|
||||||
|
cmd_timeout = 10
|
||||||
|
stop_command = ufw delete allow from %IP% to any port 22
|
||||||
|
@ -89,21 +89,21 @@ echo '\033[35m
|
|||||||
/ ,< / / / / /_/ / /__/ ,< / /_/ /
|
/ ,< / / / / /_/ / /__/ ,< / /_/ /
|
||||||
/_/|_/_/ /_/\____/\___/_/|_|\__,_/
|
/_/|_/_/ /_/\____/\___/_/|_|\__,_/
|
||||||
\033[0m'
|
\033[0m'
|
||||||
echo "\033[35;1mInstalling knockd \033[0m"
|
echo "\033[35;1mInstalling knockd to control ssh port opening\033[0m"
|
||||||
sleep 3
|
sleep 3
|
||||||
apt-get --yes --force-yes install knockd
|
apt-get --yes --force-yes install knockd
|
||||||
echo -n "define a sequence number for opening (as 7000,8000,9000) : "
|
|
||||||
read sq1
|
mv /etc/knockd/knockd.conf /etc/knockd/knockd.conf.ori
|
||||||
echo -n "define a sequence number for closing (as 9000,8000,7000) : "
|
cp "$_cwd"/assets/knockd.conf /etc/knockd/knockd.conf
|
||||||
read sq2
|
echo -n "define a sequence number for opening ssh (as 7000,8000,9000) : "
|
||||||
sed -i "s/7000,8000,9000/$sq1/g" /etc/knockd.conf
|
read sq
|
||||||
sed -i "s/9000,8000,7000/$sq2/g" /etc/knockd.conf
|
sed -i "s/7000,8000,9000/$sq/g" /etc/knockd.conf
|
||||||
sed -i 's/START_KNOCKD=0/START_KNOCKD=1/g' /etc/default/knockd
|
sed -i 's/START_KNOCKD=0/START_KNOCKD=1/g' /etc/default/knockd
|
||||||
systemctl enable knockd
|
/etc/init.d/knockd start
|
||||||
systemctl start knockd
|
|
||||||
echo "\033[92;1mknockd installed and configured\033[Om"
|
echo "\033[92;1mknockd installed and configured\033[Om"
|
||||||
echo "\033[92;1mplease note these sequences for future knocking\033[Om"
|
echo "\033[92;1mplease note this sequence for future ssh knocking\033[Om"
|
||||||
echo "opening : $sq1 ; closing : $sq2"
|
echo "$sq1"
|
||||||
|
sleep 3
|
||||||
|
|
||||||
echo '\033[35m
|
echo '\033[35m
|
||||||
__ _______ __________
|
__ _______ __________
|
||||||
|
Loading…
x
Reference in New Issue
Block a user