Commit Graph

61 Commits

Author SHA1 Message Date
Michael Rash
3afd1aa762 [server] ipfw active/expire sets cannot be the same 2012-08-16 22:16:36 -04:00
Michael Rash
385396b845 Added --enable-distcheck for 'make distcheck' verification 2012-08-13 22:53:29 -04:00
Michael Rash
27ccfe35d3 [server] Added GPG_ALLOW_NO_PW variable and associated test suite support
For GPG mode, added a new access.conf variable "GPG_ALLOW_NO_PW" to make it
possible to leverage a server-side GPG key pair that has no associated
password.  This comes in handy when a system requires the user to leverage
gpg-agent / pinentry which can present a problem in automated environments as
required by the fwknopd server.  Now, it might seem like a problem to remove
the passphrase from a GPG key pair, but it's important to note that simply
doing this is little worse than storing the passphrase in the clear on disk
anyway in the access.conf file.  Further, this link help provides additional
detail:

http://www.gnupg.org/faq/GnuPG-FAQ.html#how-can-i-use-gnupg-in-an-automated-environment
2012-08-10 22:20:30 -04:00
Michael Rash
5fd3343ca9 added client IP resolution test with complete SPA->SSH cycle 2012-08-01 22:30:02 -04:00
Michael Rash
016098a254 Replay attack bug fix (encryption prefixes)
Ensure that an attacker cannot force a replay attack by intercepting an
SPA packet and the replaying it with the base64 version of "Salted__"
(for Rindael) or the "hQ" prefix (for GnuPG).  This is an important fix.
The following comment was added into the fwknopd code:

/* Ignore any SPA packets that contain the Rijndael or GnuPG prefixes
 * since an attacker might have tacked them on to a previously seen
 * SPA packet in an attempt to get past the replay check.  And, we're
 * no worse off since a legitimate SPA packet that happens to include
 * a prefix after the outer one is stripped off won't decrypt properly
 * anyway because libfko would not add a new one.
*/

Conflicts:

	lib/cipher_funcs.h
2012-08-01 21:52:56 -04:00
Michael Rash
4c25aa17f3 [test suite] minor filename update -> use config files for fwknopd in a hash 2012-07-20 21:16:13 -04:00
Michael Rash
c0aa346890 [test suite] minor hostname bugfix to get 'local NAT' test to work 2012-07-18 22:55:56 -04:00
Michael Rash
72aaeb893e [test suite] better fwknopd is running check 2012-07-18 22:32:16 -04:00
Michael Rash
71fc4fe7fe [test suite] file_find_regex() postive vs. negative match styles
Positive match style requires all regex's to be found, whereas negative match
style only requires seeing one regex.
2012-07-17 21:55:13 -04:00
Michael Rash
6c73e160d9 Ensure that INPUT rules are added in --nat-local mode
This change ensures that INPUT rules are added when the fwknop client is used to
request access to a local service with --nat-local mode.
2012-07-17 21:50:29 -04:00
Michael Rash
981059452b minor file_find_regex() logging prefix update 2012-07-16 22:05:15 -04:00
Michael Rash
1b9f847521 [test suite] added local_nat_fwknopd.conf file for local NAT tests 2012-07-16 21:43:28 -04:00
Michael Rash
de7aa3b619 Add INPUT ACCEPT rule for --nat-local connections
When using the --nat-local argument on the fwknop client command line, the
fwknopd server needs to add an INPUT ACCEPT rule for the requested access
since the incoming connection is destined for a local socket.  Added test
suite support to test --nat-local access.

