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

Revision 464, 12.3 kB (checked in by mbr, 3 years ago)

man page formatting fixes

  • 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).
190 .TP
191 .B GPG DECRYPT_PW: <decrypt password>
192 Specify the decryption password for the
193 .B gpg
194 key defined by the
195 .B GPG_DECRYPT_ID
196 above.  This is a required field for gpg-based authentication.
197 .TP
198 .B GPG_REMOTE_ID: <keyID,...,keyID>
199 Define a list of
200 .B gpg
201 key ID's that are required to have signed any incoming SPA message that
202 has been encrypted with the
203 .B fwknopd
204 server key.  This ensures that the verification of the remote user is accomplished
205 via a strong cryptographic mechanism.
206 .TP
207 .B GPG_HOME_DIR: <path>
208 Define the path to the GnuPG directory to be used by the
209 .B fwknopd
210 server.  If this keyword is not specified within
211 .B /etc/fwknop/access.conf
212 then fwknopd will default to using the /root/.gnupg directory for the server key(s).
213 .TP
214 .B FW_ACCESS_TIMEOUT: <seconds>
215 Define the length of time access will be granted by fwknop through
216 the firewall after a valid knock sequence from a source IP address.
217 If FW_ACCESS_TIMEOUT is not set then the default timeout of 300
218 seconds (5 minutes) will automatically be set.
219 .TP
220 .B REQUIRE_OS: <operating system>
221 Require a specific operating system fingerprint match (e.g.
222 "Linux:2.4::Linux 2.4/2.6" or "OpenBSD:3.0-3.5::OpenBSD 3.0-3.5"
223 before a knock sequence will be accepted.  The fingerprints are listed
224 in
225 .B /etc/fwknop/pf.os.
226 Note that the corresponding knock sequence must utilize the tcp protocol
227 (this is only be an issue for shared sequences since encrypted sequences
228 use tcp by default) since OS fingerprinting requires tcp syn packets.
229 This variable is optional.
230 .TP
231 .B REQUIRE_OS_REGEX: <regex>
232 Require an operating system fingerprint that matches <regex>, e.g.
233 "linux" or "*bsd".  Note that the regex will be matched case in-
234 sensitively.  This variable is optional.
235 .TP
236 .B REQUIRE_USERNAME: <username>
237 Require a specific username from the client system.  This username is
238 sent across the network in an encrypted knock sequence to the fwknop
239 server.  If there are multiple users on the client system, only a knock
240 sequence that is initiated by the required username will be honored.
241 This variable is optional and is only valid with an encrypted sequence
242 definition.
243 .TP
244 .B ENCRYPT_SEQUENCE
245 Expect that all port knock sequences originating from the SOURCE will
246 be encrypted.  Fwknop will try to decrypt all such sequences.
247 ENCRYPT_SEQUENCE does not accept any arguments.  Either this variable
248 or the "SHARED_SEQUENCE" variable is required for each SOURCE block.
249 .TP
250 .B SHARED_SEQUENCE: <proto/port>, ..., <proto/port>
251 Define the sequence of ports (together with their associated
252 protocol; tcp or udp) that will be sent to the destination knock
253 server.  This sequence is not encrypted, and source IP will be
254 allowed to connect through the destination firewall ruleset to a set
255 of tcp or udp ports (defined by the OPEN_PORTS variable).  Using
256 an encrypted sequence is much more secure.  Either this variable or
257 the "ENCRYPT_SEQUENCE" variable above is required for each SOURCE
258 block.
259 .TP
260 .B KNOCK_INTERVAL: <seconds>
261 Define the interval of time in which a port knock sequence will be
262 honored.  I.e. the number of seconds after the first connection
263 attempt the last connection attempt in the sequence must be received
264 for the knock sequence to be accepted by the destination fwknop
265 daemon.  If a KNOCK_INTERVAL is not specified then the default
266 interval of 60 seconds will automatically be set.
267 .TP
268 .B KNOCK_LIMIT: <number>
269 Define the maximum number of times a knock sequence will be honored.
270 Note that repetitive access to the fwknop server will eventually be
271 restricted if this option is used.
272 .TP
273 .B PORT_OFFSET: <offset>
274 Encrypted knock sequences take place over a range of 256 ports
275 starting at a default port of 61000.  This value can be changed
276 through the use of the PORT_OFFSET variable.  The PORT_OFFSET
277 is optional and will be set to 61000 by fwknop if it is not specified
278 in /etc/fwknop/access.conf.
279 .TP
280 .B MIN_TIME_DIFF: <seconds>
281 Set the minimum number of seconds that must pass between successive
282 connection attempts in a shared knock sequence.  This variable is
283 optional.
284 .TP
285 .B MAX_TIME_DIFF: <seconds>
286 Set the maximum number of seconds that must pass between successive
287 connection attempts in a shared knock sequence.  This variable is
288 optional.
289 .SH DEPENDENCIES
290 .B fwknopd
291 requires perl.  To take advantage of all of the features in fwknop when run
292 in server mode a functioning Netfilter firewall is required on the underlying
293 operating system.  If fwknop is being run in the legacy port knocking mode,
294 then Netfilter must log packets via syslog, and ideally the --log-tcp-options
295 argument will be specified in the iptables logging rule so that fwknop will
296 be able to use a strategy similar to
297 .B p0f
298 to passively fingerprint operating systems.
299 .SH DIAGNOSTICS
300 .B fwknop
301 can be run in debug mode with the --debug command line option.  This will
302 disable daemon mode execution, and print verbose information to the screen
303 on STDERR as packets are received.
304 .SH "SEE ALSO"
305 .BR fwknop (8),
306 .BR iptables (8),
307 .BR p0f (1),
308 .BR knopmd (8),
309 .BR knopwatchd (8)
310 .SH AUTHOR
311 Michael Rash <mbr@cipherdyne.org>
312 .SH CREDITS
313 The phrase "Single Packet Authorization" was coined by MadHat, see:
314 .B http://www.nmrc.org/
315 The term "port knocking" was coined by Martin Krzywinski, see:
316 .B http://www.portknocking.org/
317  The original p0f passive OS fingerprinter was written by Michal Zalewski, and is
318 available here:
319 .B http://lcamtuf.coredump.cx/p0f.shtml
320 .SH BUGS
321 Send bug reports to mbr@cipherdyne.org.  Suggestions and/or comments are
322 always welcome as well.
323 .SH DISTRIBUTION
324 .B fwknop
325 is distributed under the GNU General Public License (GPL), and the latest
326 version may be downloaded from
327 .B http://www.cipherdyne.org/
Note: See TracBrowser for help on using the browser.