sshdfilter config

I’m beginning to think I need to set up a Wiki for this stuff.. but later.

Trying to get the sshdfilter stuff up and running on my new Debian box, and of course I didn’t document the process when I did it on 3 previous machines awhile back, so here goes.

  1. Install sshdfilter script in /usr/local/sbin
  2. Edit /etc/init.d/ssh. Look for two lines that look something like

    start-stop-daemon --start [...] /usr/sbin/sshd -- $SSHD_OPTS

    Replace them with

    start-stop-daemon --start --quiet --exec /usr/local/sbin/sshdfilter -- $SSHD_OPTS &

    Don’t forget the trailing ampersand!

  3. Create an executable file /usr/local/etc/iptables.sh:


    #!/bin/sh
    modprobe ip_tables
    iptables -N SSHD
    iptables -A INPUT -p tcp -m tcp --dport 22 -j SSHD
    exit 0

  4. Modify /etc/network/interfaces. Under interface eth0, add the following line:

    pre-up /usr/local/etc/iptables.sh

And that should do it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s