Tags

android (7) anonymity (9) ant (10) apache (60) apple (9) atv (18) australia (8) bernardet (7) bombardier (7) book (7) browser (11) business (8) caliber30 (61) canon (9) captcha (8) cedricwalter (7) checklist (9) chrome (6) collection (8) comcontent (7) continuousbuild (28) design (13) designpattern (23) desktop (8) development (31) DIY (9) draganflyer5 (9) dslr (14) eclipse (30) ek4 (8) electronic (18) enfrancais (66) event (8) figures (14) firefox (20) firmware (8) flash (9) flickr (6) framework (12) fud (9) game (19) gaming (6) google (70) gpl (8) gps (9) hacking (25) hdtv (7) hollidays (15) homecinema (14) homepage (20) howto (75) innoveo (7) iphone (7) italy (10) itsatrap (8) java (80) javascript (11) joke (12) joomla (223) joomla15 (39) joomlacloud (7) junit (9) kde (11) kyosho (62) links (17) linux (127) LittleBigPlanet (16) mambo (18) manual (8) manurhin (9) maven (42) mediacenter (10) microsoft (53) modding (10) module (21) morespeed (16) motor (8) motorcycle (13) myhomepage (14) mysql (14) nas (14) neogeo (20) opencomment (27) opensource (63) opensuse (10) oss (8) p2p (7) panasonic (6) patch (32) pc (12) pdf (8) php (28) picasa (7) plugin (67) privacy (9) projector (11) protection (7) ps3 (43) publicity (9) quad (18) raptor30 (7) rchelicopter (161) release (7) review (32) robot (9) robotic (7) rss (8) safety (8) scooter (29) security (62) securityimage (8) securityimage3 (6) securityimage4 (21) securityimage5 (19) securityimages (19) securityimages5 (6) server (17) simulator (8) smugmug (13) snk (16) software (31) sony (39) spammer (7) statistics (13) storage (7) subversion (7) suse (12) switzerland (7) teamcity (16) testing (9) thundertiger (20) tips (31) tomcat (7) tomtom (7) translatetofrench (8) trip (17) troubleshooting (7) tutorial (9) twitter (7) upgrade (15) vespa (10) video (17) vintage (9) watercooling (9) web2.0 (28) windows (15) xbmc (7) xbox (10) zurich (18) zürich (11)

Latest Comments

Popular Post

Implement SSH port knocking on OpenSuSE Print E-mail
User Rating: / 0
PoorBest 
Friday, 03 July 2009 21:02

port.knocking.ssh.linux

Port Knocking is a technique to secure services behind a firewall until a specific knock sequence is given. Once that sequence is given, the IP address that initiated the knock may be allowed to access the service for a short period of time. A knocking server 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 is a bit paranoid, but it add another layer of security, an attacker will have either to try all ports combinations or know the secret combination (knock) to be able to connect to your SSH daemon for example.

First, you’ll have to be sure to have a port knocking client, or you will be kick out forever of your own server!

Define the secret knocking sequence

I will take the default sequence of knockd as an example

  1. 2222:udp
  2. 3333:tcp
  3. 4444:udp
  4. .. but you can add more port and not follow any pattern like above.

Install a Knocking server on OpenSuSE

As root of course

# zypper se knockd

Change the configuration file

# vi /etc/knockd.conf 

Below is the default content

[options]
        UseSyslog

[opencloseSSH]
        sequence      = 2222:udp,3333:tcp,4444:udp
        seq_timeout   = 15
        tcpflags      = syn,ack
        start_command = /usr/sbin/iptables -I INPUT 1 -s %IP% -p tcp --dport ssh -j ACCEPT
        cmd_timeout   = 10
        stop_command  = /usr/sbin/iptables -D INPUT -s %IP% -p tcp --dport ssh -j ACCEPT

Which is quite readable:

  • A wrong knock expire after 15 seconds
  • A successful knock, open for 10 seconds the firewall. The daemon will open a hole for the knocking %IP% source on port 22 (ssh), plenty of time for you to connect!
  • start_command add an IPTABLE rule in the firewall to allow the connection while
  • stop_command  close the connection

Starting the daemon

Check first if there is not any conflicting ssh rules

# iptables -L | grep ssh

Start the server

# rcknockd start

and monitor the logs file

# tail -f /var/log/knockd.log

You can now install a knock client..

Install a knocking client under windows

I’ll use the command line client, put the following in a .bat or .sh file

knock.exe -v myserverIP 2222:udp 3333:tcp 4444:udp

then run it once. You now have 10 second to open a ssh session with either Putty

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.

You can download PuTTY here.

or Cygwin ssh.

Cygwin is a Linux-like environment for Windows. It consists of two parts:

  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
  • A collection of tools which provide Linux look and feel.

And under  the iPhone?

Luckily there is a FREE application for that!  iPhone Knock Client

 

port.knocking.iphone

Tags See All Tags Add New Tag...

Please Enter New Tags Separated By Comma's
  Or Close

linux  security  ssh 



Last Updated on Friday, 03 July 2009 19:03
 

Support

My status

Download

You can download all my Joomla! extensions and a lot more HERE

Donations

Thank You for supporting my work
Click Here to make a donation