strongswan.git
4 years agostroke: Change how CA certificates are stored
Tobias Brunner [Thu, 20 Aug 2015 13:29:33 +0000 (15:29 +0200)]
stroke: Change how CA certificates are stored

Since 11c14bd2f5 CA certificates referenced in ca sections were
enumerated by two credential sets if they were also stored in
ipsec.d/cacerts.  This caused duplicate certificate requests to
get sent.  All CA certificates, whether loaded automatically or
via a ca section, are now stored in stroke_ca_t.

Certificates referenced in ca sections are now also reloaded
when `ipsec rereadcacerts` is used.

4 years agostroke: Combine CA certificate load methods
Tobias Brunner [Thu, 20 Aug 2015 08:22:50 +0000 (10:22 +0200)]
stroke: Combine CA certificate load methods

Also use the right credential set for CA cert references loaded from
stroke_ca_t.

4 years agostroke: Atomically replace CA and AA certificates when reloading them
Tobias Brunner [Thu, 20 Aug 2015 08:08:08 +0000 (10:08 +0200)]
stroke: Atomically replace CA and AA certificates when reloading them

Previously it was possible that certificates were not found between the
time the credential sets were cleared and the certificates got readded.

4 years agomem-cred: We don't need a write lock when looking for a certificate
Tobias Brunner [Thu, 20 Aug 2015 13:11:02 +0000 (15:11 +0200)]
mem-cred: We don't need a write lock when looking for a certificate

4 years agomem-cred: Add a method to atomically replace all certificates
Tobias Brunner [Thu, 20 Aug 2015 07:39:15 +0000 (09:39 +0200)]
mem-cred: Add a method to atomically replace all certificates

4 years agoikev1: Fix handling of overlapping Quick Mode exchanges
Tobias Brunner [Wed, 19 Aug 2015 13:28:02 +0000 (15:28 +0200)]
ikev1: Fix handling of overlapping Quick Mode exchanges

In some cases the third message of a Quick Mode exchange might arrive
after the first message of a subsequent Quick Mode exchange.  Previously
these messages were handled incorrectly and the second Quick Mode
exchange failed.

Some implementations might even try to establish multiple Quick Modes
simultaneously, which is explicitly allowed in RFC 2409.  We don't fully
support that, though, in particular in case of retransmits.

Fixes #1076.

4 years agokernel-pfkey: Add support for AES-GCM
Tobias Brunner [Wed, 29 Jul 2015 09:23:34 +0000 (11:23 +0200)]
kernel-pfkey: Add support for AES-GCM

The next release of FreeBSD will support this.

While Linux defines constants for AES-GCM in pfkeyv2.h since 2.6.25 it
does not actually support it.  When SAs are installed via PF_KEY only a
lookup in XFRM's list of encryption algorithms is done, but AES-GCM is in
a different table for AEAD algorithms (there is currently no lookup
function to find algorithms in that table via PF_KEY identifier).

4 years agoauth-cfg: Don't enforce EAP_DYNAMIC
Tobias Brunner [Thu, 20 Aug 2015 16:35:23 +0000 (18:35 +0200)]
auth-cfg: Don't enforce EAP_DYNAMIC

We now store the actual method on the auth config, which won't match
anymore if rightauth=eap-dynamic is configured.

4 years agoikev2: Compare initiator flag again, partially reverts 17ec1c74de
Tobias Brunner [Wed, 19 Aug 2015 14:47:45 +0000 (16:47 +0200)]
ikev2: Compare initiator flag again, partially reverts 17ec1c74de

We should ignore messages that have the flag set incorrectly.
This restores RFC compliance which was broken since the mentioned commit.

4 years agoikev2: Drop IKE_SA_INIT messages that don't have the initiator flag set
Tobias Brunner [Wed, 10 Jun 2015 13:53:08 +0000 (15:53 +0200)]
ikev2: Drop IKE_SA_INIT messages that don't have the initiator flag set

While this doesn't really create any problems it is not 100% correct to
accept such messages because, of course, the sender of an IKE_SA_INIT
request is always the original initiator of an IKE_SA.

We currently don't check the flag later, so we wouldn't notice if the
peer doesn't set it in later messages (ike_sa_id_t.equals doesn't
compare it anymore since we added support for IKEv1, in particular since
17ec1c74de).

4 years agoikev1: Pass current auth-cfg when looking for key to determine auth method
Tobias Brunner [Wed, 19 Aug 2015 15:25:30 +0000 (17:25 +0200)]
ikev1: Pass current auth-cfg when looking for key to determine auth method

