789 Commits

Author SHA1 Message Date
Michael Rash
8fafd4b80b [server] 'make install' permissions fix
Set restrictive permissions on /etc/fwknop/ directory and /etc/fwknop/* files.
Current default permissions on /etc/fwknop/ and /etc/fwknop/* are too lax.
2012-08-12 19:57:11 -04:00
Michael Rash
543de16613 [server] iptables 'comment' match check
Implemented a new check to ensure that the iptables 'comment' match exists to
ensure the proper environment for fwknopd operations.  This check is controlled
by the new ENABLE_IPT_COMMENT_CHECK variable, and was suggested by Hank
Leininger.
2012-08-12 15:44:13 -04:00
Michael Rash
a087b11887 todo update 2012-08-12 15:23:38 -04:00
Michael Rash
a686d96d44 Added todo.org org mode file
The todo.org mode file was built with vim and the VimOrganizer project:

https://github.com/hsitz/VimOrganizer
2012-08-12 09:29:51 -04:00
Michael Rash
dc23c640bb added gpg_no_pw_access.conf file for no password gpg tests 2012-08-11 09:33:54 -04:00
Michael Rash
72229b5f46 bumped version to fwknop-2.0.2-pre2 2012-08-11 09:21:49 -04:00
Michael Rash
47795d41e2 merged from master 2012-08-10 22:30:07 -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
0af3bd0ee1 [server] Added FLUSH_IPFW_AT_INIT and FLUSH_IPFW_AT_EXIT
Added FLUSH_IPFW_AT_INIT and FLUSH_IPFW_AT_EXIT for ipfw firewalls to emulate
the corresponding functionality that is implemented for iptables firewalls.

Bug fix for ipfw firewalls to ensure that if the ipfw expire set is zero, then
do not disable this set whenever the FLUSH_IPFW* variables are enabled.

These changes were suggested by Jonathan Schulz.
2012-08-10 21:48:02 -04:00
Michael Rash
c6f3fde537 bug fix to implement FLUSH_IPT_AT_INIT and FLUSH_IPT_AT_EXIT functionality 2012-08-10 21:43:49 -04:00
Michael Rash
fbdae50064 added Geoff Carstairs for the FORCE_NAT idea 2012-08-08 21:27:33 -04:00
Michael Rash
fd30440128 added Aldan Beaubien for reporting the Morpheus NULL IP problem 2012-08-05 14:07:42 -04:00
Michael Rash
c374a7df27 Merge branch 'master' into hmac_support 2012-08-05 13:26:43 -04:00
Michael Rash
e70739d211 minor whitespace update 2012-08-05 13:05:55 -04:00
Michael Rash
f6ac4484c9 minor memset value update 0 -> 0x0 to conform to other memset() calls 2012-08-05 13:05:30 -04:00
Michael Rash
4cde31584f bumped version to 2.0.2-pre1 2012-08-03 22:16:22 -04:00
Michael Rash
79a947603a added changes for the 2.0.2 release (so far) 2012-08-03 22:08:14 -04:00
Michael Rash
29512bd8ec [client] -R http recv() read until close (Jonathan Schulz)
Applied patch from Jonathan Schulz to ensure that the fwknop client reads all
data from a remote webserver when resolving the client IP address in -R mode.
Jonathan indicated that some webservers would transfer HTTP headers and data
separately, and a single recv() would therefore fail to get the necessary IP
information.
2012-08-03 21:49:03 -04:00
Michael Rash
7c1db89106 minor white space fix tabs->spaces 2012-08-03 21:30:24 -04:00
Michael Rash
eb5176cf60 [test suite] added --enable-all arg 2012-08-03 21:20:21 -04:00
Michael Rash
f7084721b7 added 'altered HMAC' tests to ensure HMAC verification happens properly 2012-08-02 23:24:38 -04:00
Michael Rash
30acf93b72 Memory leak fix for HMAC verification
This commit commit fixes a memory leak in the HMAC verification code found with
the test suite running in valgrind mode.  Here is the './test-fwknop.pl --diff'
output showing fko_verify_hmac() removed from the flagged functions list:

 [+] fwknop functions (unique view):
-        8 : ???
-        3 : main
-        3 : pcap_capture
-        1 : incoming_spa
+        7 : ???
+        2 : pcap_capture
+        2 : main
         1 : pcap_compile
-        1 : fko_new_with_data
-        1 : strndup
-        1 : fko_verify_hmac

 [+] fwknop functions (with call line numbers):
-        8 : ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
-        3 : main (fwknopd.c:299)
-        1 : fko_new_with_data (fko_funcs.c:220)
-        1 : pcap_capture (pcap_capture.c:105)
-        1 : incoming_spa (incoming_spa.c:376)
-        1 : strndup (strndup.c:46)
+        7 : ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
+        2 : main (fwknopd.c:299)
         1 : pcap_compile (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
-        1 : pcap_capture (pcap_capture.c:226)
         1 : pcap_capture (pcap_capture.c:97)
-        1 : fko_verify_hmac (fko_hmac.c:54)
+        1 : pcap_capture (pcap_capture.c:105)
2012-08-02 22:55:54 -04:00
Michael Rash
3d9e96af56 Memory leak fix in client test mode
This commit fixes the following memory leak found with the test suite running
in valgrind mode:

HEAP SUMMARY:
    in use at exit: 217 bytes in 3 blocks
  total heap usage: 27 allocs, 24 frees, 5,260 bytes allocated

44 bytes in 1 blocks are definitely lost in loss record 1 of 3
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x50CB861: strndup (strndup.c:46)
   by 0x4E3A4D4: fko_verify_hmac (fko_hmac.c:54)
   by 0x4E394DD: fko_new_with_data (fko_funcs.c:220)
   by 0x10B3A7: main (fwknop.c:408)

44 bytes in 1 blocks are definitely lost in loss record 2 of 3
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x50CB801: strdup (strdup.c:43)
   by 0x4E3A3FC: fko_calculate_hmac (fko_hmac.c:162)
   by 0x4E3A552: fko_verify_hmac (fko_hmac.c:86)
   by 0x4E394DD: fko_new_with_data (fko_funcs.c:220)
   by 0x10B3A7: main (fwknop.c:408)

129 bytes in 1 blocks are definitely lost in loss record 3 of 3
   at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4E36A03: add_salted_str (cipher_funcs.c:298)
   by 0x4E3A587: fko_verify_hmac (fko_hmac.c:75)
   by 0x4E394DD: fko_new_with_data (fko_funcs.c:220)
   by 0x10B3A7: main (fwknop.c:408)

LEAK SUMMARY:
   definitely lost: 217 bytes in 3 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 0 bytes in 0 blocks
   still reachable: 0 bytes in 0 blocks
        suppressed: 0 bytes in 0 blocks
2012-08-02 22:46:52 -04:00
Michael Rash
cba6478258 Memory leak bug fix for rc file parsing of invalid data
This commit fixes the following (found with the test suite in valgrind mode):

568 bytes in 1 blocks are still reachable in loss record 1 of 1
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x50B1C9A: __fopen_internal (iofopen.c:76)
   by 0x10D0CD: process_rc (config_init.c:516)
   by 0x10D645: config_init (config_init.c:752)
   by 0x10AB13: main (fwknop.c:70)
2012-08-02 22:29:54 -04:00
Michael Rash
c37047ac93 Memory leak bug fix in --key-gen mode
This commit fixes the following memory caught with the test suite in valgrind
mode:

HEAP SUMMARY:
    in use at exit: 285 bytes in 4 blocks
  total heap usage: 11 allocs, 7 frees, 3,179 bytes allocated

5 bytes in 1 blocks are indirectly lost in loss record 1 of 4
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x50CB801: strdup (strdup.c:43)
   by 0x4E3A7B2: fko_set_username (fko_user.c:96)
   by 0x4E39628: fko_new (fko_funcs.c:86)
   by 0x10AB54: main (fwknop.c:83)

7 bytes in 1 blocks are indirectly lost in loss record 2 of 4
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4E395D7: fko_new (fko_funcs.c:62)
   by 0x10AB54: main (fwknop.c:83)

17 bytes in 1 blocks are indirectly lost in loss record 3 of 4
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4E3A06A: fko_set_rand_value (fko_rand_value.c:114)
   by 0x4E39605: fko_new (fko_funcs.c:75)
   by 0x10AB54: main (fwknop.c:83)

285 (256 direct, 29 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4
   at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4E395BA: fko_new (fko_funcs.c:46)
   by 0x10AB54: main (fwknop.c:83)

LEAK SUMMARY:
   definitely lost: 256 bytes in 1 blocks
   indirectly lost: 29 bytes in 3 blocks
     possibly lost: 0 bytes in 0 blocks
   still reachable: 0 bytes in 0 blocks
        suppressed: 0 bytes in 0 blocks
2012-08-02 22:00:05 -04:00
Michael Rash
b8ed3a60d9 excluded HMAC random verification from --enable-valgrind mode (too slow for 100 client executions) 2012-08-02 21:56:45 -04:00
Michael Rash
84b9c775c0 Merge branch 'master' into hmac_support 2012-08-01 23:41:00 -04:00
Michael Rash
7061b7bd3e added Jonathan Schulz 2012-08-01 23:40:34 -04:00
Michael Rash
84e036f95b Change HTTP connection type to 'close' in -R mode
Applied patch from Jonathan Schulz to change the HTTP connection type to
'close' for the client in -R mode.
2012-08-01 23:27:34 -04:00
Michael Rash
1528697aaa merged replay prefix and IP resolve tests 2012-08-01 23:05:51 -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
c0e53482fa [libfko] minor memory leak fix for user detection (corner case) 2012-07-30 22:34:15 -04:00
Michael Rash
060fbb607f [server] replay attack detection memory leak bug fix
This commit fixes the following memory leak found with valgrind:

44 bytes in 1 blocks are definitely lost in loss record 2 of 2
   at 0x482BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x490EA50: strdup (strdup.c:43)
   by 0x10CD69: incoming_spa (incoming_spa.c:162)
   by 0x10E000: process_packet (process_packet.c:200)
   by 0x4862E63: ??? (in /usr/lib/i386-linux-gnu/libpcap.so.1.1.1)
   by 0x4865667: pcap_dispatch (in /usr/lib/i386-linux-gnu/libpcap.so.1.1.1)
   by 0x10DABF: pcap_capture (pcap_capture.c:226)
   by 0x10A798: main (fwknopd.c:299)
2012-07-30 22:33:24 -04:00
Michael Rash
a8bb42569c [test suite] minor compile bug fix 2012-07-29 23:35:32 -04:00
Michael Rash
afc71b7df3 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.
*/
2012-07-29 23:31:15 -04:00
Michael Rash
fd30a3491d minor variable rename LENGTH -> LEN, STRING_LENGTH -> STR_LEN 2012-07-29 21:57:05 -04:00
Michael Rash
a9cbd60327 [libfko] first HMAC-SHA256 implementation (includes test suite support) 2012-07-29 21:34:08 -04:00
Michael Rash
df0f0b7f61 [libfko] minor memory leak fix for user detection (corner case) 2012-07-29 21:31:44 -04:00
Michael Rash
6d379aba6e [server] replay attack detection memory leak bug fix
This commit fixes the following memory leak found with valgrind:

