2 ##############################################################################
4 # [+] fwknopd - Firewall Knock Operator Daemon [+]
6 # This is the configuration file for fwknopd, the Firewall Knock Operator
7 # daemon. The primary authentication and authorization mechanism offered
8 # by fwknop is known as Single Packet Authorization (SPA). More information
9 # about SPA can be found at: http://www.cipherdyne.org/fwknop/docs/SPA.html
11 # There are no access control directives in this file. All access
12 # control directives are located in the file "/etc/fwknop/access.conf".
13 # You will need to edit the access.conf file in order for fwknop to function
16 # Most of these can remain commented out unless you need to overide the
19 # It is also important to note that there are some subtle (and some not
20 # so subtle) differences between this configuration file, its parameters
21 # and valid values and the configuration file used by the legacy Perl
22 # version of fwknopd. Please pay careful attention to the format and
23 # values used in this file if you are migrating from the legacy Perl
26 ##############################################################################
29 # Define the ethernet interface on which we will sniff packets.
30 # Default if not set is eth0.
34 # By default fwknopd does not put the pcap interface into promiscuous mode.
35 # Set this to 'Y' to enable promiscuous sniffing.
37 #ENABLE_PCAP_PROMISC N;
39 # Define the filter used for PCAP modes; we default to udp port 62201.
40 # However, if an fwknop client uses the --rand-port option to send the
41 # SPA packet over a random port, then this variable should be updated to
42 # something like "udp dst portrange 10000-65535;".
43 # Default is "udp port 62201".
45 #PCAP_FILTER udp port 62201;
47 # This instructs fwknopd to not honor SPA packets that have an old time
48 # stamp. The value for "old" is defined by the MAX_SPA_PACKET_AGE variable.
49 # If ENABLE_SPA_PACKET_AGING is set to "N", fwknopd will not use the client
52 #ENABLE_SPA_PACKET_AGING Y;
54 # Defines the maximum age (in seconds) that an SPA packet will be accepted.
55 # This requires that the client system is in relatively close time
56 # synchronization with the fwknopd server system (NTP is good). The default
59 #MAX_SPA_PACKET_AGE 120;
61 # Track digest sums associated with previous fwknop process. This allows
62 # digest sums to remain persistent across executions of fwknop.
64 #ENABLE_DIGEST_PERSISTENCE Y;
66 # Sets the number of packets that are processed when the *pcap_dispatch()*
67 # call is made. The default is zero, since this allows *fwknopd* to process
68 # as many packets as possible in the corresponding callback where the SPA
69 # handling routine is called for packets that pass a set of prerequisite
70 # checks. However, if *fwknopd* is running on a platform with an old
71 # version of libpcap, it may be necessary to change this value to a positive
72 # non-zero integer. More information can be found in the *pcap_dispatch(3)*
74 #PCAP_DISPATCH_COUNT 0;
76 # Sets the number of microseconds to passed as an argument to usleep() in
77 # the pcap loop. The default is 10000, or 1/10th of a second.
78 #PCAP_LOOP_SLEEP 10000;
80 # Allow SPA clients to request access to services through an iptables
81 # firewall instead of just to it (i.e. access through the FWKNOP_FORWARD
82 # chain instead of the INPUT chain).
84 #ENABLE_IPT_FORWARDING N;
86 # Allow SPA clients to request access to a local socket via NAT. This still
87 # puts an ACCEPT rule into the FWKNOP_INPUT chain, but a different port is
88 # translated via DNAT rules to the real one. So, the user would do
89 # "ssh -p <port>" to access the local service (see the --NAT-local and
90 # --NAT-rand-port on the fwknop client command line).
92 #ENABLE_IPT_LOCAL_NAT Y;
94 # By default, if forwarding access is enabled (see the ENABLE_IPT_FORWARDING
95 # variable above), then fwknop creates DNAT rules for incoming connections,
96 # but does not also complement these rules with SNAT rules at the same time.
97 # In some situations, internal systems may not have a route back out for the
98 # source address of the incoming connection, so it is necessary to also
99 # apply SNAT rules so that the internal systems see the IP of the internal
100 # interface where fwknopd is running. This functionality is only enabled
101 # when ENABLE_IPT_SNAT is set to "Y", and by default SNAT rules are built
102 # with the MASQUERADE target (since then the internal IP does not have to be
103 # defined here in the fwknop.conf file), but if you want fwknopd to use the
104 # SNAT target then also defined an IP address with the SNAT_TRANSLATE_IP
108 #SNAT_TRANSLATE_IP __CHANGEME__;
110 # Add ACCEPT rules to the FWKNOP_OUTPUT chain. This is usually only useful
111 # if there are no state tracking rules to allow connection responses out and
112 # the OUTPUT chain has a default-drop stance.
114 #ENABLE_IPT_OUTPUT N;
116 # Specify the the maximum number of bytes to sniff per frame - 1500
119 #MAX_SNIFF_BYTES 1500;
121 # Flush all existing rules in the fwknop chains at fwknop start time and/or
122 # exit time. They default to Y and it is recommended setting for both.
124 #FLUSH_IPT_AT_INIT Y;
125 #FLUSH_IPT_AT_EXIT Y;
127 # If GPG keys are used instead of a Rijndael symmetric key, this is
128 # the default GPG keys directory. Note that each access block in
129 # fwknop access.conf can specify its own GPG directory to override
132 #GPG_HOME_DIR /root/.gnupg;
134 # Allow fwknopd to acquire SPA data from HTTP requests (generated with the
135 # fwknop client in --HTTP mode). Note that the PCAP_FILTER variable would
136 # need to be updated when this is enabled to sniff traffic over TCP/80
139 #ENABLE_SPA_OVER_HTTP N;
141 # Enable the fwknopd TCP server. This is a "dummy" TCP server that will
142 # accept TCP connection requests on the specified TCPSERV_PORT.
143 # If set to "Y", fwknopd will fork off a child process to listen for, and
144 # accept incoming TCP request. This server only accepts the
145 # request. It does not otherwise communicate. This is only to allow the
146 # incoming SPA over TCP packet which is detected via PCAP. The connection
147 # is closed after 1 second regardless.
148 # Note that fwknopd still only gets its data via pcap, so the filter
149 # defined by PCAP_FILTER needs to be updated to include this TCP port.
151 #ENABLE_TCP_SERVER N;
154 # Set/override the locale (via the LC_ALL locale category). Leave this
155 # entry commented out to have fwknopd honor the default system locale.
159 # Override syslog identity and facility (the defaults are usually ok).
160 # The SYSLOG_FACILITY variable can be set to one of LOG_LOCAL{0-7}
161 # or LOG_DAEMON (the default).
163 #SYSLOG_IDENTITY fwknopd;
164 #SYSLOG_FACILITY LOG_DAEMON;
166 ##############################################################################
167 # NOTE: The following EXTERNAL_CMD functionality is not yet implemented.
168 # This is a possible future feature of fwknopd.
170 # The following four variables control whether a global set of "open" and
171 # "close" commands are executed after receving a valid SPA packet. These
172 # variables are used only if FIREWALL_TYPE is set to "external_cmd", but
173 # the same variables can also exist within the access.conf file so that
174 # mixed deployments are possible - that is, some SPA packets will operate
175 # as usual and result in firewall commands being executed, but others will
176 # result in the commands defined by these variables (in access.conf) being
178 # The "open" and "close" commands might be manually supplied firewall
179 # commands, and both support variable substitution of any of the variables
180 # in the access.conf file with "$VAR". Also, three special variables are
181 # supported: $SRC, $PORT, and $PROTO, which are derived from actual values
182 # from within valid SPA packets (as opposed to $SOURCE from access.conf
183 # which may contain a list of networks instead of a single IP address).
184 # Here are some examples:
185 # - Execute a specific iptables command on behalf of the source IP
186 # in a valid SPA packet to add a new ACCEPT rule, and execute
187 # another command (to delete the same rule after a timeout):
188 # EXTERNAL_CMD_OPEN iptables -A INPUT -s $SRC -j ACCEPT
189 # EXTERNAL_CMD_CLOSE iptables -D INPUT -s $SRC -j ACCEPT
190 # - Execute a custom binary with the SOURCE and OPEN_PORTS variables
191 # from the access.conf file as input on the command line, and after
192 # a timeout execute a different program but use the real SPA source
194 # EXTERNAL_CMD_OPEN /path/someprog $SOURCE $OPEN_PORTS
195 # EXTERNAL_CMD_OPEN /path/otherprog $SRC
197 #ENABLE_EXTERNAL_CMDS N;
198 #EXTERNAL_CMD_OPEN __NONE__;
199 #EXTERNAL_CMD_CLOSE __NONE__;
200 #EXTERNAL_CMD_ALARM 30;
202 # if EXTERNAL_CMD_OPEN is used above, then the following two variables can
203 # be used to enforce a prefix on variable substitutions - useful if there
204 # are any naming conflicts with the external script and command line
205 # arguments that are named the same as the variables to be substituted.
207 #ENABLE_EXT_CMD_PREFIX N;
208 #EXT_CMD_PREFIX FWKNOP_;
210 ##############################################################################
211 # Parameters specific to iptables:
213 # fwknopd adds allow rules to a custom iptables chain "FWKNOP_INPUT".
214 # This chain is called from the INPUT chain, and by default no other
215 # iptables chains are used. However, additional chains can be added
216 # (say, if access needs to be allowed through the local system via the
217 # FORWARD chain) by altering the IPT_FORWARD_ACCESS variable below.
218 # For a discussion of the format followed by these keywords, read on:
220 # Specify chain names to which iptables blocking rules will be
221 # added with the IPT_INPUT_ACCESS and IPT_FORWARD_ACCESS keyword.
222 # The format for these variables is:
224 # <Target>,<Direction>,<Table>,<From_chain>,<Jump_rule_position>,\
225 # <To_chain>,<Rule_position>.
228 # Can be any legitimate iptables target, but should usually just be "DROP".
231 # Can be any iptables table, but the default is "filter".
234 # Is the chain from which packets will be jumped.
236 # "Jump_rule_position":
237 # Defines the position within the From_chain where the jump rule is added.
240 # Is the chain to which packets will be jumped. This is the main chain
241 # where fwknop rules are added.
244 # Defines the position where rule are added within the To_chain.
246 #IPT_INPUT_ACCESS ACCEPT, filter, INPUT, 1, FWKNOP_INPUT, 1;
248 # The IPT_OUTPUT_ACCESS variable is only used if ENABLE_IPT_OUTPUT is enabled
250 #IPT_OUTPUT_ACCESS ACCEPT, filter, OUTPUT, 1, FWKNOP_OUTPUT, 1;
252 # The IPT_FORWARD_ACCESS variable is only used if ENABLE_IPT_FORWARDING is
255 #IPT_FORWARD_ACCESS ACCEPT, filter, FORWARD, 1, FWKNOP_FORWARD, 1;
256 #IPT_DNAT_ACCESS DNAT, nat, PREROUTING, 1, FWKNOP_PREROUTING, 1;
258 # The IPT_SNAT_ACCESS variable is not used unless both ENABLE_IPT_SNAT and
259 # ENABLE_IPT_FORWARDING are enabled. Also, the external static IP must be
260 # set with the SNAT_TRANSLATE_IP variable. The default is to use the
261 # IPT_MASQUERADE_ACCESS variable.
263 #IPT_SNAT_ACCESS SNAT, nat, POSTROUTING, 1, FWKNOP_POSTROUTING, 1;
264 #IPT_MASQUERADE_ACCESS MASQUERADE, nat, POSTROUTING, 1, FWKNOP_POSTROUTING, 1;
266 ##############################################################################
267 # Parameters specific to ipfw:
270 # This variable defines the rule number that fwknopd uses to insert an ipfw
271 # pass rule. You would most likely want to change this parameter to a
272 # number that makes sense in your current ipfw firewall configuration.
274 #IPFW_START_RULE_NUM 10000;
276 # This variable defines the maximum number of rules fwknopd will create at
277 # a time. This also tells fwknopd where to stop when flushing all rules.
279 #IPFW_MAX_RULES 1000;
281 # This variable defines the rule set fwknopd uses for active rules. By
282 # default, it is set 0, but can be set to any number between 0 and 31 in
283 # case you want to keep fwknopd generated rules segregated from the default
286 #IPFW_ACTIVE_SET_NUM 1;
288 # This variable defines the rule set that will be used to store expired rules
289 # that still have a dynamic rule associated to them. That set will be disabled
290 # by fwknop and should not be enabled while fwknop is running. Not used when
291 # ipfw isn't using dynamic rules.
293 #IPFW_EXPIRE_SET_NUM 2;
295 # Set the interval (in seconds) over which rules that are expired and
296 # have no remaining dynamic rules associated with them will be removed.
298 #IPFW_EXPIRE_PURGE_INTERVAL 30;
300 # Set this variable to "Y" if you want fwknopd to create its own "check-state"
301 # rule as the first rule in the set. This would only be needed if there
302 # was not already a check-state rule in the current firewall configuration.
304 # IPFW_ADD_CHECK_STATE N;
306 ##############################################################################
307 # Parameters specific to the pf firewall:
310 # This variable defines the pf anchor name to which fwknopd will add and
311 # delete rules. This anchor must be linked into the pf policy (typically
312 # done by adding it into the /etc/pf.conf file), and fwknopd runs a check at
313 # init time to ensure that the anchor exists.
315 #PF_ANCHOR_NAME fwknop;
317 # Set the interval (in seconds) over which rules that are expired
319 #PF_EXPIRE_INTERVAL 30;
322 # Directories - These can override compile-time defaults.
324 #FWKNOP_RUN_DIR /var/run/fwknop;
325 #FWKNOP_CONF_DIR /etc/fwknop;
329 #ACCESS_FILE access.conf;
330 #FWKNOP_PID_FILE $FWKNOP_RUN_DIR/fwknopd.pid;
331 #DIGEST_FILE $FWKNOP_RUN_DIR/digest.cache;
332 ### The DB version is only used if fwknopd was built with gdbm/ndbm
333 ### support (not needed by default).
334 #DIGEST_DB_FILE $FWKNOP_RUN_DIR/digest_db.cache;
338 #FIREWALL_EXE /sbin/iptables;