If multiple certificates use the same subjects we might choose the wrong
one otherwise. This way we use the one referenced with leftcert and
stored in the auth-cfg and we actually do the same thing later in the
pubkey authenticator.

Fixes #1077.

4 years agoikev2: Store outer EAP method used to authenticate remote peer in auth-cfg
Tobias Brunner [Mon, 8 Jun 2015 14:52:03 +0000 (16:52 +0200)]
ikev2: Store outer EAP method used to authenticate remote peer in auth-cfg

This allows symmetric configuration of EAP methods (i.e. the same value
in leftauth and rightauth) when mutual EAP-only authentication is used.
Previously the client had to configure rightauth=eap or rightauth=any,
which prevented it from using this same config as responder.

4 years agoimc: get_default_pwd_status(), as it currently is, works on Windows too
Tobias Brunner [Wed, 19 Aug 2015 10:10:09 +0000 (12:10 +0200)]
imc: get_default_pwd_status(), as it currently is, works on Windows too

This fixes the build on Windows.

4 years agoike: Use the original port when remote resolves to %any
Tobias Brunner [Tue, 18 Aug 2015 15:35:39 +0000 (17:35 +0200)]
ike: Use the original port when remote resolves to %any

When reestablishing the IKE_SA we should still use the original port
when right resolves to %any as some implementations might not like
initial IKE messages on port 4500 (especially for IKEv1).

4 years agotesting: Add ikev2/trap-any scenario
Tobias Brunner [Thu, 16 Jul 2015 10:53:18 +0000 (12:53 +0200)]
testing: Add ikev2/trap-any scenario

4 years agotrap-manager: Enable auto=route with right=%any for transport mode connections
Tobias Brunner [Tue, 30 Oct 2012 08:10:05 +0000 (09:10 +0100)]
trap-manager: Enable auto=route with right=%any for transport mode connections

Fixes #196.

4 years agoVersion bump to 5.3.3dr6 5.3.3dr6
Andreas Steffen [Wed, 19 Aug 2015 05:18:30 +0000 (07:18 +0200)]
Version bump to 5.3.3dr6

4 years agoExtend HCD attribute data for tnc/tnccs-20-hcd-eap scenario
Andreas Steffen [Mon, 17 Aug 2015 15:56:39 +0000 (17:56 +0200)]
Extend HCD attribute data for tnc/tnccs-20-hcd-eap scenario

4 years agoAdded reason string support to HCD IMV
Andreas Steffen [Mon, 17 Aug 2015 15:37:52 +0000 (17:37 +0200)]
Added reason string support to HCD IMV

4 years agoFixed patches format delimited by CR/LF
Andreas Steffen [Tue, 4 Aug 2015 19:43:49 +0000 (21:43 +0200)]
Fixed patches format delimited by CR/LF

4 years agoAdded imc-hcd attributes to strongswan.conf
Andreas Steffen [Mon, 27 Jul 2015 07:43:40 +0000 (09:43 +0200)]
Added imc-hcd attributes to strongswan.conf

4 years agotesting: Added tnc/tnccs-20-hcd-eap scenario
Andreas Steffen [Sun, 26 Jul 2015 09:57:39 +0000 (11:57 +0200)]
testing: Added tnc/tnccs-20-hcd-eap scenario

4 years agoUse PWG HCD PA-TNC subtypes to transport HCD attributes
Andreas Steffen [Sun, 26 Jul 2015 09:41:08 +0000 (11:41 +0200)]
Use PWG HCD PA-TNC subtypes to transport HCD attributes

4 years agoAdd default password determination capability to os_info
Andreas Steffen [Sun, 26 Jul 2015 09:38:06 +0000 (11:38 +0200)]
Add default password determination capability to os_info

4 years agoReintroduced ietf_attr_fwd_enabled()
Andreas Steffen [Fri, 24 Jul 2015 14:49:31 +0000 (16:49 +0200)]
Reintroduced ietf_attr_fwd_enabled()

4 years agoDefined PWG HCD PA-TNC subtypes
Andreas Steffen [Wed, 17 Jun 2015 09:18:37 +0000 (11:18 +0200)]
Defined PWG HCD PA-TNC subtypes

4 years agoAdded os_info support to HCD IMC
Andreas Steffen [Wed, 27 May 2015 08:19:31 +0000 (10:19 +0200)]
Added os_info support to HCD IMC

4 years agoSubscribed Scanner IMC/IMV to IETF_FIREWALL PA subtype
Andreas Steffen [Sun, 24 May 2015 07:36:16 +0000 (09:36 +0200)]
Subscribed Scanner IMC/IMV to IETF_FIREWALL PA subtype

4 years agotesting: enable HCD IMC and IMV
Andreas Steffen [Sun, 24 May 2015 06:56:27 +0000 (08:56 +0200)]
testing: enable HCD IMC and IMV

4 years agoImplemented HCD IMC and IMV
Andreas Steffen [Thu, 21 May 2015 20:01:32 +0000 (22:01 +0200)]
Implemented HCD IMC and IMV

4 years agoDefined HCD PA subtype in PWG namespace
Andreas Steffen [Wed, 20 May 2015 10:26:23 +0000 (12:26 +0200)]
Defined HCD PA subtype in PWG namespace

4 years agoCompleted implementation of PWG HCD attributes
Andreas Steffen [Mon, 18 May 2015 14:40:27 +0000 (16:40 +0200)]
Completed implementation of PWG HCD attributes

4 years agoDefined generic non-nul terminated string PA-TNC attribute
Andreas Steffen [Sun, 17 May 2015 16:16:08 +0000 (18:16 +0200)]
Defined generic non-nul terminated string PA-TNC attribute

4 years agoSupport of HCD Firewall Setting PA-TNC attribute
Andreas Steffen [Sun, 17 May 2015 15:04:46 +0000 (17:04 +0200)]
Support of HCD Firewall Setting PA-TNC attribute

4 years agoDefined generic boolean PA-TNC attribute
Andreas Steffen [Sun, 17 May 2015 06:41:59 +0000 (08:41 +0200)]
Defined generic boolean PA-TNC attribute

4 years agoDefined PWG HCD IF-M attributes
Andreas Steffen [Sat, 16 May 2015 20:44:40 +0000 (22:44 +0200)]
Defined PWG HCD IF-M attributes

4 years agoFixed the implemention of the IF-M segmentation protocol
Andreas Steffen [Tue, 18 Aug 2015 18:25:26 +0000 (20:25 +0200)]
Fixed the implemention of the IF-M segmentation protocol

The first segment only fit if the segmentation envelope attribute
was preceded by a Max Attribute Size Response attribute. The
improved implementation fills up the first PA-TNC message with
the first segment up to the maximum message size.

4 years agokernel-netlink: Avoid route dump if routing rule excludes traffic with a certain...
Tobias Brunner [Wed, 5 Aug 2015 14:51:38 +0000 (16:51 +0200)]
kernel-netlink: Avoid route dump if routing rule excludes traffic with a certain mark

If the routing rule we use to direct traffic to our own routing table
excludes traffic with a certain mark (fwmark = !<mark>) we can simplify
the route lookup and avoid dumping all routes by passing the mark to the
request.  That way our own routes are ignored and we get the preferred
route back without having to dump and analyze all routes, which is quite a
burden on hosts with lots of routes.

4 years agoinclude: Update (rt)netlink.h to the latest UAPI version
Tobias Brunner [Wed, 5 Aug 2015 14:46:37 +0000 (16:46 +0200)]
include: Update (rt)netlink.h to the latest UAPI version

4 years agosql: Also do a reversed ID match
Tobias Brunner [Mon, 27 Jul 2015 17:16:08 +0000 (19:16 +0200)]
sql: Also do a reversed ID match

This is required for the case where IDr is not sent (i.e. is %any).
The backend manager does the same.

Fixes #1044.

4 years agoha: Recreate the control FIFO if the file exists but is not a FIFO
Tobias Brunner [Thu, 13 Aug 2015 12:37:15 +0000 (14:37 +0200)]
ha: Recreate the control FIFO if the file exists but is not a FIFO

This may happen if something like `echo ... > /path/to/fifo` is used
before the plugin was able to create the FIFO. In that case we'd end
up in a loop always reading the same values from the static file.

4 years agoikev1: Assume a default key length of 128-bit for AES-CBC
Tobias Brunner [Thu, 13 Aug 2015 16:54:34 +0000 (18:54 +0200)]
ikev1: Assume a default key length of 128-bit for AES-CBC

Some implementations don't send a Key Length attribute for AES-128.
This was allowed for IKE in early drafts of RFC 3602, however, some
implementations also seem to do it for ESP, where it never was allowed.
And the final version of RFC 3602 demands a Key Length attribute for both
phases so they shouldn't do it anymore anyway.

Fixes #1064.

4 years agoauth-cfg: Matching one CA should be enough, similar to peer certificates
Tobias Brunner [Mon, 3 Aug 2015 11:55:36 +0000 (13:55 +0200)]
auth-cfg: Matching one CA should be enough, similar to peer certificates

Not sure if defining multiple CA constraints and enforcing _all_ of them,
i.e. the previous behavior, makes even sense.  To ensure a very specific
chain it should be enough to define the last intermediate CA.  On the
other hand, the ability to define multiple CAs could simplify configuration.

This can currently only be used with swanctl/VICI based configs as `rightca`
only takes a single DN.

4 years agovici: Add option to disable policy installation for CHILD_SAs
Tobias Brunner [Wed, 5 Aug 2015 09:01:10 +0000 (11:01 +0200)]
vici: Add option to disable policy installation for CHILD_SAs

4 years agochild-sa: Fix refcounting of allocated reqids
Tobias Brunner [Fri, 31 Jul 2015 14:51:35 +0000 (16:51 +0200)]
child-sa: Fix refcounting of allocated reqids

During a rekeying we want to reuse the current reqid, but if the new SA
does not allocate it via kernel-interface the state there will disappear
when the old SA is destroyed after the rekeying.  When the IKE_SA is
later reauthenticated with make-before-break reauthentication the new
CHILD_SAs there will get new reqids as no existing state is found in the
kernel-interface, breaking policy installation in the kernel.

Fixes: a49393954f31 ("child-sa: Use any fixed reqid configured on the CHILD_SA config")

4 years agoidentification: Remove unused ID_USER_ID type
Tobias Brunner [Fri, 31 Jul 2015 15:14:44 +0000 (17:14 +0200)]
identification: Remove unused ID_USER_ID type

4 years agoman: Clarify identity parsing and identity type prefixes
Tobias Brunner [Mon, 20 Jul 2015 13:27:57 +0000 (15:27 +0200)]
man: Clarify identity parsing and identity type prefixes

References #1028.

4 years agopki: Add --dn command to extract the subject DN of a certificate
Tobias Brunner [Thu, 6 Aug 2015 16:04:38 +0000 (18:04 +0200)]
pki: Add --dn command to extract the subject DN of a certificate

4 years agoscripts: Add script to extract the ASN.1 subject DN from a certificate
Tobias Brunner [Fri, 17 Jul 2015 09:46:16 +0000 (11:46 +0200)]
scripts: Add script to extract the ASN.1 subject DN from a certificate

This can be useful if the subject DN has to be configured with the
asn1dn: prefix in ipsec.conf (e.g. because the actual encoding can't be
created by strongSwan's string parser/encoder).

4 years agoplugin-feature: Add vendor specific EAP method registration macros
Tobias Brunner [Thu, 25 Jun 2015 15:41:09 +0000 (17:41 +0200)]
plugin-feature: Add vendor specific EAP method registration macros

Vendor specific EAP methods may be registered with:

    PLUGIN_CALLBACK(eap_method_register, <constructor>),
        PLUGIN_PROVIDE(EAP_SERVER_VENDOR, <type>, <vendor>),

Same for client implementations via EAP_PEER_VENDOR.

References #969.

4 years agoeap-radius: Use Framed-IPv6-Address attributes to send IPv6 VIPs in accounting messages
Tobias Brunner [Mon, 29 Jun 2015 08:43:19 +0000 (10:43 +0200)]
eap-radius: Use Framed-IPv6-Address attributes to send IPv6 VIPs in accounting messages

This attribute is more appropriate for single IPv6 virtual IPs than the
Framed-IPv6-Prefix attribute.

Fixes #1001.

4 years agoeap-radius: Add support for some basic IPv6-specific RADIUS attributes
Tobias Brunner [Mon, 22 Jun 2015 09:36:15 +0000 (11:36 +0200)]
eap-radius: Add support for some basic IPv6-specific RADIUS attributes

These are defined in RFC 6911.

Fixes #1001.

4 years agoutils: Check for dirfd(3)
Tobias Brunner [Tue, 4 Aug 2015 17:17:37 +0000 (19:17 +0200)]
utils: Check for dirfd(3)

Not all POSIX compatible systems might provide it yet.  If not, we close
the lowest FD to close and hope it gets reused by opendir().

4 years agoutils: Directly use syscall() to close open FDs in closefrom()
Tobias Brunner [Thu, 11 Jun 2015 10:19:56 +0000 (12:19 +0200)]
utils: Directly use syscall() to close open FDs in closefrom()

This avoids any allocations, since calling malloc() after fork() is
potentially unsafe.

Fixes #990.

4 years agoutils: Don't use directory enumerator to close open FDs in closefrom()
Tobias Brunner [Tue, 4 Aug 2015 12:43:26 +0000 (14:43 +0200)]
utils: Don't use directory enumerator to close open FDs in closefrom()

Calling malloc() after fork() is potentially unsafe, so we should avoid
it if possible.  opendir() will still require an allocation but that's
less than the variant using the enumerator wrapper, thus, decreasing
the conflict potential.  This way we can also avoid closing the
FD for the enumerated directory itself.

References #990.

4 years agoMerge branch 'vici-updown'
Tobias Brunner [Mon, 17 Aug 2015 09:13:37 +0000 (11:13 +0200)]
Merge branch 'vici-updown'

Documents the ike/child-updown events and adds a ike/child-rekey event
and a new listen() method in the Python VICI bindings to listen for
arbitrary events (similar to the listen_events() method in the Ruby
bindings).

4 years agovici: Add listen methods to receive arbitrary events in Python library
Tobias Brunner [Thu, 6 Aug 2015 12:51:21 +0000 (14:51 +0200)]
vici: Add listen methods to receive arbitrary events in Python library

4 years agovici: Move event (un-)registration to a helper method in Python library
Tobias Brunner [Thu, 6 Aug 2015 12:41:54 +0000 (14:41 +0200)]
vici: Move event (un-)registration to a helper method in Python library

Also make sure events are unregistered in case of exceptions in
streamed_request().

4 years agovici: Add ike/child-rekey events
Tobias Brunner [Mon, 1 Jun 2015 13:36:21 +0000 (15:36 +0200)]
vici: Add ike/child-rekey events

4 years agovici: Document the ike/child-updown events
Tobias Brunner [Fri, 29 May 2015 16:43:15 +0000 (18:43 +0200)]
vici: Document the ike/child-updown events

4 years agovici: Don't include a child-sas section in ike-updown event
Tobias Brunner [Fri, 29 May 2015 16:38:47 +0000 (18:38 +0200)]
vici: Don't include a child-sas section in ike-updown event

This makes it clearer that only the data concerning the IKE_SA is
transmitted (there could be CHILD_SAs e.g. during IKEv1
reauthentication).

4 years agovici: Explicitly notify listeners of the type of ike/child-updown event
Tobias Brunner [Fri, 29 May 2015 16:38:28 +0000 (18:38 +0200)]
vici: Explicitly notify listeners of the type of ike/child-updown event

4 years agoVersion bump to 5.3.3dr5 5.3.3dr5
Andreas Steffen [Sun, 16 Aug 2015 07:04:42 +0000 (09:04 +0200)]
Version bump to 5.3.3dr5

4 years agoFixed AR identities in mutual TNC measurements case
Andreas Steffen [Sat, 15 Aug 2015 20:46:21 +0000 (22:46 +0200)]
Fixed AR identities in mutual TNC measurements case

4 years agokernel-pfroute: Don't install virtual IPs if charon.install_virtual_ip is disabled
Tobias Brunner [Thu, 13 Aug 2015 13:52:50 +0000 (15:52 +0200)]
kernel-pfroute: Don't install virtual IPs if charon.install_virtual_ip is disabled

4 years agoload-tester: Include string.h for strcmp() on some platforms
Tobias Brunner [Thu, 13 Aug 2015 13:10:34 +0000 (15:10 +0200)]
load-tester: Include string.h for strcmp() on some platforms

4 years agoInitialize variables that some compilers seem to warn about
Tobias Brunner [Thu, 13 Aug 2015 13:09:00 +0000 (15:09 +0200)]
Initialize variables that some compilers seem to warn about

4 years agoFixed some typos
Tobias Brunner [Thu, 13 Aug 2015 13:03:50 +0000 (15:03 +0200)]
Fixed some typos

4 years agokernel-netlink: When adding a policy do an update if it already exists
Tobias Brunner [Wed, 3 Jun 2015 15:31:30 +0000 (17:31 +0200)]
kernel-netlink: When adding a policy do an update if it already exists

This may be the case when SAs are reestablished after a crash of the
IKE daemon.

We could actually always do updates.  The kernel doesn't care, the only
difference is the possible EEXIST if XFRM_MSG_NEWPOLICY is used.  The
advantage of not doing this, though, is that we get a warning in the log
if a policy already exists, as that should usually not be the case.

4 years agokernel-pfkey: When adding policies do an update if they already exist
Tobias Brunner [Wed, 3 Jun 2015 15:17:15 +0000 (17:17 +0200)]
kernel-pfkey: When adding policies do an update if they already exist

This may be the case when SAs are reestablished after a crash of the
IKE daemon.

4 years agopki: Optionally extract public key from given private key in --issue
Tobias Brunner [Tue, 7 Jul 2015 08:53:22 +0000 (10:53 +0200)]
pki: Optionally extract public key from given private key in --issue

Fixes #618.

4 years agoconf: Clarify resolution for two time settings
Tobias Brunner [Mon, 10 Aug 2015 10:01:24 +0000 (12:01 +0200)]
conf: Clarify resolution for two time settings

Fixes #1061.

4 years agoVersion bump to 5.3.3dr4 5.3.3dr4
Andreas Steffen [Mon, 10 Aug 2015 05:48:14 +0000 (07:48 +0200)]
Version bump to 5.3.3dr4

4 years agoidentification: Use UTF8String instead of the legacy T61String to encode DNs
Tobias Brunner [Thu, 11 Jun 2015 15:43:49 +0000 (17:43 +0200)]
identification: Use UTF8String instead of the legacy T61String to encode DNs

When strings in RDNs contain characters outside the character set for
PrintableString use UTF8String as the passed string is most likely in
that encoding (RFC 5280 actually recommends to use only those two
string types).

4 years agowhitelist: Use hash() method so DNs with different string types match
Tobias Brunner [Thu, 11 Jun 2015 15:40:10 +0000 (17:40 +0200)]
whitelist: Use hash() method so DNs with different string types match

strongSwan uses PrintableString when encoding DNs from strings (if the
character set permits it, otherwise T61String is currently used) but
certificates might be encoded with UTF8String even for simple ASCII strings.
By ignoring this string type when hashing RDNs we make sure the same hash
results in this case as long as the actual string values are the same.

Fixes #991.

4 years agoidentification: Add hash() method
Tobias Brunner [Thu, 11 Jun 2015 15:38:46 +0000 (17:38 +0200)]
identification: Add hash() method

Compared to hashing the encoding we can ignore string types of RDNs when
hashing DNs, making hash() compatible to equals() that does the same.

Fixes #991.

4 years agopkcs11: Fix encoding of RSA keys if unnecessarily zero prefixed
Tobias Brunner [Thu, 2 Jul 2015 13:58:01 +0000 (15:58 +0200)]
pkcs11: Fix encoding of RSA keys if unnecessarily zero prefixed

Some tokens/libraries seem to prefix all numbers with zero bytes even
if not necessary (e.g. the default exponent 0x010001).  If we don't fix
that, the fingerprints calculated based on the retrieved values will be
incorrect.

Even if the pkcs1 plugin can properly handle numbers that are not in
two's complement since a81bd670b086 ("Added PUBKEY_RSA_MODULUS
encoding type") we prefix them with zero if necessary as other encoders
might expect them in two's complement.

Fixes #1012.

4 years agoupdown: Pass virtual IPs assigned to a peer to the updown script
Tobias Brunner [Thu, 25 Jun 2015 15:19:12 +0000 (17:19 +0200)]
updown: Pass virtual IPs assigned to a peer to the updown script

Previously only received virtual IPs were available.

References #1008.

4 years agoeap-radius: Don't send RADIUS Accounting Start messages twice
Tobias Brunner [Tue, 2 Jun 2015 13:18:52 +0000 (15:18 +0200)]
eap-radius: Don't send RADIUS Accounting Start messages twice

If a client does Mode Config during reauthentication the assign_vips()
event might be triggered twice, we should not send another Start message
in that case.

Fixes #937.

4 years agoeap-radius: Change trigger for Accounting Start messages for IKEv1
Tobias Brunner [Tue, 2 Jun 2015 12:48:31 +0000 (14:48 +0200)]
eap-radius: Change trigger for Accounting Start messages for IKEv1

Some clients won't do Mode Config or XAuth during reauthentication.
Because Start messages previously were triggered by TRANSACTION exchanges
none were sent for new SAs of such clients, while Stop messages were still
sent for the old SAs when they were destroyed.  This resulted in an
incorrect state on the RADIUS server.

Since 31be582399 the assign_vips() event is also triggered during
reauthentication if the client does not do a Mode Config exchange.
So instead of waiting for a TRANSACTION exchange we trigger the Start
message when a virtual IP is assigned to a client.

With this the charon.plugins.eap-radius.accounting_requires_vip option
would not have any effect for IKEv1 anymore.  However, it previously also
only worked if the client did an XAuth exchange, which is probably
rarely used without virtual IPs, so this might not be much of a
regression.

Fixes #937.

4 years agotesting: Update AAA certificate on Freeradius as well
Andreas Steffen [Wed, 5 Aug 2015 08:01:21 +0000 (10:01 +0200)]
testing: Update AAA certificate on Freeradius as well

4 years agotesting: Updated expired AAA server certificate
Andreas Steffen [Tue, 4 Aug 2015 19:50:01 +0000 (21:50 +0200)]
testing: Updated expired AAA server certificate

4 years agoconfigure: Explicitly disable unused parameter warnings in qsort_r test
Tobias Brunner [Tue, 4 Aug 2015 17:08:30 +0000 (19:08 +0200)]
configure: Explicitly disable unused parameter warnings in qsort_r test

When compiling with -Wextra (and without disabling these warnings
globally) the tests would otherwise fail due to the unused arguments in
the cmp() functions.

Fixes #1053.

4 years agoprintf-hook-builtin: Fix invalid memory access
Tobias Brunner [Mon, 27 Jul 2015 09:18:53 +0000 (11:18 +0200)]
printf-hook-builtin: Fix invalid memory access

When precision is given for a string, we must not run unbounded
strlen() as it will read beyond the given length. It might even cause
a crash if the given pointer is near end of heap or mapping.

Fixes numerous valgrind errors such as:

==19215== Invalid read of size 1
==19215==    at 0x52D36C6: builtin_vsnprintf (printf_hook_builtin.c:853)
==19215==    by 0x52D40A8: builtin_snprintf (printf_hook_builtin.c:1084)
==19215==    by 0x52CE464: dntoa (identification.c:337)
==19215==    by 0x52CE464: identification_printf_hook (identification.c:837)
==19215==    by 0x52D3DAA: builtin_vsnprintf (printf_hook_builtin.c:1010)
==19215==    by 0x57040EB: vlog (bus.c:388)
==19215==    by 0x570427D: log_ (bus.c:430)
==19215==    by 0xA8445D3: load_x509_ca (stroke_cred.c:416)
==19215==    by 0xA8445D3: load_certdir (stroke_cred.c:537)
==19215==    by 0xA846A95: load_certs (stroke_cred.c:1353)
==19215==    by 0xA846A95: stroke_cred_create (stroke_cred.c:1475)
==19215==    by 0xA84073E: stroke_socket_create (stroke_socket.c:782)
==19215==    by 0xA83F27C: register_stroke (stroke_plugin.c:53)
==19215==    by 0x52C3125: load_feature (plugin_loader.c:716)
==19215==    by 0x52C3125: load_provided (plugin_loader.c:778)
==19215==    by 0x52C3A20: load_features (plugin_loader.c:799)
==19215==    by 0x52C3A20: load_plugins (plugin_loader.c:1159)
==19215==  Address 0x50cdb42 is 0 bytes after a block of size 2 alloc'd
==19215==    at 0x4C919FE: malloc (vg_replace_malloc.c:296)
==19215==    by 0x52CD198: chunk_printable (chunk.c:759)
==19215==    by 0x52CE442: dntoa (identification.c:334)
==19215==    by 0x52CE442: identification_printf_hook (identification.c:837)
==19215==    by 0x52D3DAA: builtin_vsnprintf (printf_hook_builtin.c:1010)
==19215==    by 0x57040EB: vlog (bus.c:388)
==19215==    by 0x570427D: log_ (bus.c:430)
==19215==    by 0xA8445D3: load_x509_ca (stroke_cred.c:416)
==19215==    by 0xA8445D3: load_certdir (stroke_cred.c:537)
==19215==    by 0xA846A95: load_certs (stroke_cred.c:1353)
==19215==    by 0xA846A95: stroke_cred_create (stroke_cred.c:1475)
==19215==    by 0xA84073E: stroke_socket_create (stroke_socket.c:782)
==19215==    by 0xA83F27C: register_stroke (stroke_plugin.c:53)
==19215==    by 0x52C3125: load_feature (plugin_loader.c:716)
==19215==    by 0x52C3125: load_provided (plugin_loader.c:778)
==19215==    by 0x52C3A20: load_features (plugin_loader.c:799)
==19215==    by 0x52C3A20: load_plugins (plugin_loader.c:1159)

4 years agokernel-netlink: Use PAGE_SIZE as default size for the netlink receive buffer
Tobias Brunner [Thu, 16 Jul 2015 09:50:22 +0000 (11:50 +0200)]
kernel-netlink: Use PAGE_SIZE as default size for the netlink receive buffer

The kernel uses NLMSG_GOODSIZE as default buffer size, which defaults to
the PAGE_SIZE if it is lower than 8192 or to that value otherwise.

In some cases (e.g. for dump messages) the kernel might use up to 16k
for messages, which might require increasing this value.

4 years agokernel-netlink: Actually verify if the netlink message exceeds the buffer size
Tobias Brunner [Thu, 16 Jul 2015 09:43:44 +0000 (11:43 +0200)]
kernel-netlink: Actually verify if the netlink message exceeds the buffer size

It might equal it and that's fine. With MSG_TRUNC we get the actual
message size and can only report an error if we haven't received the
complete message.

4 years agoha: Properly initialize algo variables when installing CHILD_SAs
Tobias Brunner [Mon, 3 Aug 2015 11:30:11 +0000 (13:30 +0200)]
ha: Properly initialize algo variables when installing CHILD_SAs

If AEAD algorithms are used no integrity algorithm will be received from
the other HA node.  But since AUTH_UNDEFINED is 1024 and not 0 this value
was incorrectly added to the proposal, resulting in a failure during key
derivation.  The variables are now explicitly initialized to 0, as already
was the case for the IKE SAs.

Fixes #1051.

4 years agoha: Sync remote address in HA_IKE_ADD, too
Thomas Egerer [Fri, 24 Apr 2015 11:43:18 +0000 (13:43 +0200)]
ha: Sync remote address in HA_IKE_ADD, too

When the IKE_SA is synced without the remote address, after a
reauthentication charon is not able to find it in its connected_peers
table since the destination host will be %any (it's missing in the
message, hence the default from the newly created ike_sa_t -- %any --
will be used).
By adding the value to the HA_IKE_ADD message, we should be able to
solve this problem.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
4 years agojobs: Don't execute rekey CHILD_SA job on passive IKE_SAs
Thomas Egerer [Fri, 24 Apr 2015 11:43:14 +0000 (13:43 +0200)]
jobs: Don't execute rekey CHILD_SA job on passive IKE_SAs

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
4 years agoike: Disable NAT keepalives in state PASSIVE
Thomas Egerer [Fri, 24 Apr 2015 11:43:11 +0000 (13:43 +0200)]
ike: Disable NAT keepalives in state PASSIVE

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
4 years agotesting: Don't run do-tests when hosts are not running
Tobias Brunner [Mon, 3 Aug 2015 11:34:05 +0000 (13:34 +0200)]
testing: Don't run do-tests when hosts are not running

running_any is satisfied if at least one host is running.  We could
easily add a running_all() helper to check if all hosts are running if
it turns out that's not strong enough.

4 years agotesting: Suppress errors when checking for running hosts
Tobias Brunner [Mon, 3 Aug 2015 10:54:09 +0000 (12:54 +0200)]
testing: Suppress errors when checking for running hosts

If libvirt is not running virsh can't connect to it and will complain that
the socket does not exist.

4 years agoVersion bump to 5.3.3dr3 5.3.3dr3
Andreas Steffen [Fri, 31 Jul 2015 15:47:14 +0000 (17:47 +0200)]
Version bump to 5.3.3dr3

4 years agotesting: Adapted ha/both-active scenario to new jhash values
Andreas Steffen [Fri, 31 Jul 2015 12:43:40 +0000 (14:43 +0200)]
testing: Adapted ha/both-active scenario to new jhash values

4 years agotesting: Fix initial kernel build
Tobias Brunner [Fri, 31 Jul 2015 10:22:55 +0000 (12:22 +0200)]
testing: Fix initial kernel build

The directory does not exist yet if the kernel was never built.

Fixes: a4a13d0be29b ("testing: Extract and patch each kernel version only once")

4 years agoha: Use the same init values for jhash() as Linux 4.1
Tobias Brunner [Wed, 29 Jul 2015 15:04:33 +0000 (17:04 +0200)]
ha: Use the same init values for jhash() as Linux 4.1

4 years agokernel-netlink: Unlock mutex in del_policy() if mark can't be added to message
Tobias Brunner [Fri, 31 Jul 2015 09:20:24 +0000 (11:20 +0200)]
kernel-netlink: Unlock mutex in del_policy() if mark can't be added to message

4 years agosql: Fix memory leak in SQL logger
Tobias Brunner [Tue, 28 Jul 2015 12:53:14 +0000 (14:53 +0200)]
sql: Fix memory leak in SQL logger

4 years agoVersion bump to 5.3.3dr2
Andreas Steffen [Tue, 28 Jul 2015 12:28:13 +0000 (14:28 +0200)]
Version bump to 5.3.3dr2

4 years agoandroid: New release fixing roaming on 5+ and adding new advanced options
Tobias Brunner [Tue, 28 Jul 2015 11:57:13 +0000 (13:57 +0200)]
android: New release fixing roaming on 5+ and adding new advanced options