Commit Graph

662 Commits

Author SHA1 Message Date
wiz 8e1346dbb3 Remove superfluous Li; rename section to match standards. 2019-07-23 14:28:24 +00:00
ozaki-r f9e037adf1 setkey: document getspi and update 2019-07-23 04:32:06 +00:00
ozaki-r 8e5aa2c9b8 setkey: enable to use the getspi API
If a specified SPI is not zero, tell the kernel to use the SPI by using
SADB_EXT_SPIRANGE.  Otherwise, the kernel picks a random SPI.

It enables to mimic racoon.
2019-07-23 04:30:32 +00:00
mrg cf075e4cab mark promisc() __dead - it never returns. 2019-02-03 10:23:42 +00:00
ozaki-r 16fc099a65 Use Cm instead of Li or Ar for fixed command strings 2018-11-19 04:54:37 +00:00
maxv f1c81f6829 Remove dead files that have never been built, and likely can't build since
they are not correct C files.
2018-10-14 08:36:09 +00:00
maxv 0fe8cb7566 Clean up setkey: remove dead wood, KNF, localify, and slightly improve. 2018-10-14 08:27:39 +00:00
maxv 7666e47285 Fix SF#24: incorrect authentication algorithms, copy-pasto. 2018-10-13 15:38:28 +00:00
maxv 2be45af163 Fix ticket SF#91: pass the correct size for tbuf. 2018-10-13 15:17:45 +00:00
maxv 05d534bebd Reduce the diff against the latest release. Also remove netbsd-import.sh,
since we are upstream now.
2018-10-13 15:08:51 +00:00
christos 52b4b66650 From Thomas Reim:
Current racoon code cannot detect duplicate last fragments as it uses
the fragment flag instead of the fragment number.

The code does not consider that the IKE payload fragments might not be
received in the correct order. In this case, packet complete detection
will again fail and VPN clients abandoned from VPN service.
Nevertheless, clients still can add fragments to the fragment queue and
fill it up to the possible 255 fragments. Only duplicates are detected,
but not the fragments with a number greater than the last fragment
number.

The last fragment number is kept in the Phase 1 handler
after fragment queue deletion, which may lead to error notifications
after succesful reassembly of the IKE phase 1 message.

In general, the 2017's CVE fix added laconic and difficult to understand
failure notifications, which do not much help for analysis, why a VPN
client was blocked by racoon server.

This patch fixes the code and aligns it to Microsoft/Cisco IKE
fragmentation specification. It provides error logging which is in line
with above specification and adds some debug info to the logs to better
support analysis VPN client blackballing.

XXX: pullup-8
2018-10-05 20:12:37 +00:00
christos 451f4db714 PR/53646: Thomas Reim: Incorrect detection of the packet complete code in
fragment list check.

While the fix in https://launchpad.net/~rdratlos/+archive/ubuntu/racoon

	- if (i > last_frag) /* It is complete */
	+ if (i >= last_frag) /* It is complete */

has the correct behavior, it violates the test for successful
completion of the invariant of the loop:

    for (i = 1; i <= last_frag; i++) {
	if (!check_fragment_index())
	    break;
    }
    if (i > last_frag)
	return ok;

It is better to move the check for NULL in the loop earlier, so that
the final iteration is done and the test is kept the same. It makes
the code easier to understand and preserves the original intent.

XXX: pullup-8
2018-10-02 18:49:24 +00:00
maxv c1cd5851ce Remove dead references to netinet6/ipsec.h. 2018-09-06 09:54:36 +00:00
maxv 6890048b2b sync with reality 2018-09-06 09:38:05 +00:00
christos 85196978fc fix memory leaks: https://github.com/NetBSD/src/issues/6 2018-08-28 09:10:28 +00:00
maxv 9cc33dc2c2 drop __P, suggested by sevan 2018-05-28 20:45:38 +00:00
maxv 02ed4ce0ae drop __P, suggested by sevan 2018-05-28 20:34:45 +00:00
maxv d5ded68d11 fix -Wold-style-definition 2018-05-28 19:52:18 +00:00
maxv a8c2f61e83 Remove ipsec_bindump, there is no prototype, so the function can't be used. 2018-05-28 19:39:21 +00:00
maxv ff1d84b094 fix -Wdiscarded-qualifiers 2018-05-28 19:36:42 +00:00
maxv abcef802a2 fix -Wunused and -Wold-style-definition 2018-05-28 19:22:40 +00:00
maxv df9d65850f Add a note about FreeBSD. 2018-05-20 09:14:18 +00:00
maxv dc0ca504c7 Update, after ten years. Importantly, add a "History" section, to explain
what's going on.

