526 Commits

Author SHA1 Message Date
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
4c7679fabd [server] start on sudo usage for command exec (issue #159) 2015-07-02 23:44:16 -04:00
Michael Rash
464a680f13 [server] minor --udp-server option handling update for completeness 2015-06-30 17:44:07 -07:00
Michael Rash
ff052bf74f [server] disable external command execution in AFL fuzzing mode 2015-06-01 19:57:49 -07:00
Michael Rash
7bbc30f34c [server] bug fix for --key-gen being called inappropriately, add fw compiled string to -V 2015-06-01 05:27:27 -07:00
Michael Rash
85e07f99c4 man page updates 2015-05-22 15:31:18 -04:00
Michael Rash
de3bca2f9e handle key generation before config parsing 2015-05-20 09:47:51 -07:00
Michael Rash
ceb1713976 add --key-gen option to fwknopd (suggested by Jonathan Bennett) 2015-05-20 08:55:17 -07: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
3512f7f417 doc updates 2015-04-20 21:34:12 -04:00
Michael Rash
94af6172bb [server] minor -h usage update 2015-04-20 08:41:28 -07:00
Michael Rash
b2109f5630 [server] remove unncessary NULL check spotted by Coverity 2015-04-19 19:44:43 -07:00
Michael Rash
db80c81f66 Merge pull request #152 from Coacher/master
server: remove extra '/run' subdir from paths
2015-04-19 21:15:51 -04:00
Michael Rash
e39d34750b [server] switch from abs() to labs() for time difference calculation
This commit fixes the following warning during compilation on Mac OS X:

gcc -DHAVE_CONFIG_H -I. -I..  -I ../lib -I ../common -DSYSCONFDIR=\"/etc\" -DSYSRUNDIR=\"/var\"   -g -O2 -Wall -Wformat -Wformat-security -fstack-protector-all -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -MT fwknopd-incoming_spa.o -MD -MP -MF .deps/fwknopd-incoming_spa.Tpo -c -o fwknopd-incoming_spa.o `test -f 'incoming_spa.c' || echo './'`incoming_spa.c
incoming_spa.c:736:23: warning: absolute value function 'abs' given an argument of
      type 'long' but has parameter of type 'int' which may cause truncation of
      value [-Wabsolute-value]
            ts_diff = abs(now_ts - spadat.timestamp);
                      ^
incoming_spa.c:736:23: note: use function 'labs' instead
            ts_diff = abs(now_ts - spadat.timestamp);
                      ^~~
                      labs
1 warning generated.
2015-04-19 17:48:18 -07:00
Ilya Tumaykin
e333cba945 server: remove extra '/run' subdir from paths
Having extra '/run' subdirectory hardcoded into paths used for options
'digest-file', 'pid-file', 'run-dir' is counterintuitive and can lead to
bogus directory layouts when 'localstatedir' differs from the default
value.

For example, if 'localstatedir' is set to '/run', which is a common and
recommended substitute for /var/run in many distros nowadays, then
fwknop files will be placed under /run/run/fwknop.

This changeset removes extra '/run' subdirectory from all relevant paths
by changing DEF_RUN_DIR. Default value of 'localstatedir' is changed to
'/var/run' so users who relied on the previous behaviour won't have to
bother changing anything.

This is tested and works. Gentoo have this patch applied since 2.6.0.
2015-04-20 02:43:10 +03:00
Michael Rash
b1100cb730 [server] NAT validation only applies to systems running iptables or firewalld 2015-04-19 07:16:30 -07:00
Michael Rash
68db4b77a5 [server] allow FORWARD_ALL to control whether FORCE_NAT is required 2015-04-19 07:11:10 -07: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
c0f3ed38a8 [server] further error status simplication for firewalld 2015-04-14 08:15:03 -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
912c625e9e [server] remove DISABLE_DNAT exception for SPA packets that request a NAT operation - this is reserved for FORCE_NAT scenarios 2015-04-13 08:34:24 -07:00
Michael Rash
654f455ba6 Revert "[server] use 'success' string for firewalld as returned firewall-cmd for command success"
This reverts commit 1e33119b04a583fbf18b5b562edb14301a2ca7d6.
2015-04-12 15:49:19 -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
1e33119b04 [server] use 'success' string for firewalld as returned firewall-cmd for command success 2015-04-08 18:29: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
8010690039 [server] add missing #define's for firewalld 2015-04-06 11:47:07 -07:00
Michael Rash
c25f34e7a2 [server] update firewalld for FORWARD_ALL NAT operations 2015-04-06 01:24:55 -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
a18b3e9027 [server] minor code coverage update for firewalld systems 2015-03-29 18:15:11 -07:00
Michael Rash
ab5c000a32 [test suite] added afl-cmin scripts, and the main test suite configs are referenced 2015-03-20 16:09:40 -04:00
Michael Rash
59edf64d9c [server] consolidate fw creation, add FORWARD_ALL functionality 2015-03-07 20:09:31 -08:00
Michael Rash
cfd1cbf2bf [server] minor macro usage update for 127.0.0.2 2015-03-07 19:45:50 -08:00
Michael Rash
bf251034e3 [server] bug fix to exclude pcap.h only in --enable-udp-server mode
This commit fixes issue #143 on github reported by Coacher. The previous
commit introduced a build time error for non UDP server mode as seen
here:

https://paste.kde.org/pkaxwobwr
2015-02-18 19:37:37 -05:00
Michael Rash
1ce800446d [server] Bug fix to not include pcap.h in --enable-udp-server mode 2015-02-17 23:21:05 -08:00
Damien Stuart
987455b902 Remove commented out entries from the client and server Makefile.am. 2015-02-14 12:40:58 -05:00
Damien Stuart
b152d15970 Refactored how the cunit tests are processed so "make dist" does not fail and builds with c-unit-tests enabled work on systems with firewalld (added fw_util_firewalld.c for server tests). 2015-02-14 12:29:30 -05:00
Michael Rash
e8cfeaf772 Merge pull request #142 from fjoncourt/c_unit_testing
C unit testing - excellent, thank you Franck. I'll work on the relative path issue you mentioned as well.
2015-01-17 09:11:29 -05: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
Franck Joncourt
1c81aef39d Fixed file permissions 2014-12-31 09:51:08 +01:00
Michael Rash
1ece9d022b [server] consolidate create_chain() and add_jump_rule() into a single function 2014-12-30 10:42:31 -05:00
Franck Joncourt
b7ecb3334a Merge upstream changes to our changes 2014-12-28 15:00:24 +01:00
Michael Rash
9dc56d6bb7 [test suite / server] rule deletion/addition tests mid-cycle 2014-12-15 17:06:07 -08:00
Michael Rash
fd582487db [server] minor typo fix 2014-12-15 17:03:08 -08:00
Michael Rash
67f969f2c7 [server] compilation bug fix for firewalld platforms in DESTINATION processing code 2014-12-10 17:06:45 -08:00