Created
November 26, 2013 08:35
-
-
Save moregeek/7655139 to your computer and use it in GitHub Desktop.
Portknocking with ferm example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domain (ip) { | |
table filter { | |
# | |
# Subchains: Portknocking | |
# ################################################################################ | |
chain PORT_KNOCKING_1 { | |
protocol tcp { | |
mod recent name "port_knock_seq_01" set NOP; | |
} | |
DROP; | |
} | |
chain PORT_KNOCKING_2 { | |
protocol tcp { | |
mod recent name "port_knock_seq_01" remove NOP; | |
mod recent name "port_knock_seq_02" set NOP; | |
} | |
DROP; | |
} | |
chain PORT_KNOCKING_3 { | |
protocol tcp { | |
mod recent name "port_knock_seq_02" remove NOP; | |
mod recent name "port_knock_seq_03" set NOP; | |
} | |
DROP; | |
} | |
################################################################################ | |
chain INPUT { | |
policy DROP; | |
proto tcp { | |
# | |
# Port knocking stuff | |
################################################################################ | |
dport 10000 { mod recent set name "port_knock_seq_01" jump PORT_KNOCKING_1; } | |
dport 20000 { mod recent rcheck name "port_knock_seq_01" seconds 10 jump PORT_KNOCKING_2; } | |
dport 30000 { mod recent rcheck name "port_knock_seq_02" seconds 10 jump PORT_KNOCKING_3; } | |
################################################################################ | |
# allow SSH connections | |
dport ssh { | |
mod recent rcheck name "port_knock_seq_03" seconds 120 ACCEPT; # open for ip with right port knocking sequence | |
DROP; | |
} | |
DROP; | |
} | |
} | |
chain OUTPUT { | |
... | |
} | |
chain FORWARD { | |
... | |
} | |
} | |
} # domain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment