![]() |
HowTo.SecurityByPortKnocking HistoryHide minor edits - Show changes to markup September 10, 2007, at 02:55 AM
by --
Changed lines 53-54 from:
to:
September 10, 2007, at 02:55 AM
by --
Deleted line 43:
Changed lines 52-53 from:
Configure your etc/knockd.conf as follows (change the knocking sequence to your own preference):\\ to:
September 10, 2007, at 02:54 AM
by --
Deleted line 51:
September 10, 2007, at 02:53 AM
by --
Added line 53:
September 10, 2007, at 02:52 AM
by --
Changed line 51 from:
'caveat: my ipkg was not successful in installation. I found and installed it using: '\\ to:
caveat: my ipkg was not successful in installation. I found and installed it using: \\ September 10, 2007, at 02:51 AM
by -- added ipkg installation location option for knockd
Changed lines 1-2 from:
reader beware: This howto may be aged. The knock package does not appear to available for standard ipkg install at least from a OpenSlug 3.10-beta repository. to:
reader beware: This howto may be aged. The knock package does not appear to available for standard ipkg install at least from a OpenSlug 3.10-beta repository. Test the location given in the caveat below for downloading and installation. YMMV Added lines 51-52:
'caveat: my ipkg was not successful in installation. I found and installed it using: ' September 10, 2007, at 02:39 AM
by --
Changed lines 1-2 from:
to:
reader beware: This howto may be aged. The knock package does not appear to available for standard ipkg install at least from a OpenSlug 3.10-beta repository. September 10, 2007, at 02:38 AM
by --
Changed lines 1-2 from:
reader beware: This howto may be aged. The knock package does not appear to available for standard ipkg install at least from a OpenSlug 3.10-beta repository.to:
September 10, 2007, at 02:37 AM
by -- caveat of availability of knockd ipkg install for OpenSlug 3.10beta
Added lines 1-2:
reader beware: This howto may be aged. The knock package does not appear to available for standard ipkg install at least from a OpenSlug 3.10-beta repository.July 04, 2006, at 01:32 AM
by -- Added groupid directive in config file
Changed lines 22-23 from:
AllowGroups users everyone \\ to:
# If myuserid belongs to a group place mygroupid in Allowgroups as well July 04, 2006, at 01:09 AM
by --
Changed lines 33-37 from:
'''sshd: .cn, .cn.net, .cn.com, .jp, .jp.com to:
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com July 04, 2006, at 01:08 AM
by --
Changed lines 34-37 from:
to:
July 04, 2006, at 01:07 AM
by --
Changed lines 34-37 from:
sshd: UNKNOWN ''' to:
July 04, 2006, at 12:41 AM
by --
Changed lines 14-16 from:
to:
July 04, 2006, at 12:38 AM
by -- Changed location of sshd.conf to sshd_conf (new version of ssh)
Changed lines 14-16 from:
to:
July 01, 2006, at 07:11 PM
by --
Changed lines 14-16 from:
for some reason - i am a newbie - nano won't work so I'm not sure how to undo the edits i made to the file. to:
July 01, 2006, at 07:10 PM
by --
Changed lines 14-16 from:
to:
for some reason - i am a newbie - nano won't work so I'm not sure how to undo the edits i made to the file. Deleted line 17:
( for me the file was /opt/etc/openssh/sshd_config) July 01, 2006, at 06:31 PM
by --
Added line 16:
( for me the file was /opt/etc/openssh/sshd_config) June 20, 2006, at 02:00 AM
by -- Added tcpflags=syn must have parm for unslung 6.8 (problem 1st identified by Kurt Bennater)
Added line 54:
tcpflags = syn \\ Changed lines 58-60 from:
to:
May 30, 2006, at 02:13 AM
by -- Changed knockd site location
Changed line 71 from:
to:
May 30, 2006, at 02:10 AM
by -- Fixed link to knockd author site
Changed lines 1-2 from:
This howto covers the setup and usage of Knock, a port knocking program. This program listens to all traffic on an ethernet (or PPP) interface, looking for special "knock" sequences of port-hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access. For more information go to http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki. to:
This howto covers the setup and usage of Knock, a port knocking program. This program listens to all traffic on an ethernet (or PPP) interface, looking for special "knock" sequences of port-hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access. For more information go to http://www.zeroflux.org/cgi-bin/cvstrac.cgi/knock/wiki. October 10, 2005, at 02:00 AM
by -- Near final draft
Changed lines 110-111 from:
to:
October 04, 2005, at 08:11 AM
by -- added remark on how to repair things if you locked yourself out
Changed lines 65-67 from:
to:
October 02, 2005, at 07:09 PM
by --
Changed lines 11-15 from:
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL
to:
Add yourself (replacing myuserid) to the sudo list with
Changed lines 29-35 from:
to:
Changed lines 45-46 from:
to:
Deleted lines 47-53:
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com
Changed lines 60-61 from:
Test your port knock configuration.
to:
Lets do some port knocking.
Changed lines 110-111 from:
to:
October 02, 2005, at 06:48 PM
by --
Changed lines 27-30 from:
to:
October 02, 2005, at 05:06 PM
by --
Changed lines 9-15 from:
to:
Changed line 21 from:
AllowUsers myuserid \\ to:
AllowUsers myuserid \\ Changed lines 27-32 from:
to:
October 02, 2005, at 04:00 AM
by --
Changed line 38 from:
to:
Changed lines 55-63 from:
to:
Changed line 66 from:
knock your-nslu2-ip -v 2000:udp 3000:tcp 4000:udp \\ to:
Changed line 88 from:
to:
Changed lines 96-99 from:
to:
October 02, 2005, at 03:56 AM
by --
Changed lines 103-104 from:
to:
October 02, 2005, at 03:55 AM
by --
Changed lines 102-104 from:
Tips:
to:
Tips:
October 02, 2005, at 03:48 AM
by --
Changed line 88 from:
to:
Changed lines 90-92 from:
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh to:
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh Changed lines 96-99 from:
to:
October 02, 2005, at 03:47 AM
by --
Changed line 66 from:
knock''' '''''your-nslu2-ip''''' '''-v 2000:udp 3000:tcp 4000:udp \\ to:
knock your-nslu2-ip -v 2000:udp 3000:tcp 4000:udp \\ Changed lines 70-74 from:
hitting udp your-nslu2-ip:2000 to:
hitting udp your-nslu2-ip:2000 Changed line 83 from:
(after 60 seconds....)\\ to:
(after 60 seconds....)\\ October 02, 2005, at 03:41 AM
by --
Changed line 11 from:
PermitRootLogin no \\ to:
'''PermitRootLogin no \\ Changed lines 20-22 from:
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown to:
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown ''' Changed lines 24-26 from:
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL to:
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL Changed line 28 from:
REMOVE the line: $IPT -A tcp_inbound -p TCP -s 0/0 --destination-port 22 -j ACCEPT \\ to:
REMOVE the line: $IPT -A tcp_inbound -p TCP -s 0/0 --destination-port 22 -j ACCEPT \\ Changed line 32 from:
to:
Changed lines 34-38 from:
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com
to:
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com
Changed line 41 from:
[options]\\ to:
'''[options]\\ Changed lines 49-52 from:
stop_command = iptables -D INPUT -p tcp --dport 22 -j ACCEPT to:
stop_command = iptables -D INPUT -p tcp --dport 22 -j ACCEPT''' Changed lines 55-63 from:
to:
Changed line 66 from:
knock your-nslu2-ip -v 2000:udp 3000:tcp 4000:udp \\ to:
knock''' '''''your-nslu2-ip''''' '''-v 2000:udp 3000:tcp 4000:udp \\ October 02, 2005, at 03:29 AM
by --
Changed lines 96-99 from:
to:
October 02, 2005, at 02:02 AM
by --
Changed lines 103-104 from:
to:
October 02, 2005, at 02:01 AM
by --
Changed lines 61-63 from:
to:
Changed lines 70-74 from:
hitting udp your-ip:2000 to:
hitting udp your-nslu2-ip:2000 October 02, 2005, at 01:58 AM
by --
Changed line 32 from:
to:
October 02, 2005, at 01:56 AM
by --
Changed lines 61-63 from:
to:
Changed lines 93-99 from:
to:
Changed lines 102-104 from:
Notes:
to:
Tips:
October 02, 2005, at 01:51 AM
by --
Changed lines 61-63 from:
to:
October 02, 2005, at 01:50 AM
by --
Changed lines 52-64 from:
to:
Test your port knock configuration.
Changed line 66 from:
to:
knock your-nslu2-ip -v 2000:udp 3000:tcp 4000:udp \\ Changed lines 68-90 from:
http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki). You should see hitting udp your-ip:2000 hitting tcp your-ip:3000 hitting udp your-ip:4000
listening on ixp0... your-client-ip: opencloseSSH: Stage 1 your-client-ip: opencloseSSH: Stage 2 your-client-ip: opencloseSSH: Stage 3 your-client-ip: opencloseSSH: OPEN SESAME opencloseSSH: running command: iptables -A INPUT -p tcp --dport 22 -j ACCEPT your-client-ip: opencloseSSH: command timeout opencloseSSH: running command: iptables -D INPUT -p tcp --dport 22 -j ACCEPT
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
to:
On your knock client you should see:
Changed lines 103-104 from:
to:
October 02, 2005, at 01:11 AM
by --
Added lines 5-6:
Preparation and installation of Knock.Changed lines 32-52 from:
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com
sshd: UNKNOWN
Configure your etc/knockd.conf as follows (change the knocking sequence to your own preference):
[options]
logfile = /var/log/knockd.log
[opencloseSSH]
sequence = 2000:udp,3000:tcp,4000:udp
seq_timeout = 15
start_command = iptables -A INPUT -p tcp --dport 22 -j ACCEPT
cmd_timeout = 60
stop_command = iptables -D INPUT -p tcp --dport 22 -j ACCEPT
to:
October 02, 2005, at 12:58 AM
by --
Changed lines 7-25 from:
PermitRootLogin no
# Explicitly set who can and who can not login by way of ssh
AllowGroups users everyone
AllowUsers myuserid
# Everything that isn't above
DenyGroups root bin daemon sys adm tty disk lp mem kmem wheel floppy mail news uucp man games slocate utmp smmsp mysql rpc sshd shadow ftp nogroup console xcdwrite
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown.
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL
REMOVE the line: $IPT -A tcp_inbound -p TCP -s 0/0 --destination-port 22 -j ACCEPT
from the /opt/etc/iptables.sh script. This will block ssh (port 22) to your Slug.
to:
Changed lines 49-58 from:
You can do this from a Windows machine if you want (download the windows knock client from http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki). You should see: // hitting udp your-ip:2000 to:
http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki). You should see [=hitting udp your-ip:2000 Changed lines 59-60 from:
hitting udp your-ip:4000
to:
hitting udp your-ip:4000=]
Changed line 69 from:
to:
Changed lines 71-73 from:
to:
October 01, 2005, at 10:41 PM
by --
Changed line 32 from:
to:
Configure your etc/knockd.conf as follows (change the knocking sequence to your own preference):
Added line 44:
Added line 46:
Added line 48:
Added line 50:
Changed line 53 from:
http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki). You should see: to:
http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki). You should see: // October 01, 2005, at 10:34 PM
by --
Changed line 19 from:
to:
October 01, 2005, at 10:28 PM
by --
Deleted line 16:
October 01, 2005, at 10:27 PM
by --
Changed lines 3-6 from:
The example for Knock that will be described here deals with setting up a secure way to administer your Slug with remote command line access via OpenSSH? secure shell. to:
The example for Knock that will be described here deals with setting up a secure way to administer your Slug with remote command line access via OpenSSH secure shell.
October 01, 2005, at 10:25 PM
by --
Added line 19:
Changed lines 34-43 from:
[options] logfile = /var/log/knockd.log [opencloseSSH] sequence = 2000:udp,3000:tcp,4000:udp
seq_timeout = 15
start_command = iptables -A INPUT -p tcp --dport 22 -j ACCEPT
cmd_timeout = 60
stop_command = iptables -D INPUT -p tcp --dport 22 -j ACCEPT
to:
[options]
logfile = /var/log/knockd.log
[opencloseSSH]
sequence = 2000:udp,3000:tcp,4000:udp
seq_timeout = 15
start_command = iptables -A INPUT -p tcp --dport 22 -j ACCEPT
cmd_timeout = 60
stop_command = iptables -D INPUT -p tcp --dport 22 -j ACCEPT
Changed line 46 from:
to:
Changed lines 48-50 from:
You can do this from a Windows machine if you want. Download the windows know client from http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki. You should see: to:
You can do this from a Windows machine if you want (download the windows knock client from http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki). You should see: Changed lines 65-67 from:
to:
Changed lines 71-72 from:
to:
October 01, 2005, at 10:04 PM
by --
Changed lines 3-6 from:
The example for Knock that will be described here deals with setting up a secure way to administer your Slug with remote command line access via ssh. to:
October 01, 2005, at 10:02 PM
by --
Changed lines 3-4 from:
The example for Knock that will be described here deals with setting up a secure way to administer your Slug with remote command line access via OpenSSH? secure shell (port 22). to:
The example for Knock that will be described here deals with setting up a secure way to administer your Slug with remote command line access via ssh. October 01, 2005, at 09:59 PM
by --
Changed lines 3-4 from:
The example for Knock that will be described here deals with "locking down" remote command line access via OpenSSH? secure shell (port 22). This is a good method to stop SSH brute search dictionary attacks, see http://www.linuxsecurity.com/content/view/119238/151/. to:
The example for Knock that will be described here deals with setting up a secure way to administer your Slug with remote command line access via OpenSSH? secure shell (port 22). Changed lines 69-77 from:
Notes: I carry a USB stick with the knock client and Putty installed. This gives me the ability to "knock" and remote ssh administer my nslu slug from whatever place I'm at. to:
Notes:
October 01, 2005, at 09:55 PM
by --
Changed lines 46-52 from:
to:
You can do this from a Windows machine if you want. Download the windows know client from http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki. You should see: hitting udp your-ip:2000 hitting tcp your-ip:3000 hitting udp your-ip:4000
listening on ixp0... your-client-ip: opencloseSSH: Stage 1 your-client-ip: opencloseSSH: Stage 2 your-client-ip: opencloseSSH: Stage 3 your-client-ip: opencloseSSH: OPEN SESAME opencloseSSH: running command: iptables -A INPUT -p tcp --dport 22 -j ACCEPT your-client-ip: opencloseSSH: command timeout opencloseSSH: running command: iptables -D INPUT -p tcp --dport 22 -j ACCEPT
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
Notes: I carry a USB stick with the knock client and Putty installed. This gives me the ability to "knock" and remote ssh administer my nslu slug from whatever place I'm at. October 01, 2005, at 09:22 PM
by --
Changed lines 18-19 from:
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown
to:
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown.
Changed lines 31-35 from:
to:
[options] logfile = /var/log/knockd.log [opencloseSSH] sequence = 2000:udp,3000:tcp,4000:udp
seq_timeout = 15
start_command = iptables -A INPUT -p tcp --dport 22 -j ACCEPT
cmd_timeout = 60
stop_command = iptables -D INPUT -p tcp --dport 22 -j ACCEPT
October 01, 2005, at 09:03 PM
by --
Changed lines 7-8 from:
to:
Changed lines 18-19 from:
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown
to:
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown
Changed lines 21-22 from:
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL
to:
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL
Changed lines 32-34 from:
to:
October 01, 2005, at 08:48 PM
by --
Added line 8:
Added line 10:
Added line 14:
Added line 17:
Added lines 19-34:
Add yourself to the sudo list with visudo: myuserid ALL=(ALL) ALL
REMOVE the line: $IPT -A tcp_inbound -p TCP -s 0/0 --destination-port 22 -j ACCEPT
from the /opt/etc/iptables.sh script. This will block ssh (port 22) to your Slug.
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com
sshd: UNKNOWN
October 01, 2005, at 08:14 PM
by --
Changed lines 13-14 from:
DenyGroups root bin daemon sys adm tty disk lp mem kmem wheel floppy mail news uucp man games slocate utmp smmsp mysql rpc sshd shadow ftp nogroup console xcdwrite
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown
to:
DenyGroups root bin daemon sys adm tty disk lp mem kmem wheel floppy mail news uucp man games slocate utmp smmsp mysql rpc sshd shadow ftp nogroup console xcdwrite
DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown
October 01, 2005, at 08:13 PM
by --
Changed lines 7-20 from:
Change this entry:
-> PermitRootLogin? no
Add these sections with your userid rather then "myuserid":
# Explicitly set who can and who can not login by way of ssh AllowGroups users everyone AllowUsers myuserid [=# Everything that isn't above DenyGroups? root bin daemon sys adm tty disk lp mem kmem wheel floppy mail news uucp man games slocate utmp smmsp mysql rpc sshd shadow ftp nogroup console xcdwrite to:
PermitRootLogin no
# Explicitly set who can and who can not login by way of ssh
AllowGroups users everyone
AllowUsers myuserid
# Everything that isn't above
[=DenyGroups? root bin daemon sys adm tty disk lp mem kmem wheel floppy mail news uucp man games slocate utmp smmsp mysql rpc sshd shadow ftp nogroup console xcdwrite
October 01, 2005, at 08:03 PM
by --
Changed lines 5-6 from:
to:
Change this entry:
-> PermitRootLogin? no
Add these sections with your userid rather then "myuserid":
# Explicitly set who can and who can not login by way of ssh AllowGroups users everyone AllowUsers myuserid # Everything that isn't above DenyGroups root bin daemon sys adm tty disk lp mem kmem wheel floppy mail news uucp man games slocate utmp smmsp mysql rpc sshd shadow ftp nogroup console xcdwrite DenyUsers root bin daemon adm lp sync shutdown halt mail news uucp operator games ftp smmsp mysql rpc sshd nobody test guest user admin apache www wwwrun httpd irc unknown October 01, 2005, at 06:56 PM
by --
Changed lines 3-4 from:
The example that will be described here deals with "locking down" remote command line access via OpenSSH? secure shell (port 22). This is a good method to stop SSH brute search dictionary attacks. to:
The example for Knock that will be described here deals with "locking down" remote command line access via OpenSSH? secure shell (port 22). This is a good method to stop SSH brute search dictionary attacks, see http://www.linuxsecurity.com/content/view/119238/151/. 1. Follow the howto for OPENSSH?, http://www.nslu2-linux.org/wiki/HowTo/UseOpenSSHForRemoteAccess. October 01, 2005, at 06:20 PM
by -- 1st page
Added lines 1-4:
This howto covers the setup and usage of Knock, a port knocking program. This program listens to all traffic on an ethernet (or PPP) interface, looking for special "knock" sequences of port-hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access. For more information go to http://www.zeroflux.org/cgi-bin/cvstrac/knock/wiki. The example that will be described here deals with "locking down" remote command line access via OpenSSH? secure shell (port 22). This is a good method to stop SSH brute search dictionary attacks.
view ·
edit ·
print ·
history ·
Last edited by frustrated.
Based on work by frustrated, dlubinsk, metamind, don lubinski, and eFfeM. Originally by don lubinski. Page last modified on September 10, 2007, at 02:55 AM
|