Commit Graph

416 Commits

Author SHA1 Message Date
e3aeb468b6 Check for errors from inet_addr() with INADDR_NONE 2018-08-20 11:02:16 +02:00
c5994a34b7 Do not use INADDR_ANY for default ports 2018-08-20 11:02:16 +02:00
a2902cbc62 Terminate IPs resolved externally as expected 2018-08-20 11:02:15 +02:00
baed23c50c Use AF_INET instead of PF_INET
I believe it should be more portable this way, since AF_INET is required
to be present in <sys/socket.h> in POSIX.
2018-08-20 11:02:15 +02:00
17549b93be Use a more appropriate type for sd_len 2018-08-20 11:02:15 +02:00
82a5eec571 Constify 2018-08-20 11:02:15 +02:00
1a813bb2b8 Code cleanup 2018-08-20 11:02:15 +02:00
72a50b9c8e Use uppercase to log "IP" 2018-08-20 11:02:15 +02:00
2f6ea521ff Allow connecting to remote IPv6 hosts for TCP or UDP
This alone should allow interacting with IPv4 firewalling rules over
IPv6, for these two protocols.
2018-08-20 11:02:15 +02:00
b3494dcfc1 Migrate is_valid_ipv4_addr() to a more generic function
It is now called is_valid_ip_addr() and expects an additional parameter
for the address family.
2018-08-20 10:59:27 +02:00
a0dda67dfe Also catch the IPv6 version of INADDR_ANY 2018-08-20 10:59:27 +02:00
460bd8c672 Be more consistent when creating ~/.fwknoprc 2018-08-20 10:59:27 +02:00
b8252dbdb8 Let IPs resolve to IPv6 addresses over SSL
Again, this depends on the remote host to be actually supporting IPv6.
2018-08-20 10:59:27 +02:00
07693a9245 Let IPs resolve to IPv6 addresses
The remote code seems to be independent from the fwknop project though.
Until it will be capable to return IPv6 addresses, in itself this will
remain irrelevant for the purpose of adding IPv6 support to fwknop.

On another hand, it does help us introduce definitions and update
headers to actually support IPv6.
2018-08-20 10:59:27 +02:00
Michael Rash
799ec87765 [client] write --server-resolve-ipv4 arg to the rc file when saving 2018-08-11 09:42:20 -07:00
Michael Rash
6438771965 Merge pull request #273 from DeforaNetworks/khorben/http-1.1
Use HTTP/1.1 when communicating over HTTP
2018-08-09 04:51:45 -07:00
Michael Rash
71b8f22402 Merge pull request #282 from DeforaNetworks/khorben/execvp
Use execvp() instead of execvpe()
2018-08-08 17:05:55 -07:00
Michael Rash
d59c77a20b Revert "Fix two erroneous calls to strlcat()"
This reverts commit c412166aaa.
2018-08-07 23:35:34 -07:00
Michael Rash
c4f437f1dc Merge pull request #284 from DeforaNetworks/khorben/strlcat 2018-08-07 06:28:12 -04:00
c412166aaa Fix two erroneous calls to strlcat()
strlcat() needs to be informed about the actual size of the buffer. Two
calls simply used the size expected, thus potentially allowing
stack-based buffer overflows.

There is no direct security impact in this case, since the code affected
is on the client side, and the input comes from configuration
information.
2018-08-07 09:48:30 +02:00
Michael Rash
108290c6f3 Merge pull request #283 from DeforaNetworks/khorben/srandom
Seed random() at least a bit before using random()
2018-08-06 20:49:49 -04:00
Michael Rash
a6337ba054 Merge branch 'master' of ssh://github.com/mrash/fwknop 2018-08-06 20:41:09 -04:00
Michael Rash
bd30379313 doc update 2018-08-06 17:27:52 -07:00
f00d44deac Seed random() at least a bit before using random()
In fwknop, the values generated using random() are only used for the ID
field of raw IP packets. As indicated in the corresponding comments,
this value does not really matter, and it does not really have to be
random at all.