[test suite] Minor bug fix to ensure that all file_find_regex() calls return
true if all regex's are matched and false if any regex does not match data in
the specified file.
2012-07-15 21:32:14 -04:00
Michael Rash
e250776107 [test suite] Bug fix to account for libfko.dylib extension
Richard Haas reported the test suite failing on Mac OS X systems with the
existence check for the libfko library.  Damien Stuart advised that the library
has a different extention '.dylib' on Mac OS X, so this change accounts for the
difference.
2012-07-12 22:11:35 -04:00
Michael Rash
4d39140148 [test suite] minor directory path bug fix for --diff mode 2012-07-09 22:05:57 -04:00
Michael Rash
bc2e41fd47 added unique function names to --enable-valgrind suspect functions test 2012-07-08 21:21:36 -04:00
Michael Rash
9497044f24 added new test in --enable-valgrind mode to collect suspect functions 2012-07-08 15:30:35 -04:00
Michael Rash
6b3e5ef3c2 Added a test for a dual-usage key in access.conf 2012-07-08 08:35:50 -04:00
Michael Rash
6f6a9d727d minor test suite update to look for linker warnings in a more generic way 2012-01-02 15:25:35 -05:00
Michael Rash
1bd2592d15 minor test suite addition to check for linker input file warnings 2012-01-02 15:10:55 -05:00
Michael Rash
3d0ceccf65 added local_spa.key file 2011-12-05 22:20:39 -05:00
Michael Rash
9b7c1a8ce6 Added FORCE_NAT mode to the access.conf file
This commit adds a new configuration variable "FORCE_NAT" to the access.conf
file:

    For any valid SPA packet, force the requested connection to be NAT'd
    through to the specified (usually internal) IP and port value.  This is
    useful if there are multiple internal systems running a service such as
    SSHD, and you want to give transparent access to only one internal system
    for each stanza in the access.conf file.  This way, multiple external
    users can each directly access only one internal system per SPA key.

This commit also implements a few minor code cleanups.
2011-11-30 20:51:19 -05:00
Michael Rash
b280f5cde0 Added access stanza expiration feature, multiple access stanza bug fix
This commit does two major things:

1) Two new access.conf variables are added "ACCESS_EXPIRE" and
"ACCESS_EXPIRE_EPOCH" to allow access stanzas to be expired without having
to modify the access.conf file and restart fwknopd.

2) Allow an access stanza that matches the SPA source address to not
automatically short circuit other stanzas if there is an error (such as when
there are multiple encryption keys involved and an incoming SPA packet is
meant for, say, the second stanza and the first therefore doesn't allow
proper decryption).
2011-11-28 22:03:21 -05:00
Michael Rash
9e884e9759 added SPA packet aging tests 2011-11-22 22:56:48 -05:00
Michael Rash
644b9e9432 added test for --test mode in the fwknop client 2011-11-22 22:40:26 -05:00
Michael Rash
05b189ff4f added DNAT mode tests, minor memory leak fix in NAT mode, added fwknopd check for ENABLE_IPT_FORWARDING variable before attempting NAT access 2011-11-22 22:13:27 -05:00
Michael Rash
dd2deec73d added tests for various access.conf variables 2011-11-18 23:23:50 -05:00
Michael Rash
63498c9032 added IP/subnet match tests, added --Anonymize-results mode 2011-11-17 21:17:50 -05:00
Michael Rash
34cd0c7a78 simplified the client/server interaction code, started on IP filtering tests, added spoof username tests 2011-11-15 21:45:51 -05:00
Michael Rash
3d94aaa920 minor test wording consolidation 2011-11-10 22:54:25 -05:00
Michael Rash
9ebd55f522 remove CMD timestamps for --diff mode 2011-11-10 22:33:00 -05:00
Michael Rash
9e19b8bc26 added --diff mode to the test suite to compare results from one execution to the next 2011-11-06 13:51:23 -05:00
Michael Rash
a5a3c06ef2 consolidated several test functions into a single generic_exec() function 2011-11-04 23:46:31 -04:00
Michael Rash
f41a26b389 Fixed fwknopd memory leak, several other fixes and updates
This commit does several things.  First, a memory leak in fwknopd has been
fixed by ensuring to free access.conf stanzas.  This bug was found with the
new test suite running in --enable-valgrind mode.  Here is what some of the
valgrind output looked like to find the leak:

