99 Commits

Author SHA1 Message Date
Michael Rash
8872e50818 [test suite] use digest tracking override for ALF fwknopd fuzzing 2014-11-25 15:04:30 -05:00
Michael Rash
2e1d076160 [server] minor status wording update 2014-11-15 00:16:17 -05:00
Michael Rash
aaa44656bc [server] add support for American Fuzzy Lop (ALF) fuzzing 2014-11-13 20:55:04 -05:00
Michael Rash
17608dd01d [test suite] additional code coverage 2014-10-25 08:42:30 -04:00
Michael Rash
ddbba5bc90 autoconf update to ensure libpcap is not linked against in --enable-udp-server mode 2014-09-29 11:42:11 -04:00
Michael Rash
5db3a12763 add signal handling code to UDP server mode 2014-09-28 20:30:09 -04:00
Michael Rash
1fd0e7e960 first cut at UDP server mode 2014-09-28 11:49:04 -04:00
Michael Rash
1dccab0fc8 [server] handle signal vars in dedicated function 2014-07-08 16:26:51 -05:00
Michael Rash
5c54ef00ad [server] refactor main() into a more natural breakdown of functions 2014-07-07 21:34:45 -05:00
Michael Rash
a2ff2a396c [server] call clean_exit() upon check_dir_path() error 2014-07-03 10:31:30 -04:00
Michael Rash
11b9732c16 [server] Call clean_exit() from daemon parent process
When becoming a daemon, make sure the fwknopd parent process calls
clean_exit() to release memory before calling exit().
2014-06-30 10:09:39 -04:00
Michael Rash
74440be653 [server] minor pointer typo fix 2014-06-16 23:08:50 -04:00
Michael Rash
054793fd9e [server] check fiu_enable() return value in --fault-injection mode 2014-06-15 09:48:37 -04:00
Michael Rash
70f70091b1 [server] skip fw initialization and cleanup in --test mode 2014-06-10 09:21:01 -04:00
Michael Rash
6d1d66fe03 add --fault-injection-tag support to the client/server/libfko
This is a significant commit to add the ability to leverage libfko fault
injections from both the fwknop client and server command lines via a
new option '--fault-injection-tag <tag name>'.  This option is used by
the test suite with the tests/fault_injection.pl tests.
2014-06-05 23:05:49 -04:00
Michael Rash
64a4642c47 [server] minor fix to remove unnecessary opts.status check 2014-05-08 07:28:48 -04:00
Michael Rash
02ed5f5ad4 [server] add --exit-parse-config option, man page updates (minor formatting change) 2014-05-04 09:17:27 -04:00
Michael Rash
11f3e9b8d3 [server] add test coverage for tcp server when FUZZING_INTERFACES is defined 2014-05-02 22:29:03 -04:00
Michael Rash
9e990c9be0 fix header non-ascii chars, and introduce test suite support for detecting this in source files 2014-03-14 09:14:35 -04:00
Michael Rash
bfdbb8f260 Updated authorship and copyright information
This commit updates all authorship and copyright information to include a
standard header that references the AUTHORS and CREDITS file. This standard
header was written by the Debian legal team at the request of Franck Joncourt.
2014-03-04 17:53:10 -05:00
Michael Rash
cf6a38ea0d [server] better checking for read() return value flagged by Coverity 2014-01-12 21:40:20 -05:00
Michael Rash
5f50ac22db [server] use SIGKILL if necessary for -K
This change sends SIGKILL to fwknopd under -K if SIGTERM does not do the job
first.  This can be necessary in some cases if libpcap does not properly handle
a packet count of zero in pcap_dispatch() (see github issue #110).  On a side
note, the default packet dispatch count of zero will likely be changed because
of that issue too.
2013-12-10 14:35:38 -06:00
Michael Rash
39fa4cc012 [server] if iptables init fails then no need to remove fwknop chains
This commit fixes a crash at init time in fwknopd if an improperly formatted
IPT_INPUT_ACCESS variable is used in fwknopd.conf file.  fwknopd should not
try to delete chains with a bogus IPT_INPUT_ACCESS variable, and valgrind
verifies that this change does not introduce any memory leaks (see the
'invalid iptables INPUT spec' tests run in --enable-valgrind mode).
2013-08-04 23:01:33 -04:00
Michael Rash
dcb7871d02 [server] don't print PID file existence warning in daemon mode (suggested by Ilya Tumaykin) 2013-07-24 23:04:31 -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
6f6f7b8de2 [server] update fw_config_init() to allow access stanza key information to be zeroed out upon error (#93) 2013-07-06 15:05:09 -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
9d7feb52f6 Merge remote-tracking branch 'upstream/master' 2013-06-30 22:22:34 +02:00
Franck Joncourt
c2e1a00154 s/GNU Public/GNU General Public/g 2013-06-30 22:21:22 +02:00
Michael Rash
37b624ac8b bump version to 2.5, minor fwknopd -S exit status update
This commit bumps the fwknop version to 2.5 and sets the libfko version to 2.0 to
signal incompatibility with older libfko versions.  Backwards compatibility is
maintained in SPA packet construction, but function prototypes in libfko-2.0 are
no longer compatible with older versions.

This commit also returns non-zero exit status under 'fwknopd --status' if there
is no existing fwknopd process.  This is better than always exiting with a zero
status regardless of whether fwknopd is already running or not, and adds a level
of scriptability to --status usage.  This change was suggested by George Herlin.
2013-06-27 21:21:10 -04: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
Franck Joncourt
b48295c69b Interim commit to make the log_msg strategy.
* log_msg : New log_set_verbosity(): It sets the default verbosity for the
    log module according to the verbose option set by the user through the command
    line.
  * Remove useless checks of the verbose option when log_msg() is invoked.
2013-06-16 19:12:06 +02:00
Michael Rash
c23d2d644f minor typo and format fixes 2013-06-13 21:22:58 -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
aafc3ac264 [server] setsockopt() nad fcntl() return value checking (found by Coverity) 2013-05-09 22:35:08 -04:00
Michael Rash
8c09d38941 various sizeof() usage and type bug fixes found by Coverity 2013-05-09 21:17:27 -04:00
Michael Rash
9f9bbcbcdd fixed several resource leak conditions found by Coverity 2013-05-09 17:15:58 -04:00
Michael Rash
b3f55bf1ab Convert most strlcpy() calls to use destination bound from sizeof()
This commit helps to ensure correctness of strlcpy() calls in support of fixing
issue #2.
2013-04-27 15:08:11 -04: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
1afc8db96a Added strtol_wrapper() libfko utility function for atoi() replacement (#21)
This commit replaces most atoi() calls (which don't report errors) with a strtol()
wrapper function for stronger string -> integer conversion validation.
2013-02-18 19:32:53 -05:00
Michael Rash
ce18de4f84 make libfko pointers constant where possible 2013-02-12 22:39:39 -05:00
Michael Rash
e3a78a175c verify_file_perms_ownership() to just return if the file doesn't exist 2012-09-01 21:55:52 -04:00
Michael Rash
2584521c67 Run verify_file_perms_ownership() on fwknop.pid only if it exists
Two bugs are fixed with this commit: verify permissions/ownership on the
fwknop.pid file only if it exists, and ensure to ru-run stat() on any directory
component if we're creating a directory.
2012-08-30 21:43:53 -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
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
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
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
44598fd7dd Added --digest-file and --pid-file args
Added --digest-file and --pid-file args so that the user can easily alter
these paths from the command line.
2011-10-20 23:31:59 -04:00