82 Commits

Author SHA1 Message Date
Michael Rash
5176f9e04b [server] minor addition to access stanza dump output to include hmac digest type 2013-08-10 16:08:19 -04:00
Michael Rash
dac75c0242 [server] restore backwards compatibility for Rijndael keys > 16 bytes in legacy mode by truncating (upgrading recommended of course) 2013-07-14 15:37:24 -04:00
Michael Rash
24c4c5e208 continued zeroing out of sensitive data buffers in support of issue #93 2013-07-08 23:00:18 -04:00
Michael Rash
1e77f6ed53 continued changes to zero out sensitive information before exit (#93) 2013-07-07 22:32:30 -04:00
Michael Rash
4ff518d54a [server] zero out access stanza key information before exit (in support of #93) 2013-07-06 14:52:46 -04:00
Franck Joncourt
c2e1a00154 s/GNU Public/GNU General Public/g 2013-06-30 22:21:22 +02:00
Michael Rash
68acbaadc4 remove newline chars from log_msg() calls 2013-06-19 23:42:58 -04:00
Franck Joncourt
57cf6dc472 s/fprintf(stderr/log_msg(LOG_ERR/ 2013-06-16 22:16:41 +02:00
Michael Rash
17974a1c05 [server] comment additions regarding Coverity low priority TOCTOU issues 2013-06-04 22:17:59 -04:00
Michael Rash
382099e85a Updated copyright dates, removed NEWS file in favor of the ChangeLog 2013-06-02 14:07:01 -04:00
Michael Rash
52462e7dba Use {0} initializer for all stack allocated char arrays
Lots of places in the code were already using {0} to initialize stack char
arrays, but memset() was being used as well.  This commit removes all
unnecessary memset() calls against char arrays that are already initialized
via {0} (which sets all members to zero for such arrays).
2013-05-21 22:00:15 -04:00
Michael Rash
16f96a3e53 [server] port list memory leak bug fix for OpenBSD/pf and FreeBSD/ipfw firewall interface code found by Coverity 2013-05-19 14:36:32 -04:00
Michael Rash
23a354fced [client+server] ensure HMAC key and encryption passphrase are not the same 2013-05-18 12:10:18 -04:00
Michael Rash
6a2bc3db27 [server] minor memory leak bug fix during access.conf parsing found by Coverity 2013-05-13 20:48:23 -04:00
Michael Rash
cdd0a5f3f3 [server] minor memory leak bug fix during access.conf parsing found by Coverity 2013-05-13 20:38:39 -04:00
Michael Rash
aaa28d4ab3 [server] double free bug fix in access.conf parsing routine caught by Coverity 2013-05-08 23:44:13 -04:00
Michael Rash
2297dfd8c2 [server] minor memory leak bug fix for invalid date processing
Bug fix to ensure to release memory when invalid access stanza dates are set
and fwknopd has to exit.  This leak was caught with the test suite in
--enable-valgrind mode based on the following output:

==31947== 568 bytes in 1 blocks are still reachable in loss record 1 of 1
==31947==    at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==31947==    by 0x52EE42A: __fopen_internal (iofopen.c:73)
==31947==    by 0x1116A2: parse_access_file (access.c:909)
==31947==    by 0x10BAD5: main (fwknopd.c:194)
2013-05-02 22:26:21 -04:00
Michael Rash
f02cc0ddd2 Added HMAC support to GPG encryption modes, closes #58 2013-04-22 20:45:59 -04:00
Michael Rash
05ced0a514 add HMAC_KEY variable support to access.conf (alternative to HMAC_KEY_BASE64) 2013-04-08 22:14:06 -04:00
Michael Rash
0529d23595 remove minor debugging statement 2013-03-10 15:13:34 -04:00
Michael Rash
22dde8eb35 SPA with HMAC SHA256 and SHA384 now works
This is a fairly significant commit that lays the groundwork for getting
selectable HMAC modes working for both the client and server.  One libfko API
change was required so that the hmac_type is passed into fko_new_with_data().
This allows the server to set the hmac_type via access.conf stanzas.  The
effort in this commit will be extended to allow HMAC MD5, SHA1, and SHA512
also function properly.
2013-03-10 14:26:05 -04:00
Michael Rash
1a39047b92 ensure to close access.conf file ptr when an error condition is found and exit() is going to be called 2013-03-08 22:12:19 -05:00
Michael Rash
44d05a6916 interim commit for supporting multiple HMAC digest types (# 45) 2013-03-07 23:14:48 -05:00
Michael Rash
b86e48dd66 remove a couple of unnecessary header includes 2013-03-02 23:16:26 -05:00
Damien Stuart
f9e1ae4859 Merge my working branch 'hmac_support' into hmac_header_fixes 2013-03-02 17:22:50 -05:00
Damien Stuart
6ecf81b16e First round if refactoring to clean up header dependencies. 2013-03-02 17:03:20 -05:00
Michael Rash
ffcb77552b Remove lib/fko.h dependency on rijndael.h 2013-02-28 21:47:43 -05:00
Michael Rash
a413c6cf94 Continue atoi() replacement with strtol() wrapper, closes issue #21
This commit completes the conversion to the strtol() wrapper function in order
to remove all atoi() calls.  In addition, variable max values are enforced
using more broadly defined RCHK_* values.
2013-02-19 23:11:01 -05:00
Michael Rash
6a475bbe54 Continued atoi() replacement with strtol() wrapper (issue #21)
This commit replaces a few additional atoi() calls with the strtol() wrapper
function, and also fixes a bug where access SOURCE IP/mask combinations would
not be accepted when the string length was a long as something like
'123.123.123.123/255.255.255.255'.
2013-02-18 22:22:44 -05:00
Michael Rash
e7eb02f82d Maintain backwards compatibility with old "zero padding" code
[libfko] Added the ability to maintain backwards compatibility with the
now deprecated "zero padding" strategy in AES mode that was a hold over
from the old perl fwknop implementation.  This enables the backwards
compatiblity tests to continue to pass in the test suite.
2013-01-27 13:18:29 -05:00
Michael Rash
47ea800889 merged in fwknop-2.0.4 changes 2013-01-18 17:25:16 -05:00
Michael Rash
1828f51b90 [server] GPG_ALLOW_NO_PW + no KEY bug fix
Bug fix to allow GPG_ALLOW_NO_PW to result in not also having to specify a
Rijndael key.
2012-10-02 23:20:47 -04:00
Michael Rash
55fa4841f2 another merge from master 2012-09-03 22:32:44 -04:00
Michael Rash
e2c0ac4821 [server] Strong access.conf validation
Fernando Arnaboldi from IOActive found several conditions in
which the server did not properly throw out maliciously constructed
variables in the access.conf file.  This has been fixed along with new
fuzzing tests in the test suite.
2012-09-03 00:21:46 -04:00
Michael Rash
86b403dadb fixed potential buffer overflow discovered by Fernando Arnaboldi of IOActive 2012-09-01 23:37:03 -04:00
Michael Rash
5daaca01ea merged master 2.0.3 changes 2012-08-31 21:43:55 -04:00
Michael Rash
a60f05ad44 file permissions and client buffer overflow fix
- [client+server] Fernando Arnaboldi from IOActive found that strict
filesystem permissions for various fwknop files are not verified.  Added
warnings whenever permissions are not strict enough, and ensured that
files created by the fwknop client and server are only set to user
read/write.
- [client] Fernando Arnaboldi from IOActive found a local buffer overflow
in --last processing with a maliciously constructed ~/.fwknop.run file.
This has been fixed with proper validation of .fwknop.run arguments.
2012-08-29 22:21:43 -04:00
Michael Rash
e8386dbe6c added encryption mode flags for each access stanza 2012-08-26 15:47:24 -04:00
Michael Rash
d46ba1c027 (Fernando Arnaboldi, IOActive) Found and fixed several DoS/code execution vulns for authenticated clients
- [server] Fernando Arnaboldi from IOActive found several DoS/code
execution vulnerabilities for malicious fwknop clients that manage to
get past the authentication stage (so a such a client must be in
possession of a valid access.conf encryption key).  These vulnerbilities
manifested themselves in the handling of malformed access requests, and
both the fwknopd server code along with libfko now perform stronger input
validation of access request data.  These vulnerabilities affect
pre-2.0.3 fwknop releases.
- [test suite] Added a new fuzzing capability to ensure proper server-side
input validation.  Fuzzing data is constructed with modified fwknop
client code that is designed to emulate malicious behavior.
2012-08-24 22:12:19 -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
175374337d merged crypto_update after fwknop-2.0.1 merge to crypto_update from master 2012-07-24 17:10:00 -04:00
Michael Rash
c6b674617c completed merge from master after fwknop-2.0.1 release 2012-07-24 16:19:48 -04:00
Michael Rash
65b2acd8f5 minor update to print FORCE_NAT settings when access stanzas are printed 2012-07-18 23:17:27 -04:00
Michael Rash
47e39272ed Make encrypt/decrypt code accept integer key lengths instead of using strlen()
Now that encryptions keys and hmac keys may be acquired from /dev/random with
--key-gen (and base64 encoded), they may contain NULL bytes.  This emphasizes
the need to not leverage code that assumes C-style strings when making use of
key information.
2012-07-10 21:44:06 -04:00
Michael Rash
92e403a242 added initial HMAC-SHA256 support for the client side 2012-07-02 23:50:45 -04:00
Michael Rash
3095f0ee43 Added key generation support with --key-gen
Added --key-gen to allow KEY_BASE64 and HMAC_KEY_BASE64 keys to be created from
reading random data from /dev/random.  These keys can be placed within server
access.conf files and corresponding client .fwknoprc files for SPA
communications.  The HMAC key is not used yet with this commit, but that is
coming.
2012-06-27 23:06:17 -04:00
Michael Rash
adbc6a8f39 Bug fix to not force asymmetric gpg decryption
fwknopd access stanzas can have both Rijndael and GnuPG keys, so this
commit fixes a bug where any gpg info would force only gpg decryption
attempts even if a Rijndael key is provided in the stanza.
2012-06-23 15:13:03 -04:00
Michael Rash
5f8e3f4a7d Bug fix to throw out invalid access.conf SOURCE entries
This commit causes fwknopd to exit whenever an invalid SOURCE entry is seen
such as ":ANY".  Previous to this commit, valgrind threw the following errors
with ":ANY" as an access.conf SOURCE entry:

Invalid read of size 8
   at 0x117695: free_acc_source_list (access.c:512)
   by 0x1177E3: free_acc_stanza_data (access.c:564)
   by 0x117C67: free_acc_stanzas (access.c:654)
   by 0x10E32E: free_configs (config_init.c:106)
   by 0x10D085: main (fwknopd.c:376)
 Address 0x5a80658 is 8 bytes inside a block of size 16 free'd
   at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x116AE0: add_source_mask (access.c:255)
   by 0x116D57: expand_acc_source (access.c:303)
   by 0x117A82: expand_acc_ent_lists (access.c:620)
   by 0x119570: parse_access_file (access.c:1043)
   by 0x10C77E: main (fwknopd.c:193)

Invalid free() / delete / delete[] / realloc()
   at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x1176A8: free_acc_source_list (access.c:514)
   by 0x1177E3: free_acc_stanza_data (access.c:564)
   by 0x117C67: free_acc_stanzas (access.c:654)
   by 0x10E32E: free_configs (config_init.c:106)
   by 0x10D085: main (fwknopd.c:376)
 Address 0x5a80650 is 0 bytes inside a block of size 16 free'd
   at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x116AE0: add_source_mask (access.c:255)
   by 0x116D57: expand_acc_source (access.c:303)
   by 0x117A82: expand_acc_ent_lists (access.c:620)
   by 0x119570: parse_access_file (access.c:1043)
   by 0x10C77E: main (fwknopd.c:193)

HEAP SUMMARY:
    in use at exit: 8 bytes in 1 blocks
  total heap usage: 1,659 allocs, 1,659 frees, 238,310 bytes allocated
2012-06-17 13:42:23 -04:00
Michael Rash
6dbe523052 added test suite support for AES CTR, OFB, CFB, and ECB encryption modes 2012-02-10 15:09:27 -05:00