103 Commits

Author SHA1 Message Date
Jonathan Bennett
748803aef7 Add length checks for nat_access messages 2015-12-31 04:40:41 +00:00
Jonathan Bennett
bc55f0f21f Add count_characters and a CUnit test series for it. 2015-12-31 04:14:58 +00:00
Jonathan Bennett
56be13b3f6 Add dns resolution for nat access 2015-12-31 04:13:46 +00:00
Michael Rash
a85b081f79 copyright update 2015-12-23 14:34:51 -05:00
Michael Rash
4f81dd7747 [server] local NAT should not be enabled by default 2015-12-07 16:51:19 -08:00
Michael Rash
988075b52b [server] bug fix to honor client timeout SPA messages in --nat-local mode, fixes #173 2015-12-04 19:36:51 -08:00
Michael Rash
ec9eef3365 [server] fix a dead code condition spotted by Coverity 2015-08-19 23:41:47 -04:00
Michael Rash
423899f3c4 [server] minor fix to remove unnecessary var definition 2015-08-18 22:02:00 -04:00
Michael Rash
295a6a0d14 [server] fix is_digits() logic and add tests 2015-07-17 21:28:02 -07:00
Michael Rash
6e4ad4767f [server] make sure fw _exp_NNN... strings contain only digits after the _exp_ prefix 2015-07-17 12:15:01 -07:00
Michael Rash
b753812cf6 [server] minor addition of function names to fw command error log messages 2015-07-17 11:48:28 -07:00
Michael Rash
f1c3806dca [test suite] added tests for duplicate rule detection (issue #162) 2015-07-14 21:13:46 -04:00
Michael Rash
ef9498f783 [server] Implement garbage cleanup mode for rule deletion
This is a significant commit that allows fwknopd to delete expired rules
from the firewall policy regardless of whether fwknopd is tracking them.
That is, a third party program could insert rules into the fwknopd
chains (iptables for now, but this will be extended to the other
firewalls) in order to take advantage of fwknopd rule deletion.
2015-07-13 21:29:16 -04:00
Michael Rash
bb90a0cb2e [server] minor comment addition 2015-07-12 20:57:09 -04:00
Michael Rash
f4f2ada1c0 [server] bug fix to not zero the wrong buffer for iptables rule deletion
This commit fixes a bug where zero_cmd_buffers() was being called against the
wrong buffer as SPA rules were supposed to be deleted. Although multiple
iterations of check_firewall_rules() would have compensated, some rules would
not have been deleted as quickly as they should have in multi-rule scenarios.
2015-07-12 20:36:06 -04:00
Michael Rash
5460509f88 [server] add NAT rule existence detection for --no-ipt-check support (issue #162) 2015-07-07 08:28:16 -04:00
Michael Rash
012d1cf888 [server] interim commit towards a fix for --no-ipt-check rule detection
This is a significant commit for issue #162 where fwknopd is not properly
detecting rules (particularly NAT rules) on systems running older versions
of iptables where -C support is not offered. A new capability of searching
the output of an external command and getting the first matching line was
added with the search_extcmd_getline() function.
2015-07-05 20:47:06 -04:00
Michael Rash
17d1071aa8 [server / test suite] cleaner SNAT MASQUERADE support 2015-04-22 01:00:57 -07:00
Michael Rash
176afecd9f [server] minor spacing fix 2015-04-21 21:09:20 -04:00
Michael Rash
bb5aa928d9 [server] fix typos from corresponding firewalld changes 2015-04-18 12:33:11 -07:00
Michael Rash
03959653ca [server] differentiate MASQUERADE from SNAT with a dedicated FWKNOP_MASQUERADE chain 2015-04-18 05:38:35 -07:00
Michael Rash
1e9f7e94f0 [server] consolidate chain creation within mk_chain() 2015-04-14 08:21:00 -07:00
Michael Rash
cf8c4df50e [server] remove DISABLE_DNAT exception for SPA packets that request a NAT operation - this is reserved for FORCE_NAT scenarios 2015-04-14 08:12:56 -07:00
Michael Rash
547dbb66b3 [server] minor return value handling update for create_chain() and add_jump_rule() 2015-04-08 18:30:03 -07:00
Michael Rash
0fa42ae117 [server] allow DISABLE_DNAT to not require FORCE_NAT 2015-04-07 16:34:49 -07:00
Michael Rash
8e6db3a5da [server] extend FORWARD_ALL to apply to NAT operations
This is a significant commit to allow all ports and protocols to be
NAT'd in conjunction with FORWARD ACCEPT rules. This commit is in
support of 6b7a3bbdae295c29a15a59385e637bd391858bc2 to allow fwknopd to
function as an SPA gateway.
2015-04-06 20:04:33 -04:00
Michael Rash
59edf64d9c [server] consolidate fw creation, add FORWARD_ALL functionality 2015-03-07 20:09:31 -08:00
Michael Rash
6b7a3bbdae [server] Add FORWARD_ALL access.conf wildcard
This is a significant commit that allows iptables firewalls to be used
as an "SPA gateway" for all ports/protocols upon providing a valid SPA
packet. Additional commits will be made to extend this capability, but
this commit adds two new access.conf keywords: FORWARD_ALL and
DISABLE_DNAT. These are used in conjunction to add ACCEPT rules for all
ports/protocols in the FORWARD chain, and also disable DNAT rules at the
same time. Then, by buildling the SNAT chain to provide translation for
an internal network (where an SPA cliet is located), but DROP all
forwarded traffic by default at the same time, SPA can be used to gain
access to the internet. So, this would allow, say, an RFC 1918 internal
network to have IP's assigned via DHCP but they wouldn't be able to
access the internet before sending a SPA packet to the gateway. This
scenario was suggested by spartan1833 to the fwknop list and tracked via
github issue 131.

Additional commits will be made to fully support this feature.
2015-01-17 08:38:32 -05:00
Michael Rash
08bc935796 [server] remove redundant mk_chain() calls 2015-01-06 16:39:45 -05:00
Michael Rash
1f9e939c95 [server] consolidate iptables rule additions into a single ipt_rule() function 2015-01-06 15:30:12 -05:00
Michael Rash
1ece9d022b [server] consolidate create_chain() and add_jump_rule() into a single function 2014-12-30 10:42:31 -05:00
Michael Rash
9dc56d6bb7 [test suite / server] rule deletion/addition tests mid-cycle 2014-12-15 17:06:07 -08:00
Grant Pannell
624872ef48 Add DESTINATION access.conf directive and ENABLE_DESTINATION_RULE fwknopd.conf directive 2014-11-29 15:05:06 +10:30
Michael Rash
a8879231c3 [server] add run_extcmd_write() call in code coverage mode 2014-11-06 20:24:33 -05:00
Michael Rash
c70e1c72a0 [server] update firewalld code to use run_extcmd() instead of popen() and system() - allows execvpe() to be used 2014-10-12 21:57:04 -04:00
Michael Rash
62ee780d65 [server] make pid_status a static var at the top of each fw_util_*.c file 2014-10-10 14:20:18 -04:00
Michael Rash
1905baa0e8 [server] minor macro usage update 2014-10-07 21:37:29 -04:00
Michael Rash
b7785a9304 [server] extend run_extcmd() to allow the caller to specify whether to collect stderr 2014-10-07 21:01:17 -04:00
Michael Rash
652b8cb80e [server] have run_extcmd() collect process exit status for calling function (in addition to return value) 2014-10-05 20:21:05 -04:00
Michael Rash
841d732c07 [server] removed remaining popen() call for iptables firewalls 2014-10-04 19:56:26 -04:00
Michael Rash
d71f386971 [server] add search_extcmd() to replace all popen() calls with the execvpe() no env strategy 2014-10-04 10:31:15 -04:00
Michael Rash
e271442aa9 [server] first cut at converting iptables commands to use execvpe() 2014-10-03 21:58:51 -04:00
Michael Rash
06ce514111 [test suite] add several fault injection tests 2014-06-12 00:02:18 -04:00
Michael Rash
6dde30bc91 [test suite] significant test coverage update
This commit adds a lot of test coverage support as guided by gcov +
lcov.

Also added the --no-ipt-check-support option to fwknopd (this is only
useful in practice on older Linux distros where 'iptables -C' is not
available, but it helps with test coverage).
2014-04-29 20:54:01 -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
919f25f85d [server] fw_initialize() vs. fw_config_init() bug fix for use_masquerade 2013-12-14 19:41:00 -05:00
Michael Rash
92cdb47ff7 [server] added FORCE_MASQUERADE to fwknopd(8) man page, closes #101
This commit completes the addition of generalized NAT (both DNAT and
SNAT) capabilities to access.conf stanzas.
2013-12-14 15:44:39 -05:00
Michael Rash
46b5f2ecaf [server] added the ability to use FORCE_MASQUERADE to access.conf stanzas 2013-12-05 23:00:19 -05:00
Michael Rash
e0114e60c2 [server] Added FORCE_SNAT to access.conf stanzas.
Added FORCE_SNAT to the access.conf file so that per-access stanza SNAT
criteria can be specified for SPA access.
2013-12-04 21:52:07 -05:00