==19217== 11 bytes in 1 blocks are indirectly lost in loss record 3 of 5
==19217==    at 0x4C2815C: malloc (vg_replace_malloc.c:236)
==19217==    by 0x52F6B81: strdup (strdup.c:43)
==19217==    by 0x10FC8B: add_acc_string (access.c:49)
==19217==    by 0x1105C8: parse_access_file (access.c:756)
==19217==    by 0x10B79B: main (fwknopd.c:194)
==19217==
==19217== 16 bytes in 1 blocks are indirectly lost in loss record 4 of 5
==19217==    at 0x4C27480: calloc (vg_replace_malloc.c:467)
==19217==    by 0x10FEC0: add_source_mask (access.c:88)
==19217==    by 0x110100: expand_acc_source (access.c:191)
==19217==    by 0x1104B0: parse_access_file (access.c:500)
==19217==    by 0x10B79B: main (fwknopd.c:194)
==19217==
==19217== 183 (152 direct, 31 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
==19217==    at 0x4C27480: calloc (vg_replace_malloc.c:467)
==19217==    by 0x1103E4: parse_access_file (access.c:551)
==19217==    by 0x10B79B: main (fwknopd.c:194)
==19217==
==19217== LEAK SUMMARY:
==19217==    definitely lost: 152 bytes in 1 blocks
==19217==    indirectly lost: 31 bytes in 3 blocks
==19217==      possibly lost: 0 bytes in 0 blocks
==19217==    still reachable: 8 bytes in 1 blocks
==19217==         suppressed: 0 bytes in 0 blocks

Second, this commit changes how fwknopd acquires packet data with
pcap_dispatch() - packets are now processed within the callback function
process_packet() that is provided to pcap_dispatch(), the global packet
counter is incremented by the return value from pcap_dispatch() (since this is
the number of packets processed per pcap loop), and there are two new
fwknopd.conf variables PCAP_DISPATCH_COUNT and PCAP_LOOP_SLEEP to control the
number of packets that pcap_dispatch() should process per loop and the number
of microseconds that fwknopd should sleep per loop respectively.  Without this
change, it was fairly easy to cause fwknopd to miss packets by creating bursts
of packets that would all be processed one at time with the usleep() delay
between each.  For fwknopd deployed on a busy network and with a permissive
pcap filter (i.e. something other than the default that causes fwknopd to look
at, say, TCP ACK's), this change should help.

Third, the criteria that a packet must reach before data copying into the
buffer designed for SPA processing has been tightened.  A packet less than
/greater than the minimum/maximum expected sizes is ignored before data is
copied, and the base64 check is done as well.
2011-11-03 22:15:19 -04:00
Michael Rash
97a8d751c1 added complete SPA cycle tests for tcp ports 23 and 9418 (git), and for udp 53 dns 2011-10-30 22:14:00 -04:00
Michael Rash
8e4b45dd56 minor looping criteria update for valgrind tests 2011-10-29 23:48:42 -04:00
Michael Rash
ea3e817871 [test-suite] added the ability to run all fwknop tests through valgrind 2011-10-29 16:59:57 -04:00
Michael Rash
dbbbe60fe4 added stack protection detection for OpenBSD systems 2011-10-28 22:59:52 -04:00
Michael Rash
2e96ece4b0 Update to ensure libfko.so path is detected properly on OpenBSD 2011-10-28 22:42:27 -04:00
Michael Rash
464dbe95d0 Update to print all firewall commands in --verbose mode
This commit makes it easier to determine exactly which commands fwknopd
runs in --verbose mode when interacting with the underlying firewall.
This commit also adds --verbose --verbose mode to the test suite.
2011-10-27 21:51:55 -04:00
Michael Rash
1c6fc0f3f8 update to detect loopback interface 2011-10-24 20:48:56 -04:00
Michael Rash
c9860811f5 added LD_LIBRARY_PATH to all fwknop/fwknopd commands to make manual command execution easier 2011-10-22 22:29:27 -04:00
Michael Rash
50bcc537ee added digest cache validation after GPG tests 2011-10-22 22:06:00 -04:00
Michael Rash
1b8606461c minor update to match include/exclude criteria on the whole test message 2011-10-22 21:54:22 -04:00
Michael Rash
9e3a4b4c92 extended packet validity tests in GPG mode 2011-10-22 21:29:44 -04:00
Michael Rash
09e6ed1405 added first GPG complete cycle SPA test 2011-10-22 16:48:30 -04:00
Michael Rash
e4f4ee7825 added test to validate digest.cache structure 2011-10-22 14:25:56 -04:00
Michael Rash
266150218a added -P bpf test for complete SPA cycle over non standard SPA port 2011-10-22 10:57:25 -04:00
Michael Rash
0ab39a64a5 added -P bpf filter test 2011-10-22 10:48:37 -04:00
Michael Rash
6848983b47 added Rijndael SPA validity tests 2011-10-21 23:43:08 -04:00