However, it should not hurt to initialize the entropy pool before
generating random values. arc4random() would be a better choice, but it
is not portable across the range of systems currently supported by
fwknop.
2018-08-06 19:20:35 +02:00
0b475ec7b3 Use execvp() instead of execvpe()
execvp() is (usually) equivalent to execvpe(), without enforcing any
change to the environment. However, unlike execvp(), execvpe() is not
standardized by POSIX, and may therefore not be available nor detected
when configuring the project (like on NetBSD).

No place could be found in fwknop to be using execvpe() and changing the
environment. Therefore it seems only logical (and safer) to use execvp()
instead.

This also updates the tests to reflect this change.
2018-08-06 12:04:45 +02:00
Michael Rash
ae089b1bad Merge pull request #280 from DeforaNetworks/khorben/connect-error-format 2018-07-25 18:42:29 -04:00
6d6a722128 Fix incomplete format string upon errors 2018-07-25 22:35:03 +02:00
8a1289cdc9 More consistent usage screens 2018-07-17 16:45:46 +02:00
adada04a20 Use HTTP/1.1 when using HTTP proxies
The "Connection" and "Host" fields were already always provided anyway.
2018-07-09 14:16:06 +02:00
148d6eba22 Use HTTP/1.1 when communicating over HTTP
The "Connection" and "Host" fields were already always provided anyway.
2018-07-09 14:12:23 +02:00
5228fe88d0 Avoid compilation warnings from ctype(3) helpers
Characters should be casted as unsigned before use in functions from
<ctype.h>. Otherwise the compiler treats 8-bit characters (eg UTF-8) as
negative values (since it expects signed integers) and they no longer
match the comparison tables. Worse, the character 0xff gets interpreted
as -1 (like EOF). In turn, it helps to explicitly cast the result as a
signed integer, since this is what is expected. Characters in the range
0x80-0xff do keep their original values.

See the manual page for ctype(3) for more details (eg from NetBSD)
2018-06-12 14:01:22 -04:00
1062021957 Fix typo in a comment 2018-04-25 03:48:24 +02:00
Michael Rash
2c5d7597a9 [client] minor comment update 2016-10-11 23:12:22 -04:00
Michael Rash
c06e8baa7e [client] exit() upon execvpe() error for wget execution 2016-10-11 23:04:25 -04:00
Jakub Wilk
2d7f5132aa Fix indefinite articles 2016-09-06 12:20:39 +02:00
Markus Gerstel
ea23648d02 Fix spelling error in documentation
Original patch by Franck Joncourt <franck@debian.org>
2016-08-22 22:05:06 +01:00
Michael Rash
779029e8bb doc update 2016-06-08 20:38:40 -04:00
Michael Rash
ae417e43bb recognize Jonathan as a core developer 2016-06-06 20:23:46 -04:00
Michael Rash
5f15119190 clarify GPL v2+ for the license per issue #222 2016-06-03 22:08:15 -04:00
Michael Rash
919156fdf0 apply doc updates to man pages 2016-05-28 09:29:34 -04:00
Michael Rash
74ddbf63b2 minor documentation updates 2016-05-27 23:15:39 -07:00
Jonathan Bennett
74d3515218 Removes a dead code path in client
A trio of checks were done two places, and the code path always went through both checks.
Since the program announced a fail and closed, the second set of checks could never be triggered.
2016-05-26 09:32:26 -05:00
Jonathan Bennett
ce0def7e18 Client: Only dump SPA data twice when --test and --verbose are used 2016-05-20 21:42:46 -05:00
Michael Rash
8334473887 Merge pull request #219 from oneru/test-suite 2016-05-14 23:19:17 -04:00
Jonathan Bennett
f50b5c6e99 Tightens nat access validation in client 2016-05-14 00:47:05 -05:00
Michael Rash
60a9cc203b Merge branch 'master' of ssh://192.168.10.1/home/mbr/git/fwknop 2016-05-11 22:05:20 -07:00
Michael Rash
ba5f5e2424 add sha3_256 sha3_512 to man page docs 2016-05-12 22:23:54 -04:00
Jonathan Bennett
dc9ad5de4a Adds a length modifier to is_valid_ipv4_addr 2016-05-07 21:59:48 -05:00
Michael Rash
d4ec9a0755 remove execute bit from file permissions 2016-05-07 09:14:30 -04:00
Jonathan Bennett
58bce15b1e Exclude the CUnit tests themselves from lcov 2016-05-02 13:17:03 -05:00