439 Commits

Author SHA1 Message Date
Damien S. Stuart
aff8832d66 Refactored configure.ac to use a custom macro for compiler flag checks.
Set version to 2.0 (non-release candidate).
Minor typo fixes.
2011-12-29 14:20:18 -05:00
Michael Rash
99b1a48756 updated copyright and license statement - fwknop is GPL software 2011-12-12 20:41:39 -05:00
Michael Rash
7ac5319847 minor addition of the local_spa.key file for 'make dist' 2011-12-05 22:23:00 -05:00
Michael Rash
7a231a3b72 added local_spa.key file 2011-12-05 22:21:31 -05:00
Michael Rash
3d0ceccf65 added local_spa.key file 2011-12-05 22:20:39 -05:00
Michael Rash
710f98a9b5 minor addition of the CREDITS file for 'make dist' 2011-12-05 22:16:38 -05:00
Michael Rash
9bcd7cb137 Added the CREDITS file for 'make dist' 2011-12-05 22:16:03 -05:00
Michael Rash
3b2ec921be change log doc updates 2011-12-05 22:11:58 -05:00
Michael Rash
474a18b57d Added various files to Makefile.am so that 'make dist' continues to work 2011-12-05 22:10:47 -05:00
Michael Rash
690fe25fa4 added CREDITS file, bumped software version, added ChangeLog files 2011-12-05 21:14:31 -05:00
Michael Rash
bcba9d6bde added CREDITS file, bumped software version, added ChangeLog files 2011-12-05 21:14:14 -05:00
Michael Rash
893b89a3eb minor compiler warning fix on OpenBSD 2011-12-03 21:21:29 -05:00
Michael Rash
860b4527a4 minor compile fixes for FreeBSD 2011-12-03 13:10:35 -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
8585958e6e minor newline fix for access.conf output dump 2011-11-28 23:20:11 -05:00
Michael Rash
2a1243fee6 memory leak bugfix as a follow up to commit b280f5cde0246cdef33dee3f8be66a2bcef77336 2011-11-28 23:18:07 -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
72a4353fd8 bug fix to exclude SPA packets with timestamps in the future that are too great (old packets were properly excluded already) 2011-11-22 22:56:36 -05:00
Michael Rash
644b9e9432 added test for --test mode in the fwknop client 2011-11-22 22:40:26 -05:00
Michael Rash
0015da4442 bug fix to honor the fwknop client --time-offset-plus and --time-offset-minus options 2011-11-22 22:34:10 -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
50b48147c0 This commit fixes two memory leaks and adds a common exit function.
The two memory leaks were found with the test suite running in
--enable-valgrind mode - here are the relevant error messages:

For fwknopd server GPG clean up:

==345== 9 bytes in 1 blocks are definitely lost in loss record 2 of 2
==345==   at 0x4C2815C: malloc (vg_replace_malloc.c:236)
==345==   by 0x52F6B81: strdup (strdup.c:43)
==345==   by 0x10FA57: add_string_list_ent (access.c:308)
==345==   by 0x110513: parse_access_file (access.c:387)
==345==   by 0x10B5FB: main (fwknopd.c:193)

For fwknop client rc file processing:

==8045== 568 bytes in 1 blocks are still reachable in loss record 12 of 12
==8045==    at 0x4C2815C: malloc (vg_replace_malloc.c:236)
==8045==    by 0x50A53AA: __fopen_internal (iofopen.c:76)
==8045==    by 0x10C3FF: process_rc (config_init.c:446)
==8045==    by 0x10C8F6: config_init (config_init.c:671)
==8045==    by 0x10AC9E: main (fwknop.c:62)

There is also a new clean_exit() function that makes it easier to ensure that
resources are deallocated upon existing.
2011-11-10 22:33:32 -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
044ea54d93 updated client SPA verbose message to include the server IP/host 2011-10-29 23:49:29 -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
f999e2e672 bugfix to return preprocess_spa_data() result properly to calling function 2011-10-29 16:55:28 -04:00
Michael Rash
b1b830f744 update to remove packet direction requirement when sniffing on OpenBSD loopback interfaces 2011-10-28 23:01:06 -04:00
Michael Rash
cde71b1b27 minor whitespace removal 2011-10-28 23:00:26 -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
6388e8ac7f added 'const' to function prototype vars where possible
Added the 'const' qualifier to function prototype variables where possible.
In addition, reduced some functions to file-scope with 'static' where possible.

Also made a few minor changes to remove extra whitespace, and fixed a bug
in create_fwknoprc() to ensure the new fwknoprc filehandle is closed.
2011-10-25 21:00:40 -04:00
Michael Rash
85377267e2 compiler warning fix for sscanf() on freebsd
This commit fixes the following gcc warning on freebsd systems:

replay_cache.c: In function 'replay_file_cache_init':
replay_cache.c:312: warning: format '%ld' expects type 'long int *', but argument 9 has type 'time_t *'
2011-10-24 21:52:13 -04:00
Michael Rash
1c6fc0f3f8 update to detect loopback interface 2011-10-24 20:48:56 -04:00
Michael Rash
3299fb2581 minor whitespace removal 2011-10-24 20:48:20 -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