Commit Graph

14404 Commits

Author SHA1 Message Date
Tobias Brunner 7f21363ee5 vici: Document the ike/child-updown events 2015-08-17 11:12:17 +02:00
Tobias Brunner 22842cce0d 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).
2015-08-17 11:12:17 +02:00
Tobias Brunner 085b8f4fb0 vici: Explicitly notify listeners of the type of ike/child-updown event 2015-08-17 11:12:12 +02:00
Andreas Steffen cdd7d2b197 Version bump to 5.3.3dr5 2015-08-16 09:04:42 +02:00
Andreas Steffen a330f72ecf Fixed AR identities in mutual TNC measurements case 2015-08-15 22:46:21 +02:00
Tobias Brunner df085a158a kernel-pfroute: Don't install virtual IPs if charon.install_virtual_ip is disabled 2015-08-13 15:52:50 +02:00
Tobias Brunner 98c09357d5 load-tester: Include string.h for strcmp() on some platforms 2015-08-13 15:12:42 +02:00
Tobias Brunner 6967948241 Initialize variables that some compilers seem to warn about 2015-08-13 15:12:38 +02:00
Tobias Brunner f809e485fb Fixed some typos 2015-08-13 15:12:34 +02:00
Tobias Brunner dc2fa791e4 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.
2015-08-13 10:49:16 +02:00
Tobias Brunner 695112d7b8 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.
2015-08-13 10:49:16 +02:00
Tobias Brunner 1bc2549914 pki: Optionally extract public key from given private key in --issue
Fixes #618.
2015-08-10 12:33:02 +02:00
Tobias Brunner 99b1a1a1d8 conf: Clarify resolution for two time settings
Fixes #1061.
2015-08-10 12:02:13 +02:00
Andreas Steffen 16c4dd8f26 Version bump to 5.3.3dr4 2015-08-10 07:48:14 +02:00
Tobias Brunner 9593b57ca3 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).
2015-08-06 17:25:07 +02:00
Tobias Brunner 6fe8fe0cfd 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.
2015-08-06 17:24:04 +02:00
Tobias Brunner 520fba4899 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.
2015-08-06 17:22:32 +02:00
Tobias Brunner b2efc61818 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 a81bd670b0 ("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.
2015-08-06 17:15:25 +02:00
Tobias Brunner 1de31bcc2b updown: Pass virtual IPs assigned to a peer to the updown script
Previously only received virtual IPs were available.

References #1008.
2015-08-06 16:30:08 +02:00
Tobias Brunner d04b093374 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.
2015-08-06 14:57:47 +02:00
Tobias Brunner 186d25cbe6 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.
2015-08-06 14:57:26 +02:00
Andreas Steffen 626b2e85f0 testing: Update AAA certificate on Freeradius as well 2015-08-05 10:01:21 +02:00
Andreas Steffen 9b1eaf083f testing: Updated expired AAA server certificate 2015-08-04 21:50:01 +02:00
Tobias Brunner 3103c68210 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.
2015-08-04 19:08:30 +02:00
Tobias Brunner 7be8965225 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)
2015-08-04 14:19:26 +02:00
Tobias Brunner 197de6e66b 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.
2015-08-04 14:15:19 +02:00
Tobias Brunner a6896b6149 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.
2015-08-04 14:15:18 +02:00
Tobias Brunner a7f381ef00 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.
2015-08-04 11:23:27 +02:00
Thomas Egerer 3434709460 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>
2015-08-04 11:21:54 +02:00
Thomas Egerer e095d87bb6 jobs: Don't execute rekey CHILD_SA job on passive IKE_SAs
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2015-08-04 11:16:13 +02:00
Thomas Egerer edaba56ec7 ike: Disable NAT keepalives in state PASSIVE
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2015-08-04 11:16:13 +02:00
Tobias Brunner 008a9ad12c 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.
2015-08-03 13:34:05 +02:00
Tobias Brunner 50dd7de226 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.
2015-08-03 12:54:09 +02:00
Andreas Steffen e0d3a2a873 Version bump to 5.3.3dr3 2015-07-31 17:47:14 +02:00
Andreas Steffen 493ad293b7 testing: Adapted ha/both-active scenario to new jhash values 2015-07-31 14:43:40 +02:00
Tobias Brunner 1f406f3e6e testing: Fix initial kernel build
The directory does not exist yet if the kernel was never built.