44 bytes in 1 blocks are definitely lost in loss record 2 of 2
   at 0x482BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x490EA50: strdup (strdup.c:43)
   by 0x10CD69: incoming_spa (incoming_spa.c:162)
   by 0x10E000: process_packet (process_packet.c:200)
   by 0x4862E63: ??? (in /usr/lib/i386-linux-gnu/libpcap.so.1.1.1)
   by 0x4865667: pcap_dispatch (in /usr/lib/i386-linux-gnu/libpcap.so.1.1.1)
   by 0x10DABF: pcap_capture (pcap_capture.c:226)
   by 0x10A798: main (fwknopd.c:299)
2012-07-28 00:08:30 -04:00
Michael Rash
b760f4aad3 [test suite] exempted valgrind collection test from --test-limit 2012-07-27 23:59:03 -04:00
Michael Rash
c6cef8982a [libfko] validate incoming plaintext lengths 2012-07-27 23:25:32 -04:00
Michael Rash
482e6f974c added msg_hmac_len and removed additional strlen() calls 2012-07-27 21:29:26 -04:00
Michael Rash
10195cf29a [libfko] added encrypted_msg_len and replaced additional strlen() calls 2012-07-27 18:16:37 -04:00
Michael Rash
a6ea3f6935 [test suite] minor bug fix for file existence check 2012-07-27 18:08:23 -04:00
Michael Rash
d0cb2c6ad5 [test suite] added 100 key uniqueness test for --key-gen mode 2012-07-27 13:30:29 -04:00
Michael Rash
ab52476bfc [test suite] [client] added --key-gen and --key-gen-file tests 2012-07-27 13:05:29 -04:00
Michael Rash
16348aaccd replace strlen() call with strnlen() and MAX_SPA_ENCODED_MSG_SIZE bound 2012-07-27 02:06:58 -04:00
Michael Rash
8471d8aae6 semicolon syntax buf fix 2012-07-27 02:01:43 -04:00
Michael Rash
d561fdd4d7 added lib/fko_util.c with basic length checking functions 2012-07-26 18:01:36 -04:00