root/fwknop/tags/fwknop-0.9.7-pre2/fwknopd.8

Revision 489, 12.4 kB (checked in by mbr, 2 years ago)

Added link to GPG HOWTO

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 .\" Process this file with
2 .\" groff -man -Tascii foo.1
3 .\"
4 .TH FWKNOPD 8 "Jan, 2006" Linux
5 .SH NAME
6 .B fwknopd
7 \- Firewall Knock Operator (server component)
8 .SH SYNOPSIS
9 .B fwknopd [-c
10 .I config-file
11 .B ] [-i
12 .I interface
13 .B ] [--fw-list] [--fw-flush] [-d] [-S] [-K] [-R] [-o] [--fw-log
14 .I logfile
15 .B ] [-v] [-V] [-h]
16
17 .SH DESCRIPTION
18 .B fwknopd
19 is the server component for the FireWall Knock Operator, and is responsible
20 for monitoring Single Packet Authorization (SPA) packets that are generated by
21 .B fwknop
22 clients, modifying a Netfilter policy to allow the desired access after decrypting
23 a valid SPA packet, and removing access after a configurable timeout.  The main
24 application of this program is to protect services such as SSH with an additional
25 layer of security in order to make the exploitation of vulnerabilities (both 0-day
26 and unpatched code) much more difficult.
27 .PP
28 The main configuration for
29 .B fwknopd
30 is maintained within two files:
31 .B fwknop.conf
32 and
33 .B access.conf
34 within the
35 .B /etc/fwknop
36 directory, and configuration variables within these files are desribed below.
37 .SH OPTIONS
38 .TP
39 .BR \-c "\fR,\fP " \-\^\-config\ \<config-file>
40 When run in server mode
41 .B fwknop
42 references the file
43 .B /etc/fwknop/fwknop.conf
44 for various run-time configuration
45 variables.  The path to this file can be changed through the use of the
46 .B --config
47 command line option.
48 .TP
49 .BR \-i "\fR,\fP " \-\^\-intf\ \<interface>
50 Manually specify interface on which to sniff, e.g. "-i eth0".  This option
51 is not usually needed because the PCAP_INTF keyword in /etc/fwknop/fwknop.conf
52 file defines the sniffing interface.
53 .TP
54 .BR \-\^\-fw-list
55 List all active rules in the FWKNOP Netfilter chain(s).
56 .TP
57 .BR \-\^\-fw-flush
58 Flush all active rules in the FWKNOP Netfilter chain(s).
59 .TP
60 .BR \-o "\fR,\fP " \-\^\-os
61 Parse Netfilter logs and fingerprint operating systems from which tcp SYN
62 packets have been logged.
63 .TP
64 .BR \-\^\-fw-log\ \<file>
65 Specify the path to the Netfilter log file that is parsed when running in
66 --os mode.
67 .TP
68 .BR \-K "\fR,\fP " \-\^\-Kill
69 Kill the current fwknop process along with knopwatchd and knopmd.  This
70 provides a quick and easy way to stop all fwknop processes without having
71 to look in the process table or appeal to the fwknop init script.
72 .TP
73 .BR \-R "\fR,\fP " \-\^\-Restart
74 Restart the currently running fwknop processes.  This option will preserve
75 the command line options that were supplied to the original fwknop process.
76 .TP
77 .BR \-\^\-Status
78 Display the status of any fwknop processes that may or not be running.
79 .TP
80 .BR \-v "\fR,\fP " \-\^\-verbose
81 Run fwknop in verbose mode.
82 .TP
83 .BR \-h "\fR,\fP " \-\^\-help
84 Display usage information and exit.
85 .TP
86 .BR \-V "\fR,\fP " \-\^\-Version
87 Display version information and exit.
88 .SH FILES
89 .B /etc/fwknop/fwknop.conf
90 .RS
91 The main configuration file for
92 .B fwknop.
93 .RE
94
95 .B /etc/fwknop/access.conf
96 .RS
97 Defines all knock sequences and access control directives.
98 .RE
99
100 .B /etc/fwknop/pf.os
101 .RS
102 Defines p0f signatures used by fwknop.
103 .RE
104 .SH FWKNOP CONFIG AND ACCESS VARIABLES
105 .B fwknop
106 references the file
107 .B /etc/fwknop/fwknop.conf
108 for configuration variables such as the path to the firewall logfile,
109 the sleep interval fwknop uses to check for new log messages, and
110 paths to system binaries, etc.  The
111 .B fwknop
112 config file does not define any access control directives; they are
113 located in the file
114 .B /etc/fwknop/access.conf.
115 Access control directives define encryption keys and level of access that
116 is granted to an fwknop client that has generated the appropriate encrypted
117 message.  This file is referenced for this information when run in either
118 the single packet authorization mode, or the legacy port knocking mode.
119 .TP
120 .B SOURCE: <IP,..,IP/NET,..,NET/ANY>
121 This defines the source address from which an authorization packet (or
122 legacy knock sequence) will be accepted.  The string "ANY" is also
123 accepted if a valid authorization packet should be honored from any source
124 IP.  Every authorization stanza in
125 .B /etc/fwknop/access.conf
126 definition must start with the SOURCE keyword.  Networks can be
127 specified in either CIDR (e.g. "192.168.10.0/24") or regular (e.g.
128 "192.168.10.0/255.255.255.0") notation, and individual IP addresses
129 can be specified as well.  Also, multiple IP's and/or networks can
130 be defined as a comma separated list (e.g. "192.168.10.0/24, 10.1.1.123")
131 .TP
132 .B DATA_COLLECT_MODE: PCAP|FILE_PCAP|ULOG_PCAP|ENCRYPT_SEQUENCE
133 If DATA_COLLECT_MODE is set to "PCAP",
134 .B fwknop
135 sniffs the wire directly via libpcap to capture authorization packets.
136 If set to "FILE_PCAP", fwknop reads a pcap-formatted file (defined by
137 the PCAP_PKT_FILE keyword in the fwknop.conf file) that is written
138 to by a separate sniffer process.  If set to "ULOG_PCAP", fwknop collects
139 packets via the Netfilter ulogd pcap writer.  This requires that packets
140 are logged via the ULOG target in the Netfilter policy.  If set to
141 ENCRYPT_SEQUENCE, fwknop falls back to the legacy port knocking method
142 of network authorization.
143 .TP
144 .B ENABLE_CMD_EXEC
145 This instructs
146 .B fwknop
147 to accept complete commands that are contained within an authorization
148 packet.  Any such command will be executed as root by the
149 .B fwknop server.
150 .TP
151 .B CMD_REGEX: <regex>
152 If ENABLE_CMD_EXEC is specified, the CMD_REGEX keyword instructs
153 .B fwknop
154 to restrict command execution to only those command that match the
155 given regular expression.
156 .TP
157 .B KEY: <8-16 chars>
158 Define the encryption key for an ENCRYPT_SEQUENCE block.  This variable
159 is required for all encrypted sequences (each encrypted sequence may
160 have its own unique key), and must be provided at execution to an
161 .B fwknop
162 client attempting to gain access.  When run in client mode, fwknop will
163 prompt the user for the encryption key, or a path to the key may be
164 provided on the command line with
165 .B --get-key <file>.
166 .TP
167 .B OPEN_PORTS: <proto/port>, ..., <proto/port>
168 Define a set of ports and protocols (tcp or udp) that will be opened
169 if a valid knock sequence is seen.  This variable is required for
170 shared knock sequences since the port information is not sent within
171 the sequence, and optional for encrypted knock sequences which can
172 include the port and protocol within the sequence.
173 .TP
174 .B GPG_DECRYPT_ID: <keyID>
175 Define a GnuPG key ID to use for decrypting SPA messages that have been
176 encrypted by an
177 .B fwknop
178 client.  This keyword is required for authentication that is based on
179 .B gpg
180 keys.
181 The gpg key ring on the client must have imported and signed the
182 .B fwknopd
183 server key, and vice versa.  It is ok to use a sensitive personal gpg key
184 on the client, but each fwknopd server should have its own gpg key that is
185 generated specifically for fwknop communications.  The reason for this is
186 that the decryption password for the server key must be placed within the
187 .B /etc/fwknop/access.conf
188 file for fwknopd to function (it has to be able to decrypt SPA messages that
189 have been encrypted with the server's public key).  For more information on
190 using fwknop with GnuPG keys, see the following link:
191 .B http://www.cipherdyne.org/fwknop/docs/gpghowto.html
192 .TP
193 .B GPG DECRYPT_PW: <decrypt password>
194 Specify the decryption password for the
195 .B gpg
196 key defined by the
197 .B GPG_DECRYPT_ID
198 above.  This is a required field for gpg-based authentication.
199 .TP
200 .B GPG_REMOTE_ID: <keyID,...,keyID>
201 Define a list of
202 .B gpg
203 key ID's that are required to have signed any incoming SPA message that
204 has been encrypted with the
205 .B fwknopd
206 server key.  This ensures that the verification of the remote user is accomplished
207 via a strong cryptographic mechanism.
208 .TP
209 .B GPG_HOME_DIR: <path>
210 Define the path to the GnuPG directory to be used by the
211 .B fwknopd
212 server.  If this keyword is not specified within
213 .B /etc/fwknop/access.conf
214 then fwknopd will default to using the /root/.gnupg directory for the server key(s).
215 .TP
216 .B FW_ACCESS_TIMEOUT: <seconds>
217 Define the length of time access will be granted by fwknop through
218 the firewall after a valid knock sequence from a source IP address.
219 If FW_ACCESS_TIMEOUT is not set then the default timeout of 300
220 seconds (5 minutes) will automatically be set.
221 .TP
222 .B REQUIRE_OS: <operating system>
223 Require a specific operating system fingerprint match (e.g.
224 "Linux:2.4::Linux 2.4/2.6" or "OpenBSD:3.0-3.5::OpenBSD 3.0-3.5"
225 before a knock sequence will be accepted.  The fingerprints are listed
226 in
227 .B /etc/fwknop/pf.os.
228 Note that the corresponding knock sequence must utilize the tcp protocol
229 (this is only be an issue for shared sequences since encrypted sequences
230 use tcp by default) since OS fingerprinting requires tcp syn packets.
231 This variable is optional.
232 .TP
233 .B REQUIRE_OS_REGEX: <regex>
234 Require an operating system fingerprint that matches <regex>, e.g.
235 "linux" or "*bsd".  Note that the regex will be matched case in-
236 sensitively.  This variable is optional.
237 .TP
238 .B REQUIRE_USERNAME: <username>
239 Require a specific username from the client system.  This username is
240 sent across the network in an encrypted knock sequence to the fwknop
241 server.  If there are multiple users on the client system, only a knock
242 sequence that is initiated by the required username will be honored.
243 This variable is optional and is only valid with an encrypted sequence
244 definition.
245 .TP
246 .B ENCRYPT_SEQUENCE
247 Expect that all port knock sequences originating from the SOURCE will
248 be encrypted.  Fwknop will try to decrypt all such sequences.
249 ENCRYPT_SEQUENCE does not accept any arguments.  Either this variable
250 or the "SHARED_SEQUENCE" variable is required for each SOURCE block.
251 .TP
252 .B SHARED_SEQUENCE: <proto/port>, ..., <proto/port>
253 Define the sequence of ports (together with their associated
254 protocol; tcp or udp) that will be sent to the destination knock
255 server.  This sequence is not encrypted, and source IP will be
256 allowed to connect through the destination firewall ruleset to a set
257 of tcp or udp ports (defined by the OPEN_PORTS variable).  Using
258 an encrypted sequence is much more secure.  Either this variable or
259 the "ENCRYPT_SEQUENCE" variable above is required for each SOURCE
260 block.
261 .TP
262 .B KNOCK_INTERVAL: <seconds>
263 Define the interval of time in which a port knock sequence will be
264 honored.  I.e. the number of seconds after the first connection
265 attempt the last connection attempt in the sequence must be received
266 for the knock sequence to be accepted by the destination fwknop
267 daemon.  If a KNOCK_INTERVAL is not specified then the default
268 interval of 60 seconds will automatically be set.
269 .TP
270 .B KNOCK_LIMIT: <number>
271 Define the maximum number of times a knock sequence will be honored.
272 Note that repetitive access to the fwknop server will eventually be
273 restricted if this option is used.
274 .TP
275 .B PORT_OFFSET: <offset>
276 Encrypted knock sequences take place over a range of 256 ports
277 starting at a default port of 61000.  This value can be changed
278 through the use of the PORT_OFFSET variable.  The PORT_OFFSET
279 is optional and will be set to 61000 by fwknop if it is not specified
280 in /etc/fwknop/access.conf.
281 .TP
282 .B MIN_TIME_DIFF: <seconds>
283 Set the minimum number of seconds that must pass between successive
284 connection attempts in a shared knock sequence.  This variable is
285 optional.
286 .TP
287 .B MAX_TIME_DIFF: <seconds>
288 Set the maximum number of seconds that must pass between successive
289 connection attempts in a shared knock sequence.  This variable is
290 optional.
291 .SH DEPENDENCIES
292 .B fwknopd
293 requires perl.  To take advantage of all of the features in fwknop when run
294 in server mode a functioning Netfilter firewall is required on the underlying
295 operating system.  If fwknop is being run in the legacy port knocking mode,
296 then Netfilter must log packets via syslog, and ideally the --log-tcp-options
297 argument will be specified in the iptables logging rule so that fwknop will
298 be able to use a strategy similar to
299 .B p0f
300 to passively fingerprint operating systems.
301 .SH DIAGNOSTICS
302 .B fwknop
303 can be run in debug mode with the --debug command line option.  This will
304 disable daemon mode execution, and print verbose information to the screen
305 on STDERR as packets are received.
306 .SH "SEE ALSO"
307 .BR fwknop (8),
308 .BR iptables (8),
309 .BR p0f (1),
310 .BR knopmd (8),
311 .BR knopwatchd (8)
312 .SH AUTHOR
313 Michael Rash <mbr@cipherdyne.org>
314 .SH CREDITS
315 The phrase "Single Packet Authorization" was coined by MadHat, see:
316 .B http://www.nmrc.org/
317 The term "port knocking" was coined by Martin Krzywinski, see:
318 .B http://www.portknocking.org/
319  The original p0f passive OS fingerprinter was written by Michal Zalewski, and is
320 available here:
321 .B http://lcamtuf.coredump.cx/p0f.shtml
322 .SH BUGS
323 Send bug reports to mbr@cipherdyne.org.  Suggestions and/or comments are
324 always welcome as well.
325 .SH DISTRIBUTION
326 .B fwknop
327 is distributed under the GNU General Public License (GPL), and the latest
328 version may be downloaded from
329 .B http://www.cipherdyne.org/
Note: See TracBrowser for help on using the browser.