Fixes: a4a13d0be2 ("testing: Extract and patch each kernel version only once")
2015-07-31 12:34:44 +02:00
Tobias Brunner 93caf23e1b ha: Use the same init values for jhash() as Linux 4.1 2015-07-31 12:34:44 +02:00
Tobias Brunner 1ce32c9cdc kernel-netlink: Unlock mutex in del_policy() if mark can't be added to message 2015-07-31 11:20:24 +02:00
Tobias Brunner 36bc52b441 sql: Fix memory leak in SQL logger 2015-07-28 15:35:11 +02:00
Andreas Steffen 41458e3362 Version bump to 5.3.3dr2 2015-07-28 14:28:58 +02:00
Tobias Brunner 1d3e69c6da android: New release fixing roaming on 5+ and adding new advanced options 2015-07-28 13:57:13 +02:00
Tobias Brunner f14feed014 Merge branch 'android-updates'
Fixes the roaming behavior on Android 5+, a linker issue on Android M,
a few bugs, and adds several new advanced options for VPN profile (MTU,
server port, split tunneling).

Also adds methods and a constructor to parse settings_t from a string
instead of a file.

Fixes #782, #847, #865.
2015-07-28 13:55:23 +02:00
Tobias Brunner 1e323dc1b7 android: Keep NDK API level at 19
The headers/libraries changed a lot with level 21 so that our app won't
run on devices with Android < 5 when built against it.  We currently
don't need any new native APIs so that should be fine.
2015-07-28 13:27:34 +02:00
Tobias Brunner acc8948fa5 android: Apply split tunneling options when creating TUN device
Android blocks traffic for address families for which no IPs, DNS servers
or routes are installed via VpnService.Builder.  Since Android 5+ (API
level 21) it is possible to explicitly allow such traffic to bypass the VPN.

So for proper split tunneling we note whether we saw a VIP and/or DNS
server of a specific family, and if not, allow traffic of that family
to bypass the VPN using the new API (on older systems there is no change
and such traffic will still be blocked).  Otherwise, we do what we did so
far, that is, simply install the received routes (traffic selectors), all
other traffic will not be directed to the TUN device and use the underlying
network instead.

If traffic for a family should be blocked we install a default route via
TUN device even if we received more specific traffic selectors from the
server.  libipsec will use the actual traffic selectors as IPsec policies
and drop any packets it received that don't match them.  We only do this
if we saw any VIPs or DNS servers of a family.  Otherwise the traffic for
that family is blocked anyway.
2015-07-28 13:27:34 +02:00
Tobias Brunner 3390092c76 include: Remove linux/types.h header
This conflicts with the headers of the android-21 target.  Hopefully
headers on current Linux distros are recent enough.
2015-07-28 13:27:34 +02:00
Tobias Brunner bb40498df3 android: Build against the android-21 target 2015-07-28 13:27:34 +02:00
Tobias Brunner 3ee84fa976 android: Extend GUI so the split tunneling options can be set 2015-07-28 13:27:33 +02:00
Tobias Brunner f3d8da7644 android: Add field for split tunneling config to data model 2015-07-28 13:27:33 +02:00
Tobias Brunner 030bcee1b0 android: Retrigger a roam event if reportedly connected but no source address found
In dual-stack environments the IPv6 connectivity (via autoconfiguration)
might be established before the IPv4 connectivity (via DHCP).  It seems
Android triggers the CONNECTIVITY_ACTION broadcast already when the first
family is fully configured.  At that time we might not be able to find an
IPv4 source address.  And since Android does not trigger the broadcast
again if IPv4 connectivity is established, the connection is broken
afterwards.

So we store the connectivity state and if we are reportedly connected but
still find no source address we trigger a roam event to recheck for an IPv4
address.  This will cause regular rechecks if a device enters an IPv6-only
network, but I guess that's rare (otherwise we could limit the number of
rechecks done between connectivity changes).
2015-07-28 13:27:33 +02:00
Tobias Brunner 41b59a3443 android: Add method to check for connectivity to NetworkManager 2015-07-28 13:27:33 +02:00