We have now become "upstream", and most of the ipsec-tools development is
done in NetBSD's CVS. However, many distributions still take their
tarballs from SourceForge (which is defunct, and not maintained).
2018-05-20 08:55:25 +00:00
maxv 4eb599a9b3 Style. 2018-05-20 06:15:45 +00:00
maxv 79383b8281 Remove dead code, and style. 2018-05-19 20:40:40 +00:00
maxv e2ff693411 Remove unused 'error' variables, it's obvious they should have no use. 2018-05-19 20:21:23 +00:00
maxv 165b31ce96 Use strict prototypes, when they don't introduce more warnings than they fix.
Also localify a few functions.
2018-05-19 20:14:56 +00:00
maxv abe88a07be Remove unused labels, functions, and function prototypes. 2018-05-19 19:47:47 +00:00
maxv 78d5ecb35f More unused variables. 2018-05-19 19:32:16 +00:00
maxv ff699fb469 Remove unused variables. 2018-05-19 19:23:15 +00:00
maxv 253ae9a65a Style, a little... 2018-05-19 18:51:59 +00:00
christos e24b32683b Avoid double frees (thanks asan) 2018-04-01 22:59:57 +00:00
christos 7b335de413 make debugrm compile again. 2018-04-01 22:35:22 +00:00
christos 5ff0fb825b Welcome to the 21st century Buck Rogers: OpenSSL-1.1 2018-02-07 03:59:03 +00:00
knakahara cbf21dcddc fix typo. (does not affect actual operation, but confuses reader...)
The function is called when racoon receives SADB_X_MIGRATE pfkey message,
however the message is not used now. It was compatible code for KAME.
2017-11-09 08:34:50 +00:00
christos afbc9755de PR/51682: Antoine Beaupré: Simplify and comment previous patch.
XXX: pullup-8
2017-07-23 05:40:27 +00:00
ozaki-r a607076325 Add update command for testing
Updating an SA (SADB_UPDATE) requires that a process issuing
SADB_UPDATE is the same as a process issued SADB_ADD (or SADB_GETSPI).
This means that update command must be used with add command in a
configuration of setkey. This usage is normally meaningless but
useful for testing (and debugging) purposes.
2017-07-05 01:22:40 +00:00
christos 8277ddc197 PR/52292: Shinichi Doyashiki: Fix reversed comments. 2017-06-11 22:12:56 +00:00
ozaki-r 6aaeb7bc8b Print protocol number as well as its name
ex.) before: "reserved" -> after: "255(reserved)"

The original author is hsuenaga@IIJ
2017-04-26 03:19:49 +00:00
ozaki-r 2ea60f03d0 Correct the length of the SADB_EXT header in debug outputs
The length is shifted 3 bits in PF_KEY protocol.

Originally fixed by hsuenaga@IIJ
2017-04-26 03:16:06 +00:00
ozaki-r e27c60ccce Fix parsing ah without a key 2017-04-13 01:19:17 +00:00
roy fcede00eff Use RO_MSGFILTER. 2017-04-12 16:47:39 +00:00
christos 7e9937c7a6 PR/51682: Avoid DoS with fragment out of order insertion; keep fragments
sorted in the list.
2017-01-24 19:23:31 +00:00
christos 8cf4c21bed CID 1356385: Add fallthrough comment 2016-03-16 21:09:39 +00:00
christos a8a1a8c522 PR/50943: David Binderman: Fix misplaced parenthesis. 2016-03-11 18:28:43 +00:00
christos 71f53a526c From Frank Wille:
Request "IKE mode config" in "rsasig" (certificates on both sides only)
authentication mode, if "mode_cfg" is configured to "on".
Tested with a Lancom router, using the following configuration:

path include "/etc/racoon";
path certificate "/etc/racoon/certs";
path script "/etc/racoon/scripts";

remote "wpsd"
{
    remote_address 1.2.3.4;
    exchange_mode main,base;

    my_identifier asn1dn;
    certificate_type x509 "vpnclient15.crt" "vpnclient15.key";
    ca_type x509 "ca.crt";

    mode_cfg on;
    dpd_delay 20;
    nat_traversal on;
    lifetime time 8 hour;
    script "phase1-up.sh" phase1_up;
    script "phase1-down.sh" phase1_down;

    proposal {
        encryption_algorithm aes;
        hash_algorithm md5;
        authentication_method rsasig;
        dh_group 2;
    }
    proposal_check obey;
}

sainfo anonymous
{
    pfs_group 2;
    lifetime time 8 hour;
    encryption_algorithm aes;
    authentication_algorithm hmac_md5;
    compression_algorithm deflate;
}
2016-03-09 22:27:17 +00:00
christos d2bf8aa2c7 PR/50918: David Binderman: Fix memory leak 2016-03-09 15:58:25 +00:00
christos f91581fb8e PR/50815: David Binderman: Remove dup test 2016-02-17 20:11:17 +00:00
christos e0b253ee23 Detect error earlier to avoid memory leak.
XXX: pullup-7
2015-05-19 15:16:00 +00:00
christos 58416d2a6d Protect against a NULL pointer dereference described in:
https://www.altsci.com/ipsec/

XXX: pullup-7
2015-05-19 15:14:25 +00:00