Compare commits

...

1905 Commits

Author SHA1 Message Date
Domonkos P. Tomcsanyi cea991aea8 Updated entity name in copyright statements 2022-05-18 17:32:30 +02:00
Tomcsányi, Domonkos 0ed91dc681 simaka_manager: Some more debug logging on success/failure cases 2021-08-26 19:48:11 +02:00
Tomcsányi, Domonkos 65f576bd9c ignore mismatch in received identity.
This is needed, because the standard mandates that the remote entity
must be configured as ims (mimicking the APN setting I think), but on
the other hand the ePDG will identify itself with its FQDN in the end. I
tested this and this is currently the only way to do it with strongswan
I think, because you cannot configure different identities.
2021-08-26 19:47:15 +02:00
Tomcsányi, Domonkos 18b4a240dd permit SHA-1, as some ePDGs require that 2021-08-26 19:46:49 +02:00
Tomcsányi, Domonkos f68dcde6c5 Add support for EAP-AKA against USIM in PC/SC reader 2021-08-26 19:45:59 +02:00
Andreas Steffen 4817d5ed0d Version bump to 5.9.3 2021-07-06 14:00:39 +02:00
Andreas Steffen a09a905e1d vici: Suppress trailing nul character 2021-07-06 12:06:23 +02:00
Tobias Brunner 2cd5314de7 testing: Use specific versions of swidGenerator and strongTNC
This way we get updated versions automatically (referencing "master"
required manually deleting the downloaded archives and the unpacked
directories).  It also allows switching versions when working in different
branches (note that REV can also be set to a commit ID, e.g. to test
changes before tagging them later and merging the branch).
2021-06-30 16:17:39 +02:00
Tobias Brunner 06e11b481b kernel-netlink: Fix theoretical memory leak when parsing routes
This currently can't happen as the kernel always puts RTA_TABLE as first
attribute in RTM_NEWROUTE messages.
2021-06-25 13:51:44 +02:00
Tobias Brunner f6aafb3005 Fixed some typos, courtesy of codespell
Main change is the conversion from the British cancelling/-ed to the
American canceling/-ed.
2021-06-25 11:32:29 +02:00
Andreas Steffen 30fab57124 Version bump to 5.9.3rc1 2021-06-24 09:18:54 +02:00
Tobias Brunner 19611b1d28 testing: Build wolfSSL from the Git repository
Use the same configure options etc. for both builds (no need for the cert
options as we don't use TLS or X.509 parsing) and switch to a Git commit
that includes the SHA-3 OID fix (it's actually the fix itself).
2021-06-22 17:54:15 +02:00
Andreas Steffen 4baca5ca80 testing: Fixed ikev2/farp scenario 2021-06-22 12:32:35 +02:00
Andreas Steffen dbd1534875 Version bump to 5.9.3dr4 2021-06-22 10:33:07 +02:00
Andreas Steffen eba2622587 testing: Migrate ikev2-stroke-bye scenarios to vici 2021-06-22 10:23:06 +02:00
Andreas Steffen 706c58b291 testing: Fixed pretest script of ikev1/rw-psk-aggressive scenario 2021-06-21 12:03:36 +02:00
Tobias Brunner 6d8890767c testing: Migrate ikev2/host2host-transport-nat scenario to vici
This also restores the test as it was before the referenced commit so it
again, as written in the description, demonstrates that venus is unable
to ping sun without IPsec tunnel.

Fixes: f27fb58ae0 ("testing: Update description and test evaluation of host2host-transport-nat")
2021-06-21 12:03:36 +02:00
Tobias Brunner 2b5c743952 testing: Migrate MOBIKE tests to vici
Note that the mobike-nat test has been removed as it basically did the same
as the mobike-virtual-ip-nat test.  Instead, the mobike-nat-mapping scenario
is added, which simulates a NAT router restart.
2021-06-21 12:03:36 +02:00
Tobias Brunner abe51389c5 ike-mobike: Force MOBIKE update after NAT mappings changed
The addresses observed by the client behind the NAT are exactly the same if
the NAT router gets restarted.

Fixes: 2b255f01af ("ike-mobike: Use ike_sa_t::update_hosts() to trigger events")
2021-06-21 12:03:36 +02:00
Tobias Brunner 036ae27645 ike-sa: Log IKE endpoint changes 2021-06-21 12:03:36 +02:00
Tobias Brunner 79b526deba ha: Register the correct IKE_SA with the manager after a rekeying
Fixes: 20dfbcad08 ("ha: Register new IKE_SAs before calling inherit_post()")
Closes strongswan/strongswan#456.
2021-06-21 10:02:26 +02:00
Tobias Brunner 4b9b4dc956 Merge branch 'vici-stuck'
Closes strongswan/strongswan#268.
2021-06-21 09:59:28 +02:00
Tobias Brunner eec3bdb04a vici: Signal waiting threads when skipping disconnected connections
If two threads are waiting in find_entry() and remove_entry(),
respectively, and the former is woken first, the latter remains stuck
as it won't get signaled.
2021-06-21 09:59:15 +02:00
Tobias Brunner b0e2187b6b vici: Signal waiting threads when removing a connection entry
If there are threads waiting in find_entry() and one in remove_entry()
and the latter is woken first by a thread calling put_entry(), the
former threads would remain stuck as they get never signaled.
2021-06-21 09:59:15 +02:00
Tobias Brunner 030e80957d kernel-netlink: Don't wait for VIPs to disappear during de-initialization
This can happen if an IKE_SA is terminated forcefully shortly before
terminating the daemon.  The thread that handles the terminate command
will call checkin_and_destroy(), which unregisters the IKE_SA from the
manager before destroying it.  The main thread that calls flush() on the
IKE_SA manager won't wait for this SA (its entry is already gone), so
the processor and in turn the watcher job/thread might get canceled
before the first thread started deleting the VIP.  It would then wait
indefinitely for a signal that can never be sent.

There is still a small chance the thread hangs in wait() if the state check
happens right before the watcher is canceled and it wasn't yet able to
deliver the event from the kernel, we counter that by rechecking the state
after a while.
2021-06-21 09:59:06 +02:00
Tobias Brunner 0fc8cf0013 NEWS: Add news for 5.9.3 2021-06-18 10:31:31 +02:00
Adrian-Ken Rueegsegger 859dedeab7 testing: Update Anet to version 0.4.2 2021-06-17 09:53:51 +02:00
Stefan Berghofer d7a9e723f3 charon-tkm: Remove useless checks when deriving IKE keys 2021-06-17 09:53:51 +02:00
Stefan Berghofer 22e7900718 charon-tkm: Delegate encryption/decryption of IKE traffic to TKM
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2021-06-17 09:53:51 +02:00
Tobias Brunner 6537be9c8d pkcs11: Change how unavailable attributes like CKA_TRUSTED are handled
If a PKCS#11 library/token doesn't provide one or more attributes via
C_GetAttributeValue(), we get back CKR_ATTRIBUTE_TYPE_INVALID (similar
for protected attributes where CKR_ATTRIBUTE_SENSITIVE is returned).
This is not an error as the spec demands that all attributes have been
processed with the unavailable attributes having set their length
field to CK_UNAVAILABLE_INFORMATION.

We use this to handle the CKA_TRUSTED attribute, which some tokens
apparently don't support.  We previously used a version check to remove
the attribute from the call but even the latest spec doesn't make the
attribute mandatory (it's just in a list of "common" attributes for
CKO_CERTIFICATE objects, without a default value), so there are current
tokens that don't support it and prevent us from enumerating certificates.
2021-06-14 13:58:48 +02:00
Tobias Brunner a90716cd4d receiver: Avoid division by 0 after system start if CLOCK_MONOTONIC is used
Depending on how CLOCK_MONOTONIC is implemented, time_monotonic() might
return 0 within 1 second after the system is started.  If that's the
case, we just default to 0 for now to avoid a crash (doesn't "hide" the
system time, but it's only the uptime anyway in this case).

Closes strongswan/strongswan#435.
2021-06-14 13:24:08 +02:00
Tobias Brunner 8dbf40d19a charon-nm: Simplify certificate enumeration and allow IDs other than DNs
This allows using SANs as identity instead of having to use the subject DN.

References strongswan/strongswan#437.
2021-06-14 12:13:47 +02:00
Tobias Brunner ae71f8357d dhcp: Move log messages for received packets
This way they are logged in the context of the corresponding IKE_SA.

Closes strongswan/strongswan#417.
2021-06-08 17:03:17 +02:00
Thomas Egerer 4e29d6fac1 bus: Extend and reorder arguments of ike_derived_keys() hook
This now includes all key material derived for IKE_SAs in the order
defined in the RFC:

  {SK_d | SK_ai | SK_ar | SK_ei | SK_er | SK_pi | SK_pr}
               = prf+ (SKEYSEED, Ni | Nr | SPIi | SPIr)

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2021-06-07 17:08:27 +02:00
Andreas Steffen 9c85a52956 Version bump to 5.9.3dr3 2021-06-04 09:28:17 +02:00
Tobias Brunner e166423856 ikev1: Fix flags so NAT Vendor IDs are sent again
Fixes: 6c49ddfbca ("ike: Add additional Vendor IDs for third-party implementations")
2021-06-04 09:20:49 +02:00
Andreas Steffen cc4338267e testing: Added openssl-ikev2/net2net-sha3-rsa-cert scenario 2021-06-03 14:20:06 +02:00
Andreas Steffen 5688e631e3 openssl: Support SHA-3 based RSA_EMSA_PKCS1 signatures 2021-06-03 14:20:06 +02:00
Andreas Steffen de5ca4021a testing: Test wolfssl plugin 2021-06-03 10:22:59 +02:00
Andreas Steffen 8bbd7bbd36 wolfssl: Full support of SHA3 signatures 2021-06-03 10:20:18 +02:00
Andreas Steffen e0044e5f48 credential_factory: Store name of plugin registering a builder 2021-06-01 21:12:46 +02:00
Andreas Steffen 62c5ef035c wolfssl: Set RSA key type 2021-05-30 12:40:08 +02:00
Marius Tomaschewski d654117c66 ccm: Destroy IV generator on crypter creation failure
Closes strongswan/strongswan#343.
2021-05-27 17:43:03 +02:00
Tobias Brunner a82f13e7ce dhcp: Log MAC address when sending DISCOVER message
Closes strongswan/strongswan#239.
2021-05-27 12:06:47 +02:00
Noel Kuntze 6c49ddfbca ike: Add additional Vendor IDs for third-party implementations
For some that are followed by unknown data (e.g. detailed version
information) we only do a prefix match.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>

Closes strongswan/strongswan#393.
2021-05-21 17:50:35 +02:00
Andreas Steffen d415673565 Version bump to 5.9.3dr2 2021-05-21 10:00:41 +02:00
Andreas Steffen 7c5a2974b9 testing: Reorganizing IKEv1 and IKEv2 examples
For documentation purposes the new folders ikev1-algs, ikev2-algs,
ikev1-multi-ca and ikev2-multi-ca have been created. Most of the
test cases have now been converted to the vici interface. The
remaining legacy stroke scenarios yet to be converted have been put
into the ikev2-stroke-bye folder.

For documentation purposes some legacy stroke scenarios will be kept
in the ikev1-stroke, ikev2-stroke and ipv6-stroke folders.
2021-05-21 09:42:50 +02:00
Tobias Brunner db93938297 notify-payload: Update reference for notify types for PPKs
draft-ietf-ipsecme-qr-ikev2 was released as RFC 8784 in June of 2020.
2021-05-11 14:30:05 +02:00
Tobias Brunner c13a1c2829 Don't report current text in parser error messages
The values of `yytext` and `yyleng` might not be properly defined when
the error function is called (in particular if the lexer reached EOF).
While this might just cause non-printable characters in the output, it
could actually lead to a crash depending on where `yytext` points.

Closes strongswan/strongswan#346.
2021-05-11 10:08:58 +02:00
Noel Kuntze cf6a164108 testing: Replace kvm with qemu-system-x86_64
It might not exist on all platforms and according to the man page:

  The kvm wrapper script is used to provide compatibility with old
  qemu-kvm package which has been merged into qemu as of version 1.3.

  The script executes
    qemu-system-x86_64 -enable-kvm
  passing all other command-line arguments to the qemu binary.

Closes strongswan/strongswan#385.
2021-05-10 11:14:00 +02:00
Tobias Brunner 1eb2d149db testing: Use host-passthrough CPU mode for all KVM guests
This should give us the best performance and feature set on modern
hardware (in particular when compared to code2duo, which e.g. does not allow
nested virtualization).

Closes strongswan/strongswan#340.
2021-05-10 10:04:28 +02:00
Tobias Brunner d4c337a42f Use Botan 2.18.0 for tests 2021-05-07 14:48:17 +02:00
Adrian-Ken Rueegsegger f0c25960ed openssl: Consider authorityKeyIdentifier in issued_by()
Prior to verifying the cryptographic signature, check if the
authorityKeyIdentifier matches the key ID of the issuing certificate if
it is available.
2021-05-07 14:29:24 +02:00
Adrian-Ken Rueegsegger 027c5c9dcb x509: Consider authorityKeyIdentifier in issued_by()
Prior to verifying the cryptographic signature, check if the
authorityKeyIdentifier matches the key ID of the issuing certificate if
it is available.
2021-05-07 14:29:24 +02:00
Adrian-Ken Rueegsegger 97c9158378 openssl: Bring CRL issued_by() in line with x509 plugin 2021-05-07 14:29:24 +02:00
Adrian-Ken Rueegsegger 9f468f454a ike: Set DCSP on keepalive packets 2021-05-07 14:29:24 +02:00
Tobias Brunner 546f61d3c8 openssl: Add support for AES in CCM mode
While CCM is available in earlier versions, we only use it with
OpenSSL 1.1.0 and newer because the generic control variables are not
available before and we default to GCM for them.

Closes strongswan/strongswan#353.
2021-05-06 18:29:16 +02:00
Noel Kuntze 5191c2b063 testing: Make sure $SHAREDDIR exists before mounting it
Closes strongswan/strongswan#344.
2021-05-06 17:21:59 +02:00
Tobias Brunner a730873211 github: Fix python build and checks on older Ubuntu releases
On 18.04, setuptools was apparently pulled in by python-pip but is not
by python3-pip and on Ubuntu 16.04 there is an issue with tox when
installed via pip3 (syntax error in one of the dependencies) and with
pip that dependency is not even available.
2021-05-06 15:16:42 +02:00
Tobias Brunner 9535c3f778 wolfssl: Properly handle failure to initialize SHAKE_256 2021-05-06 11:47:38 +02:00
Tobias Brunner 2f650e085b github: Don't fail LGTM test with an error if variables are missing
That's because forks are currently not allowed to be analyzed by LGTM (unlike
with SonarCloud) so this check can't actually be successful for forks even if
variables are defined.

References strongswan/strongswan#328.
2021-05-05 19:11:38 +02:00
Noel Kuntze 260e7b55f6 github: Fail LGTM test if required environment variables aren't set
Closes strongswan/strongswan#328.
2021-05-05 18:12:25 +02:00
Tobias Brunner cd7b80e869 github: Make LGTM project ID configurable via environment variable 2021-05-05 18:09:44 +02:00
Noel Kuntze f830e71457 github: Fail sonarcloud test if required environment variables aren't set
Closes strongswan/strongswan#330.
2021-05-05 18:10:03 +02:00
Tobias Brunner c603704bb3 github: Always upload lint results from Android build 2021-05-05 18:09:44 +02:00
Tobias Brunner 742e0f213c github: Fix build on Ubuntu 20.04 and add a job for 18.04
The nm test can only be done on Ubuntu 18.04 as the required libraries
are not available on newer systems.

Switch to pip3 to install tox (the only Python dependency we use).

Closes strongswan/strongswan#327.
2021-05-05 18:09:44 +02:00
Tobias Brunner eca1b81682 github: Fix installation of Python dependencies 2021-05-05 18:08:20 +02:00
Tobias Brunner 6405653da2 android: Avoid lint errors when determining column indices
The lint version used on our GitHub build hosts reported these errors:

Error: Value must be ≥ 0 [Range]
        db.update(TABLE_VPNPROFILE, values, KEY_ID + " = " + cursor.getLong(cursor.getColumnIndex(KEY_ID)), null);

That's because get*() expect a valid index >= 0 but getColumnIndex()
can return -1 if the column name doesn't exist.
2021-05-05 16:40:14 +02:00
Tobias Brunner f0a20dd2b8 backtrace: The BFD API changed in newer versions 2021-05-05 16:17:54 +02:00
Noel Kuntze 1de13f9037 openssl: Fix OpenSSL version check for EC_POINT_set_affine_coordinates
Fixes: bd323ae6c8 ("openssl: Migrate from deprecated EC_POINT_[set|get]_affine_coordinates_GFp() functions")
Closes strongswan/strongswan#332
2021-05-04 14:51:18 +02:00
Noel Kuntze e9a55abce4 forecast: Restrict strncpy() call
Closes strongswan/strongswan#331.
2021-05-04 14:48:53 +02:00
Tobias Brunner 2b89676157 Merge branch 'doxygen-fixes'
Closes strongswan/strongswan#326.
2021-05-04 14:39:56 +02:00
Noel Kuntze 4886a2c7d8
Doxyfile.in: Remove deprecated variables 2021-04-15 16:13:22 +02:00
Noel Kuntze a11efc5214
doxygen: Fix documentation problems 2021-04-15 00:17:59 +02:00
Andreas Steffen 09df86c033 Version bump to 5.9.3dr1 2021-03-31 09:59:55 +02:00
Andreas Steffen 66ba50b217 testing: Migrated p2pnat/medsrv-psk scenario to vici 2021-03-30 22:12:00 +02:00
Andreas Steffen 03e1272ff2 testing: Migrated p2pnat/behind-same-nat scenario to vici 2021-03-30 22:12:00 +02:00
Andreas Steffen 68154033bb testing: Store mars credentials in the swanctl directory 2021-03-30 22:12:00 +02:00
Andreas Steffen 2cbf7da51a testing: Migrated redirect-active scenario to vici 2021-03-30 22:12:00 +02:00
Andreas Steffen 511b860916 testing: Migrated ha/both-active scenario to vici 2021-03-30 18:57:49 +02:00
Andreas Steffen 5c22e94f0f testing: Migrated ha/active-passive scenario to vici 2021-03-30 18:57:49 +02:00
Andreas Steffen 737f7fce51 testing: Switched PTS measurements to /usr/sbin
Due to Debian 10 linking /bin to /usr/bin which drastically
increased the number of files in /bin, the PTS measurement
was switched to /usr/sbin with a lesser number of files.
2021-03-23 10:54:48 +01:00
Andreas Steffen f412c97648 wolfssl: Support SHAKE_256 2021-03-20 11:19:12 +01:00
Andreas Steffen a91eb3eb96 wolfssl: Support SHA3 2021-03-20 11:15:42 +01:00
Andreas Steffen b57215ba2b wolfssl: Support AES_ECB 2021-03-20 11:15:42 +01:00
Andreas Steffen bd323ae6c8 openssl: Migrate from deprecated EC_POINT_[set|get]_affine_coordinates_GFp() functions 2021-03-19 08:50:27 +01:00
Petr Gotthard c5eac9c390 libcharon: Include libtpmtss in monolithic build 2021-03-17 12:14:47 +01:00
Andreas Steffen 6aef079f59 testing: Bump guest kernel to Linux 5.11 2021-03-07 14:39:44 +01:00
Andreas Steffen 87ba3a424d Version bump to 5.9.2 2021-02-26 11:30:13 +01:00
Tobias Brunner 88c4d8cb22 Merge branch 'sha2-no-trunc'
Closes strongswan/strongswan#215.
2021-02-23 17:30:11 +01:00
Tobias Brunner 875813c055 save-keys: Fix length of AES-GCM with 12-byte ICV 2021-02-23 17:28:46 +01:00
Michał Skalski b6b8880340 save-keys: Add support for full-length HMAC-SHA256 for ESP
Wireshark doesn't really support it, but this way it at least decodes
the ESP packets correctly and the encryption keys are saved and the
packets can be decrypted.  The full-length versions of SHA-384 and
SHA-512 are not supported by Wireshark as 256-bit is the longest ICV
it is able to decode currently.
2021-02-23 17:28:46 +01:00
Michał Skalski c632aa7b31 kernel-netlink: Add support for full-length HMAC-SHA2 algorithms 2021-02-23 17:28:46 +01:00
Michał Skalski aa6da3700a keymat: Add support for full-length HMAC-SHA2 algorithms 2021-02-23 17:23:29 +01:00
Michał Skalski 7a8cd5d6d0 af-alg: Fix typo in algorithm mapping for full-size HMAC-SHA-256 2021-02-23 09:25:44 +01:00
Andreas Steffen 356f87355b Version bump to 5.9.2rc2 2021-02-21 10:40:34 +01:00
Andreas Steffen 20c47af319 testing: Use TLS 1.3 in TNC PT-TLS tests 2021-02-21 09:48:34 +01:00
Andreas Steffen 9f55246018 testing: Added mgf1 plugin to load statement 2021-02-19 17:41:44 +01:00
Andreas Steffen 283b352cee Merge branch 'tls-fixes' 2021-02-18 20:28:33 +01:00
Andreas Steffen d08fa4bd0a Version bump to 5.9.2rc1 2021-02-18 20:16:17 +01:00
Tobias Brunner 48f4f9f667 pt-tls-server: Make TLS client authentication optional as appropriate 2021-02-18 15:41:52 +01:00
Tobias Brunner 82116dba66 tls-test: Add option to make client authentication optional 2021-02-18 15:39:35 +01:00
Tobias Brunner 760f3b730f tls-server: Add flag that makes client authentication optional
This allows clients to send an empty certificate payload if the server
sent a certificate request.  If an identity was set previously, it will
be reset so get_peer_id() may be used to check if the client was
authenticated.
2021-02-18 15:35:46 +01:00
Tobias Brunner 11a4687930 libtls: Add control flags and replace GENERIC_NULLOK purpose with one 2021-02-18 15:10:29 +01:00
Tobias Brunner 602947d48a pt-tls-server: Explicitly request client authentication if necessary
The PT_TLS_AUTH_TLS_OR_SASL case currently can't be implemented properly
as TLS authentication will be enforced if a client identity is configured
on the TLS server socket.
2021-02-18 12:49:54 +01:00
Tobias Brunner 4b7cfb252e tls-server: Use subject DN as peer identity if it was ID_ANY
To request client authentication if we don't know the client's identity,
it's possible to use ID_ANY.  However, if we don't change the identity
get_peer_id() would still report ID_ANY after the authentication.
2021-02-18 12:34:05 +01:00
Tobias Brunner d5606ec350 testing: Adapt some checks as SHA-384 is now preferred for TLS signatures 2021-02-18 12:02:54 +01:00
Tobias Brunner 024120f8ea tls-eap: Only servers conclude EAP method after processing packets
As client with older TLS versions, we have to ack the receipt of the server's
Finished message instead.

Fixes: 083f38259c ("tls-eap: Conclude EAP method also after processing packets")
2021-02-18 12:02:32 +01:00
Stefan Berghofer f7613cb581 ike-sa: Properly set timing info for delete after rekeying
The job is queued properly, yet the timing information is wrong.

Signed-off-by: Stefan Berghofer <stefan.berghofer@secunet.com>

Fixes: ee61471113 ("implemented RFC4478 (repeated authentication)...")
2021-02-18 10:02:55 +01:00
Tobias Brunner d65d4eab73 NEWS: Add news for 5.9.2 2021-02-17 15:24:36 +01:00
Tobias Brunner ff672c785b dhcp: Properly initialize struct when binding to interface 2021-02-16 15:22:18 +01:00
Tobias Brunner fbb70c968b pts: Don't rely on BIOS event buffer to be null terminated 2021-02-16 15:16:25 +01:00
Tobias Brunner 8384527ff5 tls-crypto: Fix potential memory leak
Fixes: d8e42a3d4e ("tls-crypto: Share private key search between client and server")
2021-02-16 14:52:43 +01:00
Tobias Brunner f4258c56f5 ike-sa-manager: Ensure we were able to create a new IKE_SA
This may happen if we are unable to allocate an SPI.
2021-02-16 14:45:51 +01:00
Tobias Brunner cb85967655 github: Bump wolfSSL to 4.7.0 2021-02-16 09:08:12 +01:00
Fedor Korotkov af9d2a8f1e cirrus: Use FreeBSD 12.2
This seems to fix the build with Autotools that recently started to fail
with:

autom4te-2.69: need GNU m4 1.4 or later: /usr/local/bin/gm4
aclocal: error: /usr/local/bin/autom4te-2.69 failed with exit status: 1
autoreconf-2.69: aclocal failed with exit status: 1

Closes strongswan/strongswan#197.
2021-02-16 08:56:43 +01:00
Tobias Brunner 7bd9c0c85e github: Fix emojis in templates 2021-02-15 15:30:03 +01:00
Tobias Brunner 27544f7bd9 github: Add security policy 2021-02-15 09:44:44 +01:00
Tobias Brunner ebf13f4caf github: Add issue templates 2021-02-15 09:44:44 +01:00
René Fischer 4261fcedec botan: Use strongSwan's RNG interface in Botan plugin
This allows using rng_t implementations provided by other plugins to
serve as RNG for Botan.

Closes strongswan/strongswan#192.
2021-02-15 09:27:51 +01:00
Tobias Brunner 5ffc1ec423 botan: Extract helper function to map RNG quality to Botan RNG names 2021-02-15 09:23:57 +01:00
Tobias Brunner eb399fb438 botan: Look for Botan 3 in configure script 2021-02-15 09:23:56 +01:00
Tobias Brunner 97857eaa12 ike-sa: Avoid possible integer underflow when scheduling reauth after rekeying
If the reauthentication is scheduled while rekeying, the difference
might be negative, however, schedule_job() takes an unsigned int,
so the reauth would get scheduled very far in the future.
2021-02-12 15:49:08 +01:00
Tobias Brunner 20dfbcad08 ha: Register new IKE_SAs before calling inherit_post() 2021-02-12 15:49:08 +01:00
Tobias Brunner 1c5cef1b89 ike-rekey: Register new IKE_SA before calling inherit_post()
If rekeying and reauthetication coincided, the reauth job could get
scheduled to run immediately i.e. before checkin() was called.  So the
new IKE_SA would not get reauthenticated, however, the further delayed
delete job would later find the new IKE_SA and delete it.
2021-02-12 15:49:08 +01:00
Tobias Brunner 5d97af5894 ike-sa-manager: Add a method to register/check out new IKE_SAs
This way, jobs for new IKE_SAs (created via create_new()) may be
scheduled/queued before checkin() is called.  If they run before
that happens, they will now correctly block in checkout() instead of
doing nothing because the IKE_SA was not found.
2021-02-12 15:49:08 +01:00
Tobias Brunner bde5bd47bd ike-sa-manager: Rename checkout_new() to create_new()
We don't actually check that SA out (i.e. it's not registered with the
manager).  That was originally different but had to be changed with
86993d6b90 to avoid that SAs created for rekeying don't block other
threads on the manager.
2021-02-12 15:49:08 +01:00
Tobias Brunner 7f6386afd9 Remove redundant calls to set peer config after checking out IKE_SAs by config 2021-02-12 15:49:08 +01:00
Tobias Brunner c46c40ef24 ike-sa-manager: Make checkout_by_config() atomic
These changes should ensure that concurrent calls to checkout_by_config()
result in a single IKE_SA.  For instance, when acquires for different
children of the same connection are triggered concurrently.

There are two major changes to the interface:

 1) The peer config object is now always set on the returned IKE_SA.
    That was previously only the case if an existing IKE_SA was
    returned.

 2) The IKE_SA is now always registered with the manager and properly
    checked out, which also was only the case for existing IKE_SAs
    before.
2021-02-12 15:49:08 +01:00
Tobias Brunner c7a0f2698d Merge branch 'tls13'
This adds support for TLS 1.3 to libtls and adds several new features to
existing TLS versions (e.g. support for x25519/x448, EdDSA or RSA-PSS).

Unfortunately, TLS 1.3 is not really usable for TLS-based EAP methods in
practice because, in particular, key derivation is not yet standardized.
While it works between two strongSwan instances and even FreeRADIUS 3.0.21,
there will be compatibility issues in the future when implementations move
to a standardized scheme.  There are currently two Internet-Drafts in
development to specify that (see 121ac4b9e3 for details).  Until they are
more stable, the default maximum version is set to 1.2.

The default minimum version has also been increased to 1.2 and several
older/weaker cipher suites have been removed (e.g. with 3DES and MD5).
2021-02-12 15:32:03 +01:00
Tobias Brunner 74b9ba7cdb tls-crypto: Simplify and extend cipher config filter
This way we automatically can filter for newer algorithms (e.g.
chacha20poly1305).
2021-02-12 14:35:23 +01:00
Tobias Brunner 8b2b5a647b proposal: Add aliases for AES-GCM/CCM without explicit ICV length
These are mapped to use the default, maximum ICV length of 16 bytes.
2021-02-12 14:35:23 +01:00
Tobias Brunner 966a26eaa2 tls-server: Support x25519/448 for TLS 1.2 2021-02-12 14:35:23 +01:00
Tobias Brunner f77ecf0728 tls-crypto: Fallback to any supported ECDH group
If the default group listed in the cipher suite is not supported, we try
to use any other supported group (the groups are negotiated separately
so we are not locked in to a specific group).
2021-02-12 14:35:23 +01:00
Tobias Brunner 311405c34d tls-crypto: Don't filter suites with specific ECDH group if any is available
Since DH groups (or with TLS < 1.3 curves) are negotiated separately,
it doesn't matter which one is listed in the cipher suite as any one could
be used.
2021-02-12 14:35:23 +01:00
Tobias Brunner 85bde019d3 diffie-hellman: Classify x25519 and x448 as ECDH methods 2021-02-12 14:35:23 +01:00
Pascal Knecht e3757300eb tls-crypto: Add signature scheme config file filter
And add signature scheme unit tests.
2021-02-12 14:35:23 +01:00
Pascal Knecht e5b6565730 tls-crypto: Rename DH group/key exchange method config option
TLS key exchange methods are now configured with `ke_group`.
2021-02-12 14:35:23 +01:00
Tobias Brunner a60e248b0d libtls: Increase default min version to 1.2
The older versions are generally considered deprecated (there is an
Internet-Draft that aims to do that formally).
2021-02-12 14:35:23 +01:00
Tobias Brunner 3abcbf82b5 tls-peer: Verify server selects the same cipher suite after HelloRetryRequest
This is as per RFC 8446, section 4.1.4.
2021-02-12 14:35:23 +01:00
Tobias Brunner ab226b3927 tls-server: Select cipher suite also when handling HelloRetryRequest
This was previously treated like a resumption, which it is clearly not.
Also added a check that verifies that the same cipher suite is selected
during the retry, as per RFC 8446, section 4.1.4.
2021-02-12 14:35:23 +01:00
Tobias Brunner 111e907168 tls-server: Remove unused variable 2021-02-12 14:35:23 +01:00
Pascal Knecht dc9f6c68df libtls: Add downgrade protection for TLS 1.3 and TLS 1.2
Section 4.1.3 in RFC 8446 defines a new downgrade protection mechanism
that also affects TLS 1.2.
2021-02-12 14:35:23 +01:00
Shmulik Ladkani a4a128bd2f tls-server: Optionally omit CAs in CertificateRequest messages
Usually, the DNs of all loaded CA certificates are included in the
CertificateRequest messages sent by the server.

Alas, certain EAP-TLS clients fail to process this message if the
list is too long, returning the fatal TLS alert 'illegal parameter'.

This new option allows configuring whether CAs are included or an
empty list is sent (TLS 1.2), or the certificate_authorities extension
is omitted (TLS 1.3).  The list only serves as hint/constraint
for clients during certificate selection, they still have to provide
a certificate but are free to select any one they have available.

Closes strongswan/strongswan#187.
2021-02-12 14:35:23 +01:00
Tobias Brunner 083f38259c tls-eap: Conclude EAP method also after processing packets
With TLS 1.3, the server sends its Finished message first, so the
session is complete after processing the client's Finished message,
without having to send anything else (in particular no acknowledgement
as the last message from the client is no fragment).
2021-02-12 14:35:23 +01:00
Tobias Brunner a00ace0fe2 libtls: Only run socket tests with EdDSA keys if they are supported
ECDSA support is currently required to run the tests because ECDSA
cipher suites are not filtered when determining the supported cipher
suites.  Also required are ECDH groups.
2021-02-12 14:35:23 +01:00
Tobias Brunner 7b64880a8c tls-peer: Don't log anything if we are not sending supported groups 2021-02-12 14:35:23 +01:00
Tobias Brunner 8cf3998f1a tls-crypto: Only log modified TLS versions if successfully set
If no cipher suites are available, the new versions are the previous
values but reversed (i.e. the versions were not changed but we still
ended up with a log message saying "TLS min/max TLS 1.3/TLS 1.0 ...").

Also switched to using the numeric version names to avoid the repeated
"TLS" prefix.
2021-02-12 14:35:23 +01:00
Tobias Brunner 92aef122c3 libtls: Reduce default max version to 1.2
Using TLS 1.3 with various EAP methods is not yet fully standardized, so we
don't enable it by default yet.
2021-02-12 14:35:23 +01:00
Tobias Brunner 663969ddf7 libtls: Make min/max TLS version configurable
Except for the tls_test tool, the versions now default to those
configured in strongswan.conf.
2021-02-12 14:35:23 +01:00
Pascal Knecht 9389fef78a test-hkdf: Add two test cases and restructure all tests
RFC 8448 contains multiple TLS 1.3 message traces, this commit adds two
new test cases focusing on key derivation:

- Simple 1-RTT Handshake
- Resumed 0-RTT Handshake

Additionally, the whole test suite is restructured and duplicate code is
removed and consolidated.
2021-02-12 14:35:23 +01:00
Pascal Knecht 7797c058d9 tls-hkdf: Implement binder PSK generation 2021-02-12 14:35:23 +01:00
Pascal Knecht 3e535c31b4 tls-hkdf: Implement resumption key generation 2021-02-12 14:35:23 +01:00
Pascal Knecht 9ef46cfaf9 tls-peer: Mutual authentication support for TLS 1.3 2021-02-12 14:35:23 +01:00
Pascal Knecht 2d933f318b tls-peer: Derive application traffic keys after server finished message
The inbound key is used right away, the outbound key only after the
client finished message has been sent.
2021-02-12 14:35:23 +01:00
Pascal Knecht d41d8b0039 tls-peer: Use private key enumeration also in TLS versions < 1.2
Until now, key selection was based on tls_client_certificate_type_t and now
uses a simple mapping from these types to tls_signature_scheme_t.
2021-02-12 14:35:23 +01:00
Pascal Knecht d8e42a3d4e tls-crypto: Share private key search between client and server
This way the client also properly considers the TLS version and the signature
schemes supported by the server.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2021-02-12 14:35:23 +01:00
Pascal Knecht 299cc80094 tls-test: Add support to require/verify client certificates
Also add detailed usage output with description of all options.
2021-02-12 14:35:23 +01:00
Pascal Knecht d2fc9b0961 tls-server: Mutual authentication support for TLS 1.3
This commit also addresses the side effect that additional messages have
an influence on the derivation of the application traffic secrets. Therefore,
key derivation is relocated after the server finished message has been sent,
so the additional messages from the client (Certificate, CertificateVerify)
don't affect the key derivation. Only the outbound key is switched there, the
inbound key remains in use until the client's finished message has been
processed.
2021-02-12 14:35:23 +01:00
Pascal Knecht dc49d457a2 tls-server: Terminate connection if peer certificate is required but not sent
This change mainly affects legacy TLS versions because TLS 1.3
connections are terminated by the server once the peer does not send a
CertificateVerify message next to its empty Certificate message.
2021-02-12 14:35:23 +01:00
Pascal Knecht 4bba89fff3 tls-server: Make CertificateRequest conditional in old TLS versions
The server implementation now only sends a CertificateRequest message if
it has identity information to verify client certificates.
2021-02-12 14:35:23 +01:00
Pascal Knecht 4635f348fa tls-server: Share trusted public key search between client and server 2021-02-12 14:35:23 +01:00
Pascal Knecht 6b23543abd tls-crypto: Move AEAD ownership to the protection layer
This separates key derivation from key switching.
2021-02-12 14:35:23 +01:00
Pascal Knecht 534a781646 tls-hkdf: Always use correct base key to derive finished message
The cached traffic secrets change once the application traffic secrets
are derived, but we must always use the correct base key to derive the
finished message, which are the handshake traffic secrets (RFC 8446,
section 4.4).
2021-02-12 14:35:23 +01:00
Pascal Knecht 0aaf1242d9 libtls: Add unit tests for Ed25519 and Ed448 keys
TLS 1.0 to TLS 1.3 socket connection tests with each key type.
2021-02-12 14:35:23 +01:00
Pascal Knecht 5e579ebe8f tls-test: Load keys of any type
Only RSA keys were possible until now.
2021-02-12 14:35:23 +01:00
Pascal Knecht 34f66ce6cb tls-crypto: Support EdDSA keys with ECDSA cipher suites
Ed25519 and Ed448 are now usable in all TLS versions for connections that
use an ECDSA cipher suite, as per RFC 8422.
2021-02-12 14:35:23 +01:00
Pascal Knecht 9803fb82f4 tls-server: Consider supported signature algorithms when selecting key/certificate
This won't work if the client doesn't send a `signature_algorithms`
extension.  But since the default is SHA1/RSA, most will send it to at
least announce stronger hash algorithms if not ECDSA.
2021-02-12 14:35:23 +01:00
Pascal Knecht 06112f3fe2 tls-crypto: Distinguish between signing and verifying signature schemes
strongSwan supports RSA_PSS_RSAE schemes for signing but does not
differentiate between rsaEncryption and rsassaPss encoding. Thus
RSA_PSS_PSS schemes are only used for verifying signatures.
2021-02-12 14:35:23 +01:00
Pascal Knecht e731396280 tls-server: Check if peer sent hash and signature algorithms
It is mandatory to receive the `signature_algorithms` extension when a
server is authenticating with a certificate, which is always the case.
2021-02-12 14:35:23 +01:00
Pascal Knecht 91c9e4d576 tls-crypto: Add missing signature scheme constants
Some peers, e.g. Firefox, send a wide range of signature algorithms. To
prevent numeric identifiers in the log these algorithms are added here.
2021-02-12 14:35:23 +01:00
Pascal Knecht 0dfe1590b6 tls-server: Fix invalid signature algorithm and supported groups parsing
The extension's content length field was wrongly added to the content data.

Fixes: 06109c4717 ("Implemented "signature algorithm" hello extension")
2021-02-12 14:35:23 +01:00
Pascal Knecht 3767a4a655 tls-server: Support multiple client key shares
A client can send one or multiple key shares from which the server picks
one it supports (checked in its preferred order).  A retry is requested if
none of the key shares are supported.
2021-02-12 14:35:23 +01:00
Pascal Knecht 64e2506f5b libtls: Add TLS version negotiation test cases
These client to server negotiation test cases are implemented:
- TLS 1.0 => TLS 1.3
- TLS 1.1 => TLS 1.3
- TLS 1.2 => TLS 1.3
- TLS 1.3 => TLS 1.3

- TLS 1.3 => TLS 1.0
- TLS 1.3 => TLS 1.1
- TLS 1.3 => TLS 1.2
- TLS 1.3 => TLS 1.3

- TLS 1.0 => TLS 1.2
- TLS 1.1 => TLS 1.2
- TLS 1.2 => TLS 1.2
- TLS 1.3 => TLS 1.2
2021-02-12 14:35:23 +01:00
Pascal Knecht c3e7132468 tls-server: Support HelloRetryRequest (HRR)
Adds support to request and handle retries with a different DH group.

Only the first key share extension sent by the client is currently
considered, so this might result in protocol errors if the server requests
a group for which the client already sent a key share.
2021-02-12 14:35:23 +01:00
Pascal Knecht e53bee9dbe tls-crypto: Add support to configure DH groups to use
And add new test cases to test TLS 1.3 connections for each supported DH
group.
2021-02-12 14:35:23 +01:00
Tobias Brunner 9514aa2dcc diffie-hellman: Add enum names that match proposal keywords 2021-02-12 14:35:23 +01:00
Pascal Knecht 066ac8809c tls-crypto: Generalizing DH group to TLS group mapping
This simplifies writing the key share extension as the TLS group does
not have to be cached.
2021-02-12 14:35:23 +01:00
Pascal Knecht ab70f68cf9 tls-server: Support KeyUpdate requests and answers 2021-02-12 14:35:23 +01:00
Pascal Knecht 5c4cb40e47 tls-server: Refactor writing of key share extensions
Client and server now share the same code to write this extension.
2021-02-12 14:35:23 +01:00
Pascal Knecht 7fbe2e27ec tls-server: TLS 1.3 support for TLS server implementation
Add basic support to establish a TLS 1.3 connection with a client capable
of the same protocol version.
2021-02-12 14:35:23 +01:00
Pascal Knecht 328d7af6d2 tls-crypto: Rename parameter to be more consistent
Also add missing parameter in documentation of calculate_finished method.
2021-02-12 14:35:23 +01:00
Pascal Knecht 6549adb608 tls-crypto: Fix invalid signature algorithm list building
List building also added an additional length field which is required by
client-side TLS extensions but not for server-side certificate request
extension. Now the method only returns a list of supported signature
algorithms and the implementation is responsible to add additional
length fields.

Fixes: 07f826af67 ("Fixed encoding of TLS extensions (elliptic_curves and signature_algorithms)")
2021-02-12 14:35:23 +01:00
Pascal Knecht f81c04e9e3 libtls: Add missing cipher suite and TLS extension constants
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256

- Encrypt then MAC
- Extended master secret
- Session ticket

and also add missing suites in the unit test.
2021-02-12 14:35:23 +01:00
Pascal Knecht d107198fcb tls-crypto: Rework cipher suite preference order
The reworked list follows the order of modern browsers such as
Firefox. The new order prefers more secure ciphers over weaker ones.
2021-02-12 14:35:23 +01:00
Tobias Brunner 06424efa17 tls-server: Determine supported/configured suites and versions early
If we don't do this, we might negotiate a TLS version for which we don't
have any suites configured, so that the cipher suite negotiation
subsequently fails.
2021-02-12 14:35:23 +01:00
Pascal Knecht 8a6edc08a4 tls-crypto: Check if TLS versions and cipher suites match
Only suggest TLS versions of supported cipher suites.  For instance, do not
suggest TLS 1.3 if none of its cipher suites (requiring GCM/CCM or
ChaPoly) are available.
2021-02-12 14:35:23 +01:00
Pascal Knecht f920125304 tls-peer: Don't initiate TLS connection if no cipher suites are supported
If zero cipher suites are left after all filters, tls-peer does not
try to establish a connection to the server anymore.
2021-02-12 14:35:23 +01:00
Tobias Brunner 06aad98ff0 tls-test: Make plugin list configurable via environment variable 2021-02-12 14:35:23 +01:00
Tobias Brunner 00a6280aab tls-peer: Return INVALID_STATE after changing TLS 1.3 keys
Even though we return from build(), we are not actually sending a response,
so we can't return NEED_MORE (would send an invalid ClientHello message) and
if we return SUCCESS, the EAP layer treats this as failure (there is a comment
in eap_authenticator_t about client methods never returning SUCCESS from
process()).  Instead we return INVALID_STATE, which allows tls_t.build() to
exit from the build() loop immediately and send the already generated Finished
message.
2021-02-12 14:35:23 +01:00
Tobias Brunner 121ac4b9e3 tls-crypto: Generate MSK for TLS 1.3
We generate material for both MSK and EMSK even though we only need the
former.  Because HKDF-Expand-Label(), on which the export functionality
is based, encodes the requested key length, we have to allocate the same
number of bytes as e.g. FreeRADIUS does (i.e. if we only request 64
bytes, those won't be the same as the first 64 bytes after requesting
128 bytes).

Unfortunately, key derivation for TLS-based methods is currently not
standardized for TLS 1.3.  There is a draft [1], which defines a scheme
that's different from previous versions (instead of individual label
strings it uses a single one and passes the EAP type/code as context
value to TLS-Export()).  The current code is compatible to FreeRADIUS
3.0.x, which doesn't implement it according to that draft yet (there are
unreleased changes for EAP-TLS, not for the other methods, but these only
switch the label, no context value is passed).  In a separate draft
for EAP-TLS [2] there is an altogether different scheme defined in the
latest version (label combined with EAP method, no context and separate
derivation for MSK and EMSK).

So this is a mess and we will have to change this later with the inevitable
compatibility issues (we should definitely disable TLS 1.3 by default).

[1] https://tools.ietf.org/html/draft-ietf-emu-tls-eap-types
[2] https://tools.ietf.org/html/draft-ietf-emu-eap-tls13
2021-02-12 14:35:23 +01:00
Tobias Brunner d2fe921cf5 tls-hkdf: Add method that allows exporting key material 2021-02-12 11:45:44 +01:00
Tobias Brunner 86cda1a3c0 tls-hkdf: Handle label expansion inside expand_label()
We have to expand arbitrary external labels the same way when exporting
key material.
2021-02-12 11:45:44 +01:00
Tobias Brunner 3e89d26e1c tls-hkdf: Pass secret to derive_secret() explicitly 2021-02-12 11:45:44 +01:00
Tobias Brunner 4e2b8f9c71 tls-hkdf: Store OKM in local variables 2021-02-12 11:45:44 +01:00
Tobias Brunner 1b593e1d48 tls-crypto: Add support for RSA-PSS signatures
PKCS#1 v1.5 signatures are not defined for use with TLS 1.3 (they can
only appear in certificates, we now send a signature_algorithms_cert
extension to indicate support for them).  So for RSA certificates, we
must support RSA-PSS signatures.

There are two sets of schemes, that are differentiated by the type of
RSA key used for the signature, one is for classic RSA keys (rsaEncryption
OID), which can also be used with PKCS#1 when using TLS 1.2, the other
is for RSA-PSS keys (RSASSA-PSS OID), which are not yet commonly
used (and can't be generated by our pki tool).  According to the RFC,
PSS must also be supported for TLS 1.2 if the schemes are included in
the signature_algorithms extension (e.g. OpenSSL does not use PKCS#1 v1.5
anymore if PSS is proposed).

This changes how these schemes are stored and enumerated (they are not
treated as combination of hash algo and key type anymore).

Legacy schemes (MD5/SHA-1) are removed.
2021-02-12 11:45:47 +01:00
Tobias Brunner e02f19e3c6 tls-peer: Support answering KeyUpdate requests 2021-02-12 11:45:44 +01:00
Tobias Brunner 27360d3407 tls-socket: Change how EOF of the underlying socket is handled
With the previous code, there was an issue when replying to TLS 1.3
post-handshake messages.  In this case, SUCCESS is eventually returned
from build(), however, no actual data has been received so in_done is 0.
This was interpreted as EOF, plain_eof was set to TRUE and no further data
was read from the socket afterwards.

Returning SUCCESS from build() if the exchange is initiated by
write_(), as is the case with the finished reply, never was a problem
because there the return value of 0 is not interpreted as EOF.
2021-02-12 11:45:44 +01:00
Tobias Brunner bfcb49b393 tls-peer: Add support to handle KeyUpdate message
We currently don't support switching our own keys and sending the
message if requested by the server.
2021-02-12 11:45:44 +01:00
Tobias Brunner 1466d4da25 tls-crypto: Add method to update application traffic keys 2021-02-12 11:45:44 +01:00
Tobias Brunner b51c1d468e tls-hkdf: Support updating client/server traffic secrets 2021-02-12 11:45:44 +01:00
Tobias Brunner 09fbaad6bd tls-socket: Don't fail reading if sending data failed
If data is processed that eventually includes a TLS close notify, build()
will fail after a close notify has been sent in turn.  However, propagating
that error immediately when reading prevented ever returning the data
already processed before the close notify was received.
2021-02-12 11:45:44 +01:00
Tobias Brunner d532d6c7bc tls-peer: Correctly handle classic ECDH key-share format
Similar to TLS 1.2 but uses a 16-bit length header.
2021-02-12 11:45:44 +01:00
Tobias Brunner 8e35b1f1a5 tls-test: Add options to configure TLS versions 2021-02-12 11:45:44 +01:00
Tobias Brunner a7f2818832 tls-socket: Allow configuring both minimum and maximum TLS versions 2021-02-12 11:45:44 +01:00
Tobias Brunner c4576a1f57 tls: Allow setting both minimum and maximum TLS versions
This allows to increase the initial minimum version and also prevents
sending a list of versions during retries when 1.3 was already
negotiated.
2021-02-12 11:45:44 +01:00
Tobias Brunner 2b6565c236 tls-peer: Handle HelloRetryRequest
Adds support to handle retries with different DH group and/or a cookie
extension.
2021-02-12 11:45:44 +01:00
Tobias Brunner 2271d67f07 tls-crypto: Add method to hash handshake data and use result as initial transcript
This is used for HelloRetryRequest.
2021-02-12 11:45:44 +01:00
Tobias Brunner 64e63c68c8 tls-crypto: Destroy HKDF instance if keys are derived multiple times
This will be the case during a retry.
2021-02-12 11:45:44 +01:00
Tobias Brunner 851b605e21 tls-peer: Refactor writing of extensions and use less hard-coded DH group
Note that this breaks connecting to many TLS 1.3 servers until we support
HelloRetryRequest as we now send a key_share for ECP_256 while still
proposing other groups, so many servers request to use CURVE_25519.
2021-02-12 11:45:44 +01:00
Tobias Brunner de31646a09 tls-peer: Refactor sending/processing finished message
Also fixes leaks.
2021-02-12 11:45:44 +01:00
Tobias Brunner 44cda40d58 tls-peer: Simply ignore certificate request context
This SHALL be zero length for server authentication anyway.
2021-02-12 11:45:44 +01:00
Tobias Brunner bfa3178836 tls-peer: Use existing code to verify certificate and signature 2021-02-12 11:45:44 +01:00
Tobias Brunner c78b2bee5d tls-peer: Refactor parsing of TLS extensions
Also adds proper error handling.
2021-02-12 11:45:44 +01:00
Tobias Brunner f0ed5f9125 tls-peer: Fix parsing of encrypted extensions 2021-02-12 11:45:44 +01:00
Tobias Brunner 4c40a3d3f0 tls-peer: Fix parsing of intermediate CA certificates 2021-02-12 11:45:44 +01:00
Tobias Brunner 2e1c0a2776 tls-crypto: Rename methods to calculate finished message
Instead of the version number use "legacy" for the one for earlier TLS
versions.
2021-02-12 11:45:44 +01:00
Tobias Brunner f116a4823f tls-crypto: Use internal PRF of tls-hkdf to generate finished message
Also adds additional checks.
2021-02-12 11:45:44 +01:00
Tobias Brunner a9f661f52a tls-hkdf: Add helper method to allocate data from the internal PRF 2021-02-12 11:45:44 +01:00
Tobias Brunner 6a0ee0c23c tls-hkdf: Cleanups and refactorings
The main refactoring is how secrets (PSK/DH) are handled.
2021-02-12 11:45:44 +01:00
Tobias Brunner de983a3cb9 tls-crypto: Simplify signature creation/verification 2021-02-12 11:45:44 +01:00
Tobias Brunner 2921f43705 tls-crypto: Simplify handshake/application key derivation and rename methods
Also consistently change the ciphers outside of tls_crypto_t and
simplify key derivation in tls_peer_t and fix a memory leak.
2021-02-12 11:45:44 +01:00
Tobias Brunner fff1974012 tls-hkdf: Make labels enum a proper type 2021-02-12 11:45:44 +01:00
Tobias Brunner 8495138d4a tls-peer: Support x25519/448 for TLS 1.2
These DH groups don't use the point format prefix (RFC 8422 deprecated
any other format anyway).  Since they are enumerated now, they can also
be used by servers for TLS 1.2.
2021-02-12 11:45:44 +01:00
Tobias Brunner 3101120c75 tls-crypto: Enumerate x25519/448 and rename constant for consistency 2021-02-12 11:45:44 +01:00
Tobias Brunner 53ba0801ac tls-crypto: Simplify hash algorithm handling 2021-02-12 11:45:44 +01:00
Tobias Brunner 43c8f950a7 tls-crypto: Delay instantiation of cipher suites
This way we can take into account the version set via setter on tls_t.
2021-02-12 11:45:44 +01:00
Tobias Brunner 281766c5e6 tls-crypto: Filter TLS cipher suites by min/max version
There is no point proposing legacy (or future) cipher suites depending on
the proposed TLS versions. It was actually possible to negotiate and use
cipher suites only defined for TLS 1.2 with earlier TLS versions.
2021-02-12 11:45:44 +01:00
Tobias Brunner 436571b2f0 tls-crypto: Correctly filter cipher suites based on PRF algorithms
The previous check operated on the first array element.
2021-02-12 11:45:44 +01:00
Tobias Brunner b7ea969b32 tls-crypto: Use correct key length for ChaCha20/Poly1305 2021-02-12 11:45:44 +01:00
Tobias Brunner ba3c90ded1 libtls: Some code style fixes 2021-02-12 11:45:44 +01:00
Tobias Brunner 4099035a0c tls-test: Make address family configurable and simplify DNS/socket handling 2021-02-12 11:45:44 +01:00
bytinbit 7a2b02667c libtls: Implement TLS 1.3 handshake on client-side
The code is a minimal handshake with the HelloRetryRequest message
implementation missing.
Can be tested with an OpenSSL server running TLS 1.3. The server must
be at least version 1.1.1 (September 2018).

Co-authored-by: ryru <pascal.knecht@hsr.ch>
2021-02-12 11:45:44 +01:00
Pascal K 02d7405512 libtls: Implement HKDF for TLS 1.3
TLS 1.3 uses HMAC-based Extract-and-Expand Key Derivation Function (HKDF)
as defined in RFC 5869 to compute traffic secrets.

Co-authored-by: bytinbit <meline.sieber@hsr.ch>
2021-02-12 11:45:44 +01:00
Tobias Brunner 3d83d348f4 libtls: Add support to run unit tests with a custom plugin list 2021-02-12 11:45:44 +01:00
Tobias Brunner 818dc86568 libtls: Add TLS 1.3 implementation of tls_aead_t
The key material, in particular the nonce/IV, is derived differently and
the IV is also generated in a different way.  Additionally, the actual
content type is encrypted and there may be optional padding to mask the
actual size of the encrypted data.
2021-02-12 11:45:44 +01:00
Tobias Brunner ba2bcdd882 libtls: Allow tls_aead_t to change the content type
The actual content type is encrypted with TLS 1.3, the type in the record
header is always Application Data.
2021-02-12 11:45:44 +01:00
Andreas Steffen 0d43b39931 testing: extended sleep time tkm/xfrmproxy tests 2021-02-12 09:44:00 +01:00
Andreas Steffen ab58f95b12 Version bump to 5.9.2dr2 2021-02-12 08:17:54 +01:00
Tobias Brunner cc25d2195a testing: Copy /etc/resolv.conf from host in chroot script
This makes installing packages etc. easier.
2021-02-11 16:41:06 +01:00
Tobias Brunner f3acc0a87b appveyor: Set timezone on the build system
For some reason, setting the time zone via TZ to `GST-1GDT` in the utils test
doesn't work anymore (the DST zone is not considered, it's as if only `GST-1`
was configured).
2021-02-11 16:40:58 +01:00
Tobias Brunner 8ff8b85ce6 appveyor: Create dummy strongswan.conf file to avoid log messages
Only relevant when increasing the verbosity, but causes quite a lot of
them then.
2021-02-11 16:40:58 +01:00
Tobias Brunner 671164865b appveyor: Print OpenSSL version 2021-02-11 16:40:58 +01:00
Tobias Brunner 781ad0b93b openssl: Allocate our own buffer for i2d_* wrapper macro
If we pass a pointer to NULL, the memory allocated by OpenSSL has to be
freed with OPENSSL_free().  Otherwise, this can lead to random
crashes/freezes for Windows builds as seen on AppVeyor.  To not
complicate things for callers of this macro, we allocate our own memory,
which we already do for other i2d_* calls.
2021-02-11 16:40:58 +01:00
Tobias Brunner 6a440f83ab openssl: Reset HMAC key if chunk_empty is passed
If no valid key is configured (e.g. because it's inadvertently uninitialized),
we should not just reuse the previous key.

The `key_set` flag is not necessary anymore because a non-NULL key is set
during initialization since 6b347d5232 ("openssl: Ensure underlying hash
algorithm is available during HMAC init").
2021-02-11 16:40:58 +01:00
Tobias Brunner cd10ae2ff0 android: Explicitly apply DNS servers to the TUN device
If the peer deletes the CHILD_SA, we recreate it due to the close
action.  However, if we create a new TUN device, we do so with a new
VpnService.Builder object and on that the DNS servers were never applied.
The latter happened only on the fly in the attribute handler when an
IKE_SA was established.  Now we do this explicitly when creating the TUN
device, like the virtual IPs and routes.  While we could avoid the
recreation of the TUN device if the CHILD_SA is recreated, there is the
theoretical possibility that the remote traffic selectors change.  This
way we also avoid adding stuff to the builder in different places.

Fixes #3637.
2021-02-04 16:52:15 +01:00
Tobias Brunner 4dc9edfa55 swanctl: Don't print status message if nothing was loaded to stderr
This is not an error (as reflected by the returned status code) so we
should not print to stderr as output there might still be considered an
error (or at least an audit-worthy event) by some scripts.
2021-02-04 16:50:36 +01:00
Thomas Egerer 2566eb2194 plugin-loader: Add optional filter for plugin features
In some cases, the algorithms that have been compiled into a plugin have
to be disabled at runtime. Based on the array returned by the get_features()
function the optionally provided function can strip algorithms or even
callbacks or registrations from a plugin, giving us a handy and powerful way
for runtime feature configuration aside from the plugin list.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2021-02-04 16:39:27 +01:00
Tobias Brunner e6a6fc33b6 path: Also accept / as directory separator on Windows
This adds helper functions to determine the first or last directory separator
in a string and to check if a given character is a separator.

Paths starting with a separator are now also considered absolute on
Windows as these are rooted at the current drive.

Note that it's fine to use DIRECTORY_SEPARATOR when combining strings as
Windows API calls accept both forward and backward slashes as separators.

Co-authored-by: Michał Skalski <mskalski@enigma.com.pl>

References #3684.
2021-02-03 17:27:57 +01:00
Tobias Brunner 3de65f8d67 enumerator: Implement globbing enumerator on Windows
We don't have glob() available there.  This replacement should work
similarly for simple cases like `include conf.d/*.conf`.

Fixes #3684.
2021-02-03 17:27:31 +01:00
Tobias Brunner 4525233b1e vici: Fix refcount for CA certificates when reloading authority sections
Fixes: 3c5e7eaa88 ("vici: Keep track of all CA certificates in vici_authority_t")
2021-01-27 16:50:17 +01:00
Tobias Brunner 6c26267b07 openssl: Fix potential crash with ECDH on Windows
Apparently, we should use OPENSSL_free() to release memory allocated by
OpenSSL.  While it generally maps to free() that's apparently not the
case on Windows, where the ECP test vectors caused `ACCESS_VIOLATION
exception` crashes (not always the same vector).

Fixes: 74e02ff5e6 ("openssl: Mainly use EVP interface for ECDH")
2021-01-27 16:37:45 +01:00
Tobias Brunner 55df5e9797 openssl: Avoid conflicts with wincrypt.h on Windows
There are several conflicts with newer versions of OpenSSL (> 1.0).
2021-01-27 16:32:43 +01:00
Tobias Brunner a5f4b996bf appveyor: Also build against newer OpenSSL versions
The original version is 1.0.2, which we keep as that version is not in
use on other platforms anymore.
2021-01-27 16:32:43 +01:00
Michał Skalski 14a0c08235 Enable Windows CI build of pkcs11 plugin 2021-01-27 16:32:43 +01:00
Michał Skalski f30187d422 pkcs11: Fix build on Windows
Windows provides CreateMutexA/W with an alias called CreateMutex that
selects one of the other two based on the UNICODE constant.
2021-01-25 15:16:12 +01:00
Tobias Brunner 8d8739ace6 github: Enable farp plugin on macOS 2021-01-22 10:44:05 +01:00
Tobias Brunner 1af4ae8732 cirrus: Build farp plugin on FreeBSD 2021-01-22 10:44:05 +01:00
Dan James 95a0d800c9 farp: Add support for macOS and FreeBSD
Co-authored-by: Tobias Brunner <tobias@strongswan.org>

Closes strongswan/strongswan#189.
References #3498.
2021-01-22 10:44:05 +01:00
Tobias Brunner 8e367df6db Merge branch 'openssl-ecp'
Uses the EVP interface for ECDH with newer OpenSSL versions, which,
compared to the previous low-level use of EC_POINT_mul() supports
hardware offloading.  We used this because of the ecp_x_coordinate_only
option, which is now removed as it's been obsolete for a long time and
complicated the code.  There is still some legacy code for OpenSSL 1.0
and the old BoringSSL version we currently use for the Android app.

Closes strongswan/strongswan#186.
2021-01-20 17:54:42 +01:00
Tobias Brunner 74e02ff5e6 openssl: Mainly use EVP interface for ECDH
Functions like ECDH_compute_key() will be removed with OpenSSL 3 (which
will require additional changes as other functions will be deprecated or
removed too).
2021-01-20 17:53:35 +01:00
Tobias Brunner 5fdc979770 openssl: Extract helper function to derive a shared DH secret 2021-01-20 17:53:35 +01:00
Tobias Brunner 86fb24c2c5 Remove the ecp_x_coordinate_only option
This was for compatibility with very old releases and only complicates
things unnecessarily nowadays.
2021-01-20 17:53:35 +01:00
Mahantesh Salimath 7733ff7d4e openssl: Use ECDH_compute_key() for 'x-coordinate only' setting
ECDH_compute_key() was not used because it only gives x-coordinate of
the result. However, the default setting, as per the errata mentioned,
is to use x-coordinate only.
Use ECDH_compute_key() for this setting as it additionally allows HW
offload of the computation using dynamic engine feature in OpenSSL.
EC_POINT_mul() doesn't allow HW offload.

Signed-off-by: Mahantesh Salimath <mahantesh@nvidia.com>
2021-01-20 17:53:35 +01:00
Tobias Brunner aa3d5bf791 Revert "nm: Remove dummy TUN device"
This reverts commit a28c6269a4.

We add a dummy TUN device again because systemd-resolved insists on
managing DNS servers per interface.

Fixes #3615.
2021-01-19 14:49:48 +01:00
Tobias Brunner bd9b50dcd3 load-tester: Correctly encode serial of generated client certificates
The previous approach would lead to additional zero prefixes in the
encoding of the serial (which is a positive integer, not an arbitrary
blob).

Fixes #3667.
2021-01-18 17:44:59 +01:00
Коренберг Марк d8e4a2a777 identification: Change abbreviation for surname/serialNumber RDNs
To align with RFC 4519, section 2.31/32, the abbreviation for surname
is changed to "SN" that was previously used for serialNumber, which does
not have an abbreviation.

This mapping had its origins in the X.509 patch for FreeS/WAN that was
started in 2000.  It was aligned with how OpenSSL did this in earlier
versions.  However, there it was changed already in March 2002 (commit
ffbe98b7630d604263cfb1118c67ca2617a8e222) to make it compatible with
RFC 2256 (predecessor of RFC 4519).

Co-authored-by: Tobias Brunner <tobias@strongswan.org>

Closes strongswan/strongswan#179.
2021-01-18 17:41:37 +01:00
Tobias Brunner 2610cd7928 vici: Decode error messages in Python bindings
Otherwise we might end up with b'<errmsg>' in the output.
2021-01-18 17:39:15 +01:00
Tobias Brunner 414f2c3754 mem-pool: Be less strict when reassigning existing online leases
Also assign online leases to a peer connecting from the same endpoint
when it requests any virtual IP.  This is mainly a workaround for
Windows clients that remember the virtual IPv6 address and re-request it
the next time the connection is initiated (even if it is not a
reauthentication) but don't do the same for virtual IPv4 addresses.
This can result in duplicate policies with different reqids because
these are allocated for unique sets of traffic selectors.

Fixes #3541.
2021-01-18 13:58:01 +01:00
Tobias Brunner f97875b72e Merge branch 'ike-update-event'
This modifies the signature of the listener_t::ike_update() callback so
that both addresses are passed and it's only called once if both
addresses change (e.g. for an address family switch).

The callback is now also triggered for MOBIKE updates and the event is
exposed via vici.

Fixes #3602.
2021-01-18 13:33:26 +01:00
Tobias Brunner d79cefc3fc vici: Expose ike-update event 2021-01-18 11:34:40 +01:00
Tobias Brunner 2b255f01af ike-mobike: Use ike_sa_t::update_hosts() to trigger events
We should trigger the ike_update() event for MOBIKE updates and since
update_hosts() updates the children we can reuse that code too.
2021-01-18 11:34:40 +01:00
Tobias Brunner 51c7cf9a04 ike-sa: Add flags to force updating hosts/CHILD_SAs
This allows more fine grained control over what's updated and does not
require multiple calls of the method. Plus we'll be able to use it in
the ike-mobike task.
2021-01-18 11:34:40 +01:00
Tobias Brunner 08a3ee0cce bus: Change ike_update() signature and only call it once
This avoids multiple events when both addresses change (e.g. switching
address families).
2021-01-18 11:34:40 +01:00
Tobias Brunner 5ef10ec326 testing: Add scenarios that use a CA with two intermediate CA certificates
Mainly to test TKM's ability for handling multiple CAs and that the
received intermediate CA certificates are passed in the right order.
But also added a regular scenario where two intermediate CA certificates
are sent by one of the clients.
2021-01-11 15:28:10 +01:00
Tobias Brunner 16fcdb460a charon-tkm: Don't use starter/stroke with charon-tkm anymore
For the tests, the unused init script that was used before switching to
charon-systemd is repurposed to manage the daemon.
2021-01-11 15:28:01 +01:00
Tobias Brunner b322539ef5 charon-tkm: Deinitialize IKE tkm-rpc client
This is necessary if tkm-rpc supports multiple parallel client requests.
2021-01-08 17:22:37 +01:00
Tobias Brunner e637cf8b4a charon-tkm: Remove -gnat05 option not supported by newer compilers 2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger a0a0571bd1 charon-tkm: Reverse cert chain processing order
Verify certificate chains starting from the root CA certificate and
moving towards the leaf/user certificate.

Also update TKM-RPC and TKM in testing scripts to version supporting the
reworked CC handling.
2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger 532023dcf1 testing: Use latest TKM RPC library
Brings some cleanups and minor improvements.
2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger eccca505aa testing: Use multi-CA aware TKM
Also add CA ID to tkm_keymanager command.
2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger d6cf4a165b testing: Add CA ID mappings to TKM tests
Extend the build-certs-chroot script is to fill in the public key
fingerprint of the CA certificate in the appropriate strongswan.con
files.
2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger f8242127a2 charon-tkm: Add support for multiple CAs
Load CA certificate id mapping from config and pass the correct CA ID to
TKM when checking certificate chains. The mapping of CA certificate to
CA ID is done via SHA-1 hash of the CA certificates subjectPublicKey.
2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger 73d2a11aee charon-tkm: Register TKM cred encoder before init
Make sure the credential encoder is available early to allow getting
public key fingerprints.
2021-01-08 17:22:36 +01:00
Adrian-Ken Rueegsegger 524751ae76 testing: Switch to https for codelabs recipes 2021-01-08 17:22:36 +01:00
Tobias Brunner fde5374a86 testing: Explicitly encode backing image format in metadata
Apparently, there is no probing anymore in newer versions of qemu due
to security considerations.
2021-01-08 11:39:44 +01:00
Andreas Steffen fcb595f961 Version bump to 5.9.2dr1 2021-01-08 11:00:15 +01:00
Andreas Steffen 2889133cc0 imc_attestation: Fixed double free of tpm_version_info chunk 2021-01-08 11:00:15 +01:00
Andreas Steffen 08760dd927 tpm: Intel FW TPM always uses locality 0 2021-01-08 11:00:15 +01:00
Andreas Steffen 2ea1dac203 libimcv: Support symlinks introduced by usrmerge
Debian, Ubuntu, Fedora et. al. started to apply usrmerge to their
latest Linux distributions, i.e.  /bin, /sbin, and /lib are now
symbolical links to /usr/bin, /usr/sbin, and /usr/lib, respectively.
Since executables and libraries are contained only once in Linux
packages (e.g. /bin/cp in coreutils but not /usr/bin/cp) this leads
to missing file measurments due to the symlinks when doing remote
attestation.

The new ita_attr_symlinks PA-TNC attribute fixes this problem by
collecting symbolic links pointing to directories on the client
platform.
2021-01-08 11:00:15 +01:00
Andreas Steffen 9b4a2322d6 libimcv: Evaluate IMA SHA-256 measurements 2021-01-08 11:00:15 +01:00
Tobias Brunner 839d6c8f80 github: Bump wolfSSL to 4.6.0
Also enables Brainpool curves (this only enables the BP curves, while
--enable-ecccustcurves=all would also enable several others we don't support).
2021-01-04 16:09:58 +01:00
Tobias Brunner ea7945a4f5 wolfssl: Disable ECC curves based on minimum ECC key size
wolfSSL 4.6.0 provides a new option to configure the minimum ECC key
size (--with-eccminsz), which currently defaults to 224 bits.
2021-01-04 16:09:56 +01:00
Tobias Brunner 6e2e359f38 wolfssl: Correctly enable Brainpool curves 2021-01-04 16:09:22 +01:00
Andreas Steffen f397fc02e9 configure: Fixed test for imv_swima 2020-12-24 13:08:49 +01:00
Tobias Brunner 51f4837628 cirrus: Build against tpm2-tss on FreeBSD
This was enabled in the port too.
2020-12-15 10:42:43 +01:00
Tobias Brunner ec9f986b61 Ignore verbose parser generator output file more generally
Depending on from where bison is called, the file might not end up in
the same directory as the .y file, but the location of the Makefile.
This has been seen on FreeBSD.
2020-12-15 10:42:43 +01:00
Tobias Brunner 192581e785 Replace two deprecated parser generator directives
There is a conflict between Flex's bison-bridge and Bison's api.prefix
options.  Apparently, the former was added without consulting the Bison
devs and requires YYSTYPE, which is not added to the header anymore by
the latter.  Instead, we just provide the proper definition of yyflex()
manually (as recommended by the Bison docs), so the option is not
required anymore.
2020-12-15 10:42:43 +01:00
Tobias Brunner 8468b43891 github: Prevent duplicate CI runs
This cancels previous runs of the same branch and skips runs of the same
content (e.g. after merges or tags).
2020-12-15 10:42:43 +01:00
Tobias Brunner de401e0e89 github: Migrate from Travis CI to Github Actions
On travis-ci.com (travis-ci.org will be discontinued by the end of the
year) we are now charged for each minute.  We only got 10000 credits in
a trial plan, which we used up with a few builds.  Minutes also cost a
different amount of credits on different platforms: 10 on Linux,
but 50 on macOS (installing the dependencies on macOS alone took 12-15
minutes on Travis for some reason, takes about half on Github's runners).

No native Windows build yet as we have the same issue as on AppVeyor where
threading/streaming tests might get stuck.  And there is also only a
single Windows platform to test on.  Plus building/testing on Windows is
very slow (and getting ccache to work seems tricky).

The 'sw_collector' test case had to be disabled because we can't access
/usr/local/share on the Github build hosts (the process is just blocked
in readdir() and eventually times out).

Unfortunately, we can't test on different architectures anymore (in
particular ARM and the big-endian IBM Z/x390x).
2020-12-15 10:42:43 +01:00
Tobias Brunner eb4cd8e3b1 imv-scanner: Fix potentially unsafe port filter attribute destruction
DESTROY_IF() checks if the given value is not NULL, before calling
destroy() on it, which does not work for sub-structs.  If
port_filter_attr is NULL, this could crash.
2020-12-03 12:19:06 +01:00
Tobias Brunner 25ec2d04aa child-rekey: Don't migrate child-create task if we already are deleting
If we are already deleting the old/redundant CHILD_SA, we must not
migrate the child-create task as that would destroy the new CHILD_SA we
already moved to the IKE_SA.

Fixes #3644.
2020-12-03 11:06:23 +01:00
Tobias Brunner 7d2d94f3e1 host-resolver: Don't wait for a reply if there are no threads
Without threads handling the resolution, there is no point waiting
for a reply.  If no subsequent resolution successfully starts a
thread (there might not even be one), we'd wait indefinitely.

Fixes #3634.
2020-12-03 08:36:20 +01:00
Tobias Brunner 9248f636b0 kernel-netlink: Make sure we successfully opened a Netlink socket
This is in addition to the fix in the destructor in 991e9e5dc9.
2020-12-03 08:34:18 +01:00
Tobias Brunner e8fae43768 identification: Validate ASN.1 DN in from_data() constructor
The DN is otherwise not parsed until compared/printed.  This avoids
false detections as ASN.1 DN if e.g. an email address starts with "0",
which is 0x30 = ASN.1 sequence tag, and the next character denotes
the exact length of the rest of the string (see the unit tests for an
example).
2020-12-03 08:23:54 +01:00
Tobias Brunner 4c61d7aedc android: New release after avoiding marking VPN connections as metered 2020-12-02 16:09:38 +01:00
Tobias Brunner b32a9be419 android: Don't default to marking VPN connections as metered
For apps targeting Android 10, where a method to change this was added, the
default changed so that all VPN connections are marked as metered.  This means
certain background operations (e.g. syncing data) are not performed anymore
even when connected to a WiFi.  By setting this to false, the metered state
of the VPN connection reflects that of the underlying networks.
2020-12-01 16:00:09 +01:00
Tobias Brunner b58740996f testing: Use build-strongswan to implement build-rootimage 2020-11-27 12:05:22 +01:00
Tobias Brunner 88c94063d2 testing: Make building guest images after strongSwan optional
This is basically only for the build-rootimage use case.
2020-11-27 12:05:22 +01:00
Tobias Brunner 386e9a96a1 testing: Optionally build strongSwan from a release tarball
This will allow us to replace the build-rootimage script.
2020-11-27 12:05:22 +01:00
Tobias Brunner a7d920059e testing: Optionally replace root image when building strongSwan 2020-11-27 12:05:22 +01:00
Tobias Brunner c1dc7c4149 testing: Optionally use a new strongSwan build directory
This can be useful when building completely different versions for the
first time to avoid issues with build artifacts of previous builds.
2020-11-27 12:05:22 +01:00
Tobias Brunner 543d09c4b4 testing: Add option to build all software recipes when building strongSwan
This is like building the root image but using a specific strongSwan
source tree, which is helpful if code changes depend on other software
packages (e.g. TKM-related or testing new crypto libraries).  If the script
is called and the root image does not exist, the new option is enabled
automatically.

The option to build in a specific guest image is now also moved to an
explicit command line option so that the source dir path is the only
remaining positional argument (see --help for details).
2020-11-27 12:05:22 +01:00
Tobias Brunner edc55f0876 testing: Create root image if it does not exist yet when building strongSwan
This allows running the script directly after building the base image.
2020-11-27 12:05:22 +01:00
Tobias Brunner 29c59885ca Use Botan 2.17.1 for tests 2020-11-27 12:05:22 +01:00
Tobias Brunner 1c2f5eea2c testing: Improve building different revisions of Git-recipes
If we check out and build a certain revision of a dependency in a branch and
switch to another that requires a different revision and then switch back,
the previous approach installed the wrong revision as it would incorrectly
assume the required revision was already built and ready to install.
2020-11-27 12:05:22 +01:00
Tobias Brunner abb3f67bd1 pem: Make sure we actually parsed some data
This could happen if there is no separating empty line between header
and body.

References #3627.
2020-11-13 16:40:01 +01:00
Tobias Brunner 38a7816034 appveyor: Also build on Windows Server 2019 2020-11-13 16:38:17 +01:00
Tobias Brunner ce433c9b29 kernel-wfp: Declare constants explicitly as extern
Newer compilers otherwise complain that there are multiple definitions
of these (in header and .c file).
2020-11-13 16:38:17 +01:00
Tobias Brunner 4fc6b79b93 libimcv: Avoid compiler warning in segmentation unit test
Newer versions of GCC complain that the variable may be used
uninitialized.
2020-11-13 16:38:17 +01:00
Tobias Brunner eec08b41a8 windows: Don't declare [v]asprintf()
None of our build environments seem to require these declarations.  And
current versions of MinGW-w64 define them as inline functions in stdio.h
so these declarations clashed with that ("static declaration of '...'
follows non-static declaration").
2020-11-13 16:38:17 +01:00
Andreas Steffen 0fc6767097 Version bump to 5.9.1 2020-11-10 20:45:13 +01:00
Shmulik Ladkani 1607e538e9 controller: Always return SUCCESS when terminating IKE_SAs without callback
If no callback is specified, terminate_ike_execute() is invoked without the
listener waiting on the IKE state change.

Now, if 'force' is false, then ike_sa->delete() just queues an
IKE_DELETE task, and returns SUCCESS - indicating successful task
manager initiation.

However, terminate_ike_execute() ignored this success and set the
status to FAILED.

This is not ideal, as it will be the overall return code of
terminate_ike(), although no failure did occur. This eventually leads
vici's "terminate" to return "Command failed: terminating SA failed",
as seen in this example:

    In [9]: list(session.terminate({'ike-id': 2960, 'timeout': -1}))
    ---------------------------------------------------------------------------
    CommandException                          Traceback (most recent call last)
    <ipython-input-9-5f95b5cea88f> in <module>()
    ----> 1 list(session.terminate({'ike-id': 2960, 'timeout': -1}))

    vici/session.pyc in streamed_request(self, command, event_stream_type, message)
        136                 raise CommandException(
        137                     "Command failed: {errmsg}".format(
    --> 138                         errmsg=command_response["errmsg"]
        139                     )
        140                 )

    CommandException: Command failed: terminating SA failed

If we consider both queueing the task and actually destroying the IKS_SA
a success, we can just always return SUCCESS if we don't have a
callback. There is also no need to explicitly set the status to FAILED
if a listener is waiting as that's the default anyway.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>

Closes strongswan/strongswan#185.
2020-11-04 19:42:41 +01:00
Tobias Brunner 70b0c730d0 gcrypt: Use a dummy buffer to initialize static allocations
In FIPS mode, libgcrypt uses a DRBG, which behaves differently when the
length passed to gcry_create_nonce() or gcry_randomize() is <= 0.  It
expects a struct and explicitly checks that the passed pointer is not
NULL.
2020-11-04 10:06:46 +01:00
Tobias Brunner a59842eb95 parser-helper: Don't attempt to open anything but regular files
A crash could be provoked e.g. via STRONGSWAN_CONF=. or any other
path to a directory.
2020-11-04 10:06:46 +01:00
Tobias Brunner 991e9e5dc9 kernel-netlink: Only attempt to remove routing rule if we have a socket 2020-11-04 10:06:46 +01:00
Tobias Brunner 19343998bb imv-attestation: Fix typo in default value for hash_algorithm option 2020-11-04 10:06:46 +01:00
Tobias Brunner f0f65b20ae libimcv: Remove empty 'swid' Doxygen group
The corresponding IMC/IMV were already removed with a31f9b7691 ("libimcv:
Removed TCG SWID IMC/IMV support").
2020-11-04 10:06:46 +01:00
Tobias Brunner a6f0e19bf5 Fixed some typos, courtesy of codespell 2020-11-04 10:06:46 +01:00
Tobias Brunner dff243a1bd NEWS: Add news for 5.9.1 2020-11-04 10:06:46 +01:00
Andreas Steffen d63e6156bb Version bump to 5.9.1rc1 2020-11-01 18:45:34 +01:00
Tobias Brunner bb87e63ca6 child-sa: Delete inbound SAs even if not installed to remove allocated SPIs
If we can't establish an SA, this should delete the allocated SPI.
2020-10-30 13:08:16 +01:00
Tobias Brunner ef636316d2 vici: Send all queued messages during shutdown
This ensures that e.g. ike/child-updown messages are sent that were
queued but couldn't be sent (even the job to enable to on_write() callback
requires a worker thread that's not around anymore during shutdown).

References #3602.
2020-10-30 09:58:42 +01:00
Tobias Brunner 6586f07162 ikev2: Clear fragments of a retransmitted message if we receive the next one
The message_t object used for defragmentation was only cleared after
all fragments have been received and the message was delivered.  So
if we received only some fragments of a retransmitted message, the
fragments of the next message were not processed (message_t returns
INVALID_ARG if the message ID does not match causing the message to
get ignored).  This rendered the IKE_SA unusable as the client
obviously never retransmitted the fragments of that previous message
after it received our response.
2020-10-29 14:06:19 +01:00
Tobias Brunner 364e69b683 Merge branch 'android-ipv6-transport'
Adds support to use IPv6 as transport addresses for IKE and ESP and a
bunch of fixes.  On Linux servers, this requires at least a 5.8 kernel so
UDP encapsulation for IPv6 is supported.

Fixes #892.
2020-10-29 11:23:48 +01:00
Tobias Brunner 01fee62f46 android: New release after adding IPv6 support and several fixes 2020-10-29 10:57:07 +01:00
Tobias Brunner ec317c29ca android: Throw an exception if UUID can't get parsed
The parser is quite picky and e.g. doesn't accept UUIDs without dashes.
Even without a specific error, this at least points the users into the
right direction.

Fixes #3583.
2020-10-29 10:57:07 +01:00
Tobias Brunner 80337f4f9d android: Prevent illegalStateException when showing power whitelist dialog
If the activity is not active when the service connection is
established and handleIntent() is called, the activity's state is already
saved and any fragment transaction would result in an illegalStateException
due to state loss.  We just ignore this and wait for another initiation
attempt (via onNewIntent()).
2020-10-29 10:22:52 +01:00
Tobias Brunner 264435f626 android: Handle restarts of control activity with power whitelist dialog better
With the flag set, we basically ignore the resent intent, which is not
ideal if we have not yet actually started another activity.  The information
dialog we show first would disappear when closing and reopening the app
or even just rotating it (we hide all dialogs when receiving an intent),
but since the flag was restored, the dialog was not shown again even
when attempting to start other connections.
2020-10-29 10:22:52 +01:00
Tobias Brunner 21476a8d91 android: Make IPv6 transport flag configurable in the GUI 2020-10-29 10:22:52 +01:00
Tobias Brunner 7d10095123 android: Import IPv6 transport flag 2020-10-29 10:22:52 +01:00
Tobias Brunner 3581914387 android: Add flag to enable IPv6 transport addresses 2020-10-29 10:22:51 +01:00
Tobias Brunner 0bc826c2f2 android: IPV6_PKTINFO is supported (i.e. struct in6_pktinfo is available) 2020-10-29 10:22:51 +01:00
Tobias Brunner 294c022fae android: Add ability to lookup IPv6 source addresses 2020-10-29 10:22:51 +01:00
Tobias Brunner 217d8ab81e android: Fix port scanning IMC
Since 9e88bb987d ("Subscribed Scanner IMC/IMV to IETF_FIREWALL PA subtype")
the port filter attribute is requested with a different message type.
2020-10-29 10:22:51 +01:00
Tobias Brunner 1c82e65cbe android: Ignore deprecation warning for legacy code in NetworkManager 2020-10-29 10:22:51 +01:00
Tobias Brunner a7713372d3 android: Replace deprecated getFragmentManager() in TNC-related Fragments 2020-10-29 10:22:51 +01:00
Tobias Brunner e106fce483 android: Consistently use PreferenceManager from AndroidX
android.preference.PreferenceManager has been deprecated.  The one from
AndroidX was already in use in some places.
2020-10-29 10:22:51 +01:00
Tobias Brunner ea303d3f5a android: Update dependencies 2020-10-29 10:22:51 +01:00
Tobias Brunner f71f6f659f android: Set compile-/targetSdkVersion to 29
This will be mandatory for existing apps on Nov 2, 2020.
2020-10-29 10:22:51 +01:00
Tobias Brunner ad2caae301 android: Update Gradle plugin 2020-10-29 10:22:51 +01:00
Tobias Brunner 8f2b6d7094 testing: Ignore hosts that are not running during shutdown
This allows properly terminating the environment if a host has crashed
or was terminated manually for some reason.
2020-10-29 10:22:51 +01:00
Tobias Brunner a689e358e5 kernel-netlink: Ignore deprecated candidate source addresses
The currently used address may get deprecated e.g. if an IPv6 prefix changes.
In this case we should switch to another address.

Fixes #3511.
2020-10-29 09:46:14 +01:00
Tobias Brunner 2eb43ca405 kernel-netlink: Update cached address flags
Note that manually adding an IPv6 address without disabling duplicate
address detection (DAD, e.g. via `nodad` when using iproute2) will cause
a roam event due to a flag change after about 1-2 seconds (TENTATIVE is
removed).  If this is a problem, we might have to ignore addresses with
TENTATIVE flag when we receive a RTM_NEWADDR message until that flag is
eventually removed.

Fixes #3511.
2020-10-29 09:46:14 +01:00
Tobias Brunner 266e2dbbea README: Add missing closing quote 2020-10-28 17:09:53 +01:00
Tobias Brunner bce0c5fd74 child-create: Update CHILD_SA IP addresses before installation
We create the child_sa_t object when initiating the CREATE_CHILD_SA
request, however, the IP addresses/ports might have changed once we
eventually receive the response (potentially to a retransmit sent to
a different address).  So update them before installing the SA and
policies.

If the local address changed too and depending on the kernel
implementation, the temporary SA created to allocate the inbound SPI
might remain as it can't be updated.  This could cause issues if e.g.
the address switches back before that SA expired (the updated inbound
SA conflicts with the temporary one), or if that happens close together
and the expire (having to wait for the address update) causes the
updated SA to get deleted.

Fixes #3164.
2020-10-27 16:45:10 +01:00
Tobias Brunner 9118fd39d7 child-sa: Only query/update/delete inbound SA if it was actually installed
We usually can't do any of these things with temporary SAs created while
allocating an SPI.
2020-10-27 16:42:01 +01:00
Tobias Brunner 610745e724 unit-tests: Free allocated SPIs in mock IPsec backend 2020-10-27 16:42:01 +01:00
Tobias Brunner 29b491ed9c child-sa: No need to attempt to update policies if none are configured 2020-10-27 16:42:01 +01:00
Tobias Brunner de69d25596 child-sa: Only reinstall VIPs if any are passed 2020-10-27 16:42:00 +01:00
Tobias Brunner 60caa4f6c6 testing: Use silent rules to build strongSwan 2020-10-27 16:42:00 +01:00
Tobias Brunner f3f93cade9 load-tester: Also request a virtual IPv6 address
Fixes #3595.
2020-10-27 16:40:38 +01:00
Tobias Brunner 1d232d4954 load-tester: Use appropriate family to request addresses from source IP pools
Looks like this wasn't necessary before 40e9089889 ("Strictly enforce
address family match while acquiring mem_pool IPs").

Fixes #3595.
2020-10-27 16:40:05 +01:00
Tobias Brunner 12a3f3ca52 quick-delete: Properly handle failures to restart CHILD_SA
If DESTROY_ME is returned from initiate(), we must not touch the IKE_SA
anymore.
2020-10-27 16:35:45 +01:00
Tobias Brunner c5baa4cbd6 pkcs7: Order DER encoded attributes
The attributes are encoded as a SET OF, which means that in DER encoding
the encoded attributes have to be ordered lexicographically.

Fixes #3589.
2020-10-27 11:21:09 +01:00
Tobias Brunner 30d47ea4cb swanctl: Support any key type for decrypted keys
The previous code required explicit support for a particular key type,
of which Ed25519 and Ed448 were missing.  While a fallback to `any` would
have been possible (this is already the case for unencrypted keys in the
`private` and `pkcs8` directories, which are not parsed by swanctl), it's
not necessary (as long as swanctl and the daemon are from the same release)
and does not require the daemon to detect the key type again.

Fixes #3586.
2020-10-27 11:17:44 +01:00
Tobias Brunner 6839256773 vici: Support all defined key types
References #3586.
2020-10-27 11:17:21 +01:00
Martin Willi 7efe92130a revocation: Validate OCSP nonce only if response actually contains a nonce
Commit 27756b081c (revocation: Check that nonce in OCSP response matches)
introduced strict nonce validation to prevent replay attacks with OCSP
responses having a longer lifetime. However, many commercial CAs (such as
Digicert) do not support nonces in responses, as they reuse once-issued OCSP
responses for the OCSP lifetime. This can be problematic for replay attack
scenarios, but is nothing we can fix at our end.

With the mentioned commit, such OCSP responses get completely unusable,
requiring the fallback to CRL based revocation. CRLs don't provide any
replay protection either, so there is nothing gained security-wise, but may
require a download of several megabytes CRL data.

To make use of replay protection where available, but fix OCSP verification
where it is not, do nonce verification only if the response actually contains
a nonce. To be safe against replay attacks, one has to fix the OCSP responder
or use a different CA, but this is not something we can enforce.

Fixes #3557.
2020-10-27 10:51:51 +01:00
Tobias Brunner 706a579e96 charon-nm: Terminate if signaled by NetworkManager
This only happens during shutdown, not after terminating a connection.

Fixes #3579.
2020-10-27 10:44:33 +01:00
Tobias Brunner b422f16d10 sys-logger: Optionally log the level of each message
Fixes #3509.
2020-10-27 10:42:49 +01:00
Tobias Brunner a3f5e38b7f file-logger: Optionally log the level of each message
Fixes #3509.
2020-10-27 10:42:39 +01:00
Thomas Egerer e635d3dcbd drbg: Add missing format specifiers to debug output
Fixes: 737375a2d2 ("drbg: Implemented NIST SP-800-90A DRBG")

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2020-10-13 10:05:43 +02:00
Tobias Brunner c810912d2f libimcv: Fix Doxygen comments for some pts_meas_algo_* functions 2020-10-12 13:48:57 +02:00
Andreas Steffen f3d96b7bc9 Version bump to 5.9.1dr1 2020-10-07 16:54:32 +02:00
Andreas Steffen 3e5a528aec tpm: Auto-detection of legacy TPM 2.0 devices 2020-10-07 16:54:32 +02:00
Andreas Steffen 3ef5b23903 pts: Variable size PCR banks 2020-10-07 16:54:32 +02:00
Andreas Steffen 56de4dc596 libtpmtss: Remove aik_blob debug output 2020-10-07 16:54:32 +02:00
Andreas Steffen d647a8f91d pts: Parse TPM 2.0 BIOS/EFI event log 2020-10-07 16:54:32 +02:00
Andreas Steffen da1d7815ef tpm: TPM 2.0 supports SHA3 and CMAC 2020-10-07 16:54:32 +02:00
Tobias Brunner 78015d14ac Use Botan 2.16.0 for tests 2020-10-07 12:38:52 +02:00
Tobias Brunner 7f170e4c9c openssl: Accept CRLs issued by non-CA certificates with cRLSign keyUsage flag
The x509 plugin accepted CRL signers since forever, to be precise, since
dffb176f2b ("CRLSign keyUsage or CA basicConstraint are sufficient
for CRL validation")).

References #3529.
2020-10-05 15:39:37 +02:00
Tobias Brunner 428c0b293d testing: Build certificates when make-testing is called 2020-09-30 12:52:43 +02:00
Mingli Yu a6cd662eed init: Remove obsolete StandardOutput setting from legacy systemd unit
The standard output value "syslog" was deprecated for a while and did fall
back to "journal". It causes a warning since systemd version 246 [1].

By removing the setting it will default to DefaultStandardOutput, which
defaults to "journal".

[1] https://github.com/systemd/systemd/blob/master/NEWS#L202

Closes strongswan/strongswan#181.
2020-09-30 12:51:08 +02:00
Tobias Brunner 040608a48d Simplify handling of terminating signals in all libcharon wrappers
Closes strongswan/strongswan#182.
2020-09-30 12:47:39 +02:00
Tobias Brunner ddc5b92dfb travis: Bump tpm2-tss to 2.4.3 2020-09-24 08:52:22 +02:00
Tobias Brunner 692feffaf3 lgtm: Fix building dependencies (in particular tpm2-tss)
This was moved to a separate step with 0ff939585e ("travis: Bump tpm2-tss
to 2.4.1") so packages are installed before these dependencies are built.
However, on LGTM, packages can't be installed explicitly, so `deps` is
a no-op and we still have to list some dependencies in the config.
2020-09-22 12:24:44 +02:00
Noel Kuntze d1d5659ead ike-vendor: Add option to send Cisco FLexVPN vendor ID
A new global option enables sending this vendor ID to prevent Cisco
devices from narrowing the initiator's local traffic selector to the
requested virtual IP, so e.g. 0.0.0.0/0 can be used instead.

This has been tested with a "tunnel mode ipsec ipv4" Cisco template but
should also work for GRE encapsulation.

Closes strongswan/strongswan#180.
2020-09-10 12:01:44 +02:00
Tobias Brunner dc0c20600f libipsec: Enable code coverage
Same as with libtls.
2020-09-09 13:25:30 +02:00
Tobias Brunner ed1ba70894 libtls: Enable code coverage
While the test runner was already correctly set up, the library itself
was not and no coverage was reported for any of its files.
2020-09-09 13:25:30 +02:00
Tobias Brunner d5d6d671fb leak-detective: Whitelist OPENSSL_init_ssl()
These leaks are reported with OpenSSL 1.1.0+ if the mysql plugin is loaded.
2020-09-09 13:25:30 +02:00
Tobias Brunner fd5cf31108 travis: Read project/organization for SonarCloud from environment variable 2020-09-09 13:25:30 +02:00
Tobias Brunner 76425800c4 Add project config for SonarCloud to ignore some files/rules
These settings have already been configured in the UI, but it might be
helpful to have them here so it's easier to set up the analysis of forks.
2020-09-09 13:25:30 +02:00
Tobias Brunner 6638191cd7 testing: Increase memory of alice by 20 MiB
It's ever so close with strongTNC, sometimes the OOM killer got triggered
and the tests failed, or even worse, the whole guest system got stuck.
This might just be enough for now.
2020-09-04 15:48:12 +02:00
Tobias Brunner 64148f046e testing: Fix dependency issue with strongTNC
Apparently, djangorestframework-camel-case, in the referenced version,
uses `six` but does not itself require/install it (later versions removed
Python 2 support altogether).
2020-09-04 14:56:58 +02:00
Tobias Brunner 565f022b5a Merge branch 'testing-buster'
Use Debian buster as base image for the testing environment.
2020-09-03 15:53:14 +02:00
Tobias Brunner 210c1e2628 testing: Fix route-based/net2net-xfrmi-ike scenario
On newer systems, the upper hard limit for open file descriptors (see
`ulimit -H -n`) was increased from 4096 to 524288.  Due to how python-daemon
closes potentially open file descriptors (basically stores them in a set,
removes those excluded by config, and loops through all of them), the updown
script was either killed immediately (by the OOM killer) or not ready yet
when updown events occurred.
2020-09-03 15:46:46 +02:00
Tobias Brunner 1496991078 leak-detective: Whitelist leaks that occur on Debian buster 2020-09-03 15:24:37 +02:00
Tobias Brunner 5bba0ec0f7 testing: Use Debian buster as base image 2020-09-03 15:24:37 +02:00
Tobias Brunner 1f97415fe7 testing: Use latest x509-ada release
This fixes an issue with newer compiler versions where crashes would be
caused if functions of the generated C X.509 parser are not aligned.
2020-09-03 15:24:37 +02:00
Tobias Brunner fb78b0e533 testing: Add man, valgrind and strace to base image 2020-09-03 13:34:19 +02:00
Tobias Brunner dcd8327933 testing: Install vici Python module manually
easy_install is not included in Debian's python-setuptools package
anymore, so we install it manually using setup.py.
2020-09-03 13:34:19 +02:00
Tobias Brunner d9785b36a3 testing: Replace deprecated/removed `pip install --download` command
It was deprecated for a while and has been replaced by `pip download`.
2020-09-03 13:34:19 +02:00
Tobias Brunner 94eebc9c2c testing: Use legacy iptables on Debian buster
The iptables-nft wrapper that uses the nftables framework can't handle
the CLUSTERIP target (plus we'd require nftables in the kernel).
2020-09-03 13:34:19 +02:00
Tobias Brunner 5c4ebbdde8 testing: Increase maximum guest image size
Seems that each Debian release increases the image size by about 200 MiB.
But increase it a bit more so we have room for logs/tools/debug symbols.
2020-09-03 13:34:19 +02:00
Tobias Brunner 3d1e2c56df testing: Use pkill to reload rsyslogd config/recreate log files
The PID location changes with newer Debian releases so it's more
portable this way.
2020-09-03 13:34:19 +02:00
Tobias Brunner d538b22afe testing: Remove deprecated UsePrivilegeSeparation option from sshd_config 2020-09-03 13:34:19 +02:00
Tobias Brunner 0d84b32e82 testing: Add Linux 5.8 kernel config
Enables TCP encap for ESP.
2020-09-03 13:34:19 +02:00
Tobias Brunner 5747ec4eae testing: Use host's /dev/urandom as /dev/random on guests via VirtIO RNG
Newer versions of systemd etc. seem to require quite a lot of entropy
from /dev/random while booting, which can block and therefore delay the
start of other services (in particular sshd) by more than a minute.
Using the host's /dev/urandom via VirtIO RNG, we can avoid blocking the
guests.

The required kernel options are added for kernel versions 5.4+.
2020-09-03 13:34:19 +02:00
Tobias Brunner 766017a8d3 libimcv: Add Debian 10.5 to IMV database 2020-09-03 13:34:19 +02:00
Tobias Brunner ad7d712cb5 testing: Support build with Debian buster base image 2020-09-03 13:33:32 +02:00
Tobias Brunner e96f58568e travis: Bump wolfSSL to 4.5.0 2020-08-31 17:49:10 +02:00
Tobias Brunner bdd058e36c imv-scanner: Fix potential buffer overflow
While `pos` was moved to the end, `len` was not adjusted (i.e. set to 0)
so later calls could write beyond the buffer.  However, the last port
written might have been incomplete, so instead we just reset the string.
2020-08-18 14:05:04 +02:00
Tobias Brunner 3f8eb2ebdf aesni: Remove useless algorithm assignments 2020-08-18 13:17:24 +02:00
Tobias Brunner 0ce2e00d94 vici: Don't use pytest-pycodestyle with Python 3.5
This causes problems due to a deprecation error during the Ubuntu Xenial
build on Travis.
2020-08-17 15:22:34 +02:00
Tobias Brunner 03a495f6fc travis: Bump tpm2-tss to 2.4.2 2020-08-17 13:45:15 +02:00
Andreas Steffen 2205c75bad Version bump to 5.9.0 2020-07-29 13:08:09 +02:00
Tobias Brunner ce5f9b83f6 NEWS: Add news for 5.9.0 2020-07-24 16:54:57 +02:00
Tobias Brunner 61af9a3478 vici: Fix typos in comments 2020-07-23 14:50:17 +02:00
Andreas Steffen 2eec7efd46 Version bump to 5.9.0rc1 2020-07-21 22:43:36 +02:00
Tobias Brunner 544ff81911 configure: Ignore unknown Git version number
Don't abort the script if the version is reported as UNKNOWN, which happens
on CI hosts where the repository is only cloned with a certain depth (which
may not include the latest tag).

Also, never map VERSION to UNKNOWN.

Fixes: 2e522952c7 ("configure: Optionally use version information obtained from Git in executables")
2020-07-21 12:49:13 +02:00
Tobias Brunner 59455137b4 Use Botan 2.15.0 for tests 2020-07-20 16:58:03 +02:00
Tobias Brunner edc7752802 unit-tests: Fix cancel_onoff test
If it takes a while to start one of the threads, another thread might already
have passed the usleep() call previously used and re-enabled cancelability
so that the loop that checked for it would never terminate.
2020-07-20 15:49:44 +02:00
Tobias Brunner 8a4e30ccef unit-tests: Print a header for each test function/iteration if verbosity is >= 0 2020-07-20 14:29:28 +02:00
Tobias Brunner 5c43a5bfa7 unit-tests: Add ability to filter test cases and functions 2020-07-20 14:29:12 +02:00
Tobias Brunner 2e522952c7 configure: Optionally use version information obtained from Git in executables
The variable GIT_VERSION is always defined, either obtained from Git or
a file that is embedded in tarballs when they are built.  Optionally,
that version is declared as VERSION in config.h so it will be used e.g. in
the daemons when they print the version number.

There is a check that should catch missing tags (i.e. if the version number
in AC_INIT() isn't a prefix of the version obtained via Git).
2020-07-20 14:10:52 +02:00
Tobias Brunner f77e8c171c openssl: Use consistent ifdefs to disable x25519/448
When compiling with OPENSSL_NO_ECDH but without OPENSSL_NO_EC the build
failed.
2020-07-20 14:10:05 +02:00
Tobias Brunner 6f9d5ea0f1 Merge branch 'vici-ca-certs'
These changes store all CA certificates in vici_authority_t, which avoids
issues with unloading authority sections or clearing credentials.

Closes strongswan/strongswan#172.
2020-07-20 14:07:47 +02:00
Tobias Brunner 3c5e7eaa88 vici: Keep track of all CA certificates in vici_authority_t
This way we only have one reference for each CA certificate, whether it
is loaded in an authority section, a connection or via load-certs() command.
It also avoids enumerating CA certificates multiple times if they are
loaded in different ways.
2020-07-20 14:05:39 +02:00
Tobias Brunner 3d3d5235aa object: Add helper for callbacks with two void pointers 2020-07-20 14:05:39 +02:00
Tobias Brunner d8a2c58229 vici: Make attribute certificates untrusted again
Fixes: 334119b843 ("Share vici_cert_info.c with vici_cred.c")
2020-07-20 14:05:39 +02:00
Tobias Brunner 6fc1b2c3d3 vici: Clear credential cache when unloading an authority section 2020-07-20 14:05:38 +02:00
Tobias Brunner 46ff268885 vici: Directly provide CA certificates in authority sections
With the previous approach, CA certificates that were not re-loaded via
load-cert() (e.g. from tokens or via absolute paths) would not be available
anymore after the clear-creds() command was used.  This avoids this
issue, but can cause duplicate CA certificates to get stored and enumerated,
so there might be a scaling factor.
2020-07-20 14:05:38 +02:00
Tobias Brunner 306c0c9f8e certificate: Extract helper function to filter certificates 2020-07-20 14:05:38 +02:00
Tobias Brunner dd7505af3e Merge branch 'ordered-hashtable'
This changes the hashtable implementation to that it maintains insertion
order.  This is then used in the vici plugin to store connections in a
hash table instead of a linked list, which makes managing them quite a
bit faster if there are lots of connections.

The old implementation is extracted into a new class (hashlist_t), which
optionally supports sorting keys and provides the previous get_match()
function.
2020-07-20 14:03:27 +02:00
Tobias Brunner 93b2c2066f hashtable: Use quadratic probing
This reduces the clustering problem (primary clustering) but is not
completely free of it (secondary clustering) it still reduces the maximum
and average probing lengths.
2020-07-20 13:50:11 +02:00
Tobias Brunner 736fae4e6c vici: Store configs in a hashtable
This makes updates more efficient if many configs are loaded. Configs
still have to be enumerated to select them.
2020-07-20 13:50:11 +02:00
Tobias Brunner 45376040ce hashtable: Maintain insertion order when enumerating
With the previous approach we'd require at least an additional pointer
per item to store them in a list (15-18% increase in the overhead per
item).  Instead we switch from handling collisions with overflow lists to
an open addressing scheme and store the actual table as variable-sized
indices pointing into an array of all inserted items in their original
order.

This can reduce the memory overhead even compared to the previous
implementation (especially for smaller tables), but because the array for
items is preallocated whenever the table is resized, it can be worse for
certain numbers of items.  However, avoiding all the allocations required
by the previous design is actually a big advantage.

Depending on the usage pattern, the performance can improve quite a bit (in
particular when inserting many items).  The raw lookup performance is a bit
slower as probing lengths increase with open addressing, but there are some
caching benefits due to the compact storage.  So for general usage the
performance should be better.  For instance, one test I did was counting the
occurrences of words in a list of 1'000'000 randomly selected words from a
dictionary of ~58'000 words (i.e. using a counter stored under each word as
key).  The new implementation was ~8% faster on average while requiring
10% less memory.

Since we can't remove items from the array (would change the indices of all
items that follow it) we just mark them as removed and remove them once the
hash table is resized/rehashed (the cells in the hash table for these may
be reused).  Due to this the latter may also happen if the number of stored
items does not increase e.g. after a series of remove/put operations (each
insertion requires storage in the array, no matter if items were removed).
So if the capacity is exhausted, the table is resized/rehashed (after lots
of removals the size may even be reduced) and all items marked as removed
are simply skipped.

Compared to the previous implementation the load factor/capacity is
lowered to reduce chances of collisions and to avoid primary clustering to
some degree.  However, the latter in particular, but the open addressing
scheme in general, make this implementation completely unsuited for the
get_match() functionality (purposefully hashing to the same value and,
therefore, increasing the probing length and clustering).  And keeping the
keys optionally sorted would complicate the code significantly.  So we just
keep the existing hashlist_t implementation without adding code to maintain
the overall insertion order (we could add that feature optionally later, but
with the mentioned overhead for one or two pointers).

The maximum size is currently not changed.  With the new implementation
this translates to a hard limit for the maximum number of items that can be
held in the table (=CAPACITY(MAX_SIZE)).  Since this equals 715'827'882
items with the current settings, this shouldn't be a problem in practice,
the table alone would require 20 GiB in memory for that many items.  The
hashlist_t implementation doesn't have that limitation due to the overflow
lists (it can store beyond it's capacity) but it itself would require over
29 GiB of memory to hold that many items.
2020-07-20 13:50:11 +02:00
Tobias Brunner d9944102f5 hashlist: Move get_match() and sorting into a separate class
The main intention here is that we can change the hashtable_t
implementation without being impeded by the special requirements imposed
by get_match() and sorting the keys/items in buckets.
2020-07-20 13:50:11 +02:00
Tobias Brunner 4334f61284 unit-tests: Pass test iteration to fixtures 2020-07-20 13:50:11 +02:00
Tobias Brunner 31e6ca78df hashtable: Optionally collect and report profiling data 2020-07-20 13:50:11 +02:00
Tobias Brunner 87ceaefe2f hashtable: Optionally sort keys/items in buckets in a specific way
This can improve negative lookups, but is mostly intended to be used
with get_match() so keys/items can be matched/enumerated in a specific
order.  It's like storing sorted linked lists under a shared key but
with less memory overhead.
2020-07-20 13:50:11 +02:00
Tobias Brunner c66c850fc0 hashtable: Store items in buckets in insertion order
This is more predictable when using get_match() in particular because
the order does not change anymore when the table is rehashed.
2020-07-20 13:50:11 +02:00
Tobias Brunner 54a2b35f07 unit-tests: Add tests for larger number of items in hashtables 2020-07-20 13:50:11 +02:00
Tobias Brunner 13d302e95a unit-tests: Optionally report the times test cases ran 2020-07-20 13:50:11 +02:00
Tobias Brunner fd94c1301e kernel-netlink: Ignore preference for temporary addresses for IPv6 VIPs
They are not marked as temporary addresses so make sure we always return
them whether temporary addresses are preferred as source addresses or not
as we need to enumerate them when searching for addresses in traffic selectors
to install routes.

Fixes: 9f12b8a61c ("kernel-netlink: Enumerate temporary IPv6 addresses according to config")
2020-07-07 10:01:46 +02:00
Tobias Brunner 10a913685f charon-nm: Set DPD/close action to restart and enable indefinite keying tries
We don't track CHILD_SA down events anymore and rely on NM's initial timeout
to let the user know if the connection failed initially.  So we also don't
have to explicitly differentiate between initial connection failures and
later ones like we do an Android.  Also, with the default retransmission
settings, there will only be one keying try as NM's timeout is lower than
the combined retransmission timeout of 165s.

There is no visual indicator while the connection is reestablished later.

Fixes #3300.
2020-07-06 13:47:16 +02:00
Tobias Brunner feda4a3d37 vici: With start_action=start, terminate IKE_SA without children on unload
This includes IKE_SAs in CONNECTING state, which not yet have any
CHILD_SAs.

Closes strongswan/strongswan#175.
2020-07-01 15:59:41 +02:00
Boris Vanhoof 6870a9b590 eap-radius: Small spelling fix
Closes strongswan/strongswan#174.
2020-06-29 09:44:19 +02:00
Tobias Brunner f2d240954a testing: Skip tests with missing files, don't abort the test run
This allows simple test configs in testing/tests/local that are no
actual test cases.
2020-06-23 16:24:18 +02:00
Andreas Steffen d470422974 Version bump to 5.9.0dr2 2020-06-14 12:15:44 +02:00
Tobias Brunner 84bce03a64 testing: Fix SQL scenarios after preferring AEAD for ESP
sql/net2net-route|start-pem seem to be the only ones that configure a
proposal via database.
2020-06-12 13:45:58 +02:00
Tobias Brunner 4261f915d6 testing: Fix ikev2/net2net-fragmentation scenario
The IKE_AUTH message from moon is now larger because of the AEAD proposal.
2020-06-12 13:45:58 +02:00
Tobias Brunner 33412158f5 ike: Send AEAD ESP default proposal first
We generally prefer AEAD nowadays.

References #3461.
2020-06-12 13:47:13 +02:00
Tobias Brunner c7bef954ee proposal: Add AES-GCM to the ESP default AEAD proposal
References #3461.
2020-06-12 13:45:58 +02:00
Tobias Brunner bc40509057 ikev2: Ensure ALERT_RETRANSMIT_SEND_CLEARED is triggered
If a MOBIKE task is deferred, the retransmission counter is reset to 0
when reinitiating.  So if there were retransmits before, this alert would
not be triggered if a response is received now without retransmits.
2020-06-11 13:33:32 +02:00
Tobias Brunner 4b225bf866 travis: Don't pipe negative lgtm.com result into jq
The data might not be valid JSON.
2020-06-11 13:29:47 +02:00
Tobias Brunner 364d8b2628 ikev1: Ensure local IP is known as identity fallback during Main Mode
We usually have a local IP already via ike_sa_t::resolve_hosts() before
build_i() is called but if that's not the case, it's more likely we have
one after we processed the first response (it might also have changed).
There is a potential chance we still don't have one if the socket API
doesn't provide us with the destination address of received messages,
but that seems not very likely nowadays.
2020-06-11 13:29:47 +02:00
Andreas Steffen 12e4dbb231 Version bump to 5.9.0dr1 2020-06-06 15:02:42 +02:00
Tobias Brunner 59ebdac49b child-create: Don't reset DH group when retrying after INVALID_KE_PAYLOAD
migrate() is called before retrying.

Fixes: 0184a69b7b ("child-create: Properly handle DH group during
migration when reestablishing")
2020-06-05 16:41:23 +02:00
Tobias Brunner 736ac65554 ikev1: Fix PSK lookup for Main Mode initiators
We need the PSK/identity already when deriving the keys in process_i().

Fixes: 1665a4e050 ("ikev1: Use actual local identity as initiator or aggressive mode responder")
2020-06-05 14:26:30 +02:00
Tobias Brunner 62367f2c01 ike: Fix retransmission timeouts if base is <= 1
Fixes: 72b282cf20 ("ike: Properly support high number of retransmission tries")
2020-06-05 13:44:00 +02:00
Tobias Brunner a5e4322348 android: New release after improving connectivity/scheduling 2020-06-02 14:55:58 +02:00
Tobias Brunner 763f07c531 travis: Add build of the Android app 2020-06-02 14:42:38 +02:00
Tobias Brunner eadba6d225 android: Suppress linting error in manifest related to cert import activity
<data> tags that only specify the mimeType attribute are perfectly fine
according to the docs.
2020-06-02 14:42:48 +02:00
Tobias Brunner 93d6fe3e4a android: Ignore some missing quantity lint errors
Once these strings are translated and the quantities are defined, this
attribute can be removed again.
2020-06-02 14:42:45 +02:00
Tobias Brunner 84924249aa android: Mock parseInetAddress() method to fix unit tests
The native parseInetAddressBytes() method called by that method is not
available when running the tests.

Not very pretty and there are some warnings because PowerMock does
reflection in some illegal way but it fixes the unit tests and does
not require any new dependencies like Apache Commons or Guava just to
parse IP addresses without DNS lookup.

Fixes: 2ef473be15 ("android: Use helper to parse IP addresses where appropriate")
Fixes #3443.
2020-06-02 14:42:38 +02:00
Tobias Brunner a22a1493c3 Merge branch 'android-scheduler'
Starting with Android 6, the system will aggressively suspend apps when
the device is idle (Doze mode).  With Android 10 on a Pixel 4 this seems
to happen after about 70 minutes.  Then the scheduler thread in our
default scheduler is only woken rarely, combined with our previous use
of the monotonic clock it meant that events were executed with severe
delays and noticing that there was such a delay.  This was particularly
bad in regards to NAT keepalives as it usually meant that the device was
not reachable anymore from the outside.

Some changes here try to improve that situation, e.g. the clock is switched
to CLOCK_REALTIME (Bionic doesn't support CLOCK_BOOTTIME for condvars) so we
can measure the actual difference e.g. since the last outbound message,
other changes try to ensure that connectivity is restored after being asleep
for a while (send DPD instead of keepalive after a long delay, send DPD even
if path to peer stays the same).

However, the most significant change is the replacement of the default
scheduler with one specifically designed for Android.  It schedules
long-term events via AlarmManager, which allows waking up the app even
if the system put it to sleep.  The latter requires adding the app to the
system's battery optimization whitelist, which is requested from the
user automatically if necessary.  With this, NAT keepalives and rekeyings
are now scheduled accurately, with little changes to the battery usage.
If the app is not whitelisted (there is a setting to ignore this), events
are delayed by up to 15 minutes after about 70 minutes, so behind a NAT
the device won't be reachable from the outside afterwards (connectivity
should be restored as soon as the device is woken from deep sleep by the
user).

Fixes #3364.
2020-06-02 14:34:31 +02:00
Tobias Brunner 04f4bef235 android: Add a preference flag to ignore battery optimizations
This allows users to ignore whether the app is on the device's power
whitelist without a warning.  The flag is currently not set
automatically if the user denies the request.
2020-06-02 14:07:06 +02:00
Tobias Brunner 5d01aaf91d android: Increase lifetimes a bit
This should avoid clashes of soft and hard lifetimes even if the app is
not whitelisted.
2020-06-02 14:07:06 +02:00
Tobias Brunner a0d32a2d13 android: Ask user to add our app to the device's power whitelist
This is necessary so we can actually schedule events accurately in Doze
mode. Otherwise, we'd only get woken in intervals of several minutes (up to
15 according to the docs) after about an hour.
2020-06-02 14:07:06 +02:00
Tobias Brunner d67a5b0c4d android: Use the default scheduler for short-term events
Using AlarmManager has quite some overhead, so we use our regular
scheduler for events that are to be executed in the near future.
2020-06-02 14:07:06 +02:00
Tobias Brunner 1b4c4123c2 android: Use Android-specific scheduler on Android 6 and later 2020-06-02 14:07:06 +02:00
Tobias Brunner b7d66ae2cd android: Add Android-specific implementation of scheduler_t
This uses AlarmManager to schedule events in a way that ensures the app
is woken up (requires whitelisting when in Doze mode to be woken up at
the exact time, otherwise there are delays of up to 15 minutes).
2020-06-02 14:07:06 +02:00
Tobias Brunner aaa908dc0a scheduler: Use timercmp(3) instead of a custom function 2020-06-02 14:07:06 +02:00
Tobias Brunner 2edc73d84e ike: Only track actually sent retransmits as outbound packets
Retransmission jobs for old requests for which we already received a
response previously left the impression that messages were sent more
recently than was actually the case.

task_manager_t always defined INVALID_STATE as possible return value if
no retransmit was sent, this just was never actually returned.

I guess we could further differentiate between actual invalid states
(e.g. if we already received the response) and when we don't send a
retransmit for other reasons e.g. because the IKE_SA became stale.
2020-06-02 14:07:06 +02:00
Tobias Brunner f3695d089b android: Change how initial log handler is registered
Previously, if the two utility functions were called while the VPN
connection was established (i.e. charon was initialized) the logger for
libstrongswan would get reset to the initial log handler.  So certain
log messages would not get logged to the log file after the TUN device
was created (one of the helpers is used to convert IPs there).
2020-06-02 14:07:06 +02:00
Tobias Brunner 070cd12dfb android: Check the current path using DPD after a roaming event
A new NAT mapping might be created even if the IP stays the same.  Due to
the DPD fallback with NAT keep-alives this might only be necessary in
corner cases, if at all.
2020-06-02 14:07:06 +02:00
Tobias Brunner 6524bd3cd5 ike: Optionally use DPD to check if the current path still works
We could maybe check the duration of the last stale condition or when
the last packet was sent as filter to avoid unnecessary updates.
2020-06-02 14:07:06 +02:00
Tobias Brunner 664389ebc4 android: Enable switch from NAT interval to DPDs after 20 seconds 2020-06-02 14:07:06 +02:00
Tobias Brunner 0d4a5f6af6 ike: Add an option to trigger a DPD instead of a NAT keepalive
This is useful on Android where the app might not be able to send
keep-alives if the device is asleep for a while.  If the NAT mapping
has been deleted in the mean time, the NAT-D payloads allow detecting
this and connectivity can be restored by doing a MOBIKE update or
recreating the SA if the peer already deleted it because the client
wasn't reachable.
2020-06-02 14:07:06 +02:00
Tobias Brunner 31298187bf android: Switch to CLOCK_REALTIME on Android
This allows measuring the delay between events more accurately if a
device is often suspended.

While CLOCK_BOOTTIME would be preferable, Android's bionic C library
does not support it for condvars.
2020-06-02 13:57:37 +02:00
Tobias Brunner 3e358475bb time: Allow using different clocks
On some systems it might be preferable to use e.g. CLOCK_BOOTTIME
instead of CLOCK_MONOTONIC, which is also not affected by time
adjustments but includes times when the system was suspended.
2020-06-02 13:57:37 +02:00
Tobias Brunner 8b93510dac mutex: Don't use ...timedwait_monotonic() if clock is set via attribute
This allows using clocks other than CLOCK_MONOTONIC.
2020-06-02 13:57:37 +02:00
Tobias Brunner 6b3bf7cdac ike: Track NAT-keepalives as outbound packets 2020-06-02 13:57:37 +02:00
Tobias Brunner 491cdd59bd android: Fix app icon on Android versions < 5.0
XML resources are apparently not supported there.  Moving the icon to
the mipmap folders should fix that.  Aliases are defined for the icons on
Android < 8.0.
2020-06-02 13:57:37 +02:00
Tobias Brunner 3c8280960c android: Update Gradle plugin 2020-06-02 13:57:37 +02:00
Tobias Brunner 907a31db4c android: Again change how data source is handled in TileService
Evidently, onClick() may be called either before onStartListening() or
after onStopListening() has been called, which causes a crash when
trying to load a VpnProfile via mDataSource.

This partially reverts 3716af079e ("android: Avoid crash related to
TileService on Huawei devices").
2020-06-02 13:57:37 +02:00
Tobias Brunner 0ff939585e travis: Bump tpm2-tss to 2.4.1
Manually built dependencies are now built in a separate step after
packages have been installed as they might depend themselves on some
packages (e.g. tpm2-tss, which now requires libjson-c).
2020-05-26 11:06:07 +02:00
Thomas 04db34a3a7 charon-nm: Allow configurable remote traffic selectors
This change allows to customize the previously hard-coded remote traffic
selectors.

This does not actually write the newly added "remote-ts" configuration option
into NetworkManager's configuration file, but will use an existing value.
Exposing the config setting in the GUI could be done later if this is a
desired change.

Use case:  remote firewall appliance wrongly accepts the `0.0.0.0/0` TS but
does not actually route external traffic, leaving the user with a partially
working internet connection.

Closes strongswan/strongswan#173.
2020-05-25 11:50:46 +02:00
Tobias Brunner 3a54206c08 ikev2: Return to the original host if connection fails after redirection
If we fail connecting to the host we got redirected to, we should restart
with the original host where we might get redirected to a different host.

We must not reset this when retrying due to INVALID_KE_PAYLOAD or COOKIE
notifies.  Since we keep the initiator SPI in those cases, we use that
flag as indicator.

Since we don't store the original remote_host value, we can't restore
that.  So there is a potential conflict with MIPv6.

Closes strongswan/strongswan#171.
2020-05-19 17:33:20 +02:00
Tobias Brunner 3f454f33c0 nm: Version bump to 1.5.2 2020-05-19 16:17:05 +02:00
Tobias Brunner 1ebf63b966 nm: Move server port to options tab and position tabs to the left
Also shortened the title of the proposal tab.  This saves some additional
screen space.

Fixes #3448.
2020-05-19 16:17:24 +02:00
Tobias Brunner 7b15ecf82e nm: Use tabs for options/proposals to save screen space
The height of the dialog increased due to the recently added additional
fields for certificate selection and identities.  On some screens the
fields to configure custom proposals were not visible anymore.
Together with less spacing on the top level GtkBox this change reduces
the height by about 80 pixels.

Fixes #3448.
2020-05-19 16:17:05 +02:00
Tobias Brunner 73b60338dc nm: Migrate appdata to metainfo
The path '/usr/share/appdata' is deprecated as is the .appdata.xml
extension, files should be in installed in '/usr/share/metainfo' with
a .metainfo.xml extension.

According to the docs, the metainfo path should be well supported even
by older distros like Ubuntu 16.04.

Reference: 2.1.2. Filesystem locations
https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html
2020-05-11 09:57:37 +02:00
Tobias Brunner ecf187509a nm: Version bump to 1.5.1 2020-05-08 18:12:20 +02:00
Tobias Brunner d5d8375610 charon-nm: Clear secrets when disconnecting
The need_secrets() method is called before connect() (where we clear the
previous secrets too), so e.g. a password-protected private could be
decrypted with the cached password from earlier but if the password was not
stored with the connection, it would later fail as no password was requested
from the user that could be passed to connect().

References #3428.
2020-05-08 18:12:20 +02:00
Tobias Brunner 532d5fc85d nm: Fix password entry for private keys and allow saving it
On newer desktops the auth dialog is called with --external-ui-mode and
it seems that the password flag has to be set, otherwise the password is
not stored temporarily in the profile and passed to charon-nm (not sure
how this works exactly as need_secrets() is called multiple times even
after the password was already entered, only before doing so the last
time is the password available in that callback, but only if the flag
was set).  This now also allows storing the password for the private key
with the profile.

Fixes #3428.
2020-05-08 18:11:41 +02:00
Tobias Brunner 72b282cf20 ike: Properly support high number of retransmission tries
Due to the exponential backoff a high number of retransmits only
makes sense if retransmit_limit is set.  However, even with that there
was a problem.

We first calculated the timeout for the next retransmit and only then
compared that to the configured limit.  Depending on the configured
base and timeout the calculation overflowed the range of uint32_t after
a relatively low number of retransmits (with the default values after 23)
causing the timeout to first get lower (on a high level) before constantly
resulting in 0 (with the default settings after 60 retransmits).

Since that's obviously lower than any configured limit, all remaining
retransmits were then sent without any delay, causing a lot of concurrent
messages if the number of retransmits was high.

This change determines the maximum number of retransmits until an
overflow occurs based on the configuration and defaults to UINT32_MAX
if that value is exceeded.  Note that since the timeout is in milliseconds
UINT32_MAX equals nearly 50 days.

The calculation in task_manager_total_retransmit_timeout() uses a double
variable and the result is in seconds so the maximum number would be higher
there (with the default settings 1205).  However, we want its result to
be based on the actual IKE retransmission behavior.
2020-05-07 15:05:55 +02:00
Tobias Brunner 066fa42fcb ike-auth: Add option to use EAP-only authentication without notify
Some peers apparently don't send the notify and still expect to
authenticate with EAP-only authentication.  This option allows forcing
the configured use of EAP-only authentication in that scenario.
2020-05-07 15:05:55 +02:00
Tobias Brunner 0184a69b7b child-create: Properly handle DH group during migration when reestablishing
If such a task was active while reestablishing it will get queued on the
new IKE_SA.  If the DH group is already set, the DH groups won't be
stripped from the proposals and a KE payload will be sent, which is invalid
during IKE_AUTH.  We don't want to reset the group if the task is part of a
child-rekey task.
2020-05-07 15:05:55 +02:00
Tobias Brunner 1665a4e050 ikev1: Use actual local identity as initiator or aggressive mode responder
If none is configured, there is a fallback to the IP address, which is
not stored on the static auth config, but is set on the IKE_SA.

Fixes #3394.
2020-05-07 15:05:55 +02:00
Tobias Brunner b8f02fc42d ikev1: Store fallback identity (IP address) on IKE_SA's auth-cfg
The other auth-cfg object is shared via peer-cfg, so we must not
modify it.  It's only stored to simplify memory management.

Fixes #3394.
2020-05-07 15:05:55 +02:00
Tobias Brunner 3d92cff726 lookip: Use line buffering for stdout
Otherwise, the output is buffered when e.g. piping the output to another
command (or file).  And it avoids having to call fflush() in the
interactive mode.

Fixes #3404.
2020-05-07 15:05:55 +02:00
Tobias Brunner 7ae4ced06f travis: Bump wolfSSL to 4.4.0
SHA-3 is only automatically enabled on x86/x64.  The tests are disabled
because we don't need them and they currently cause a compile warning/error
when built with clang on x64 (sizeof() on a pointer to an array).  If the
examples are enabled, another test suite is built, which includes the
disabled crypto tests.
2020-05-07 09:50:45 +02:00
Tobias Brunner 142b5e7944 wolfssl: Add support for Ed448 2020-05-07 09:33:43 +02:00
Tobias Brunner 59a987b8f3 wolfssl: Add support for x448 Diffie-Hellman 2020-05-07 09:33:43 +02:00
Tobias Brunner b06374f6a5 file-logger: Set owner/group of log file
The file is usually opened/created by root, however, if user/group IDs
are configured and the configuration is reloaded, the file will be reopened
as configured user.  Like with UNIX sockets we only attempt to change
the user if we have CAP_CHOWN allowing a start as regular user.

We don't have chown() on Windows, so check for it.
2020-05-07 09:30:57 +02:00
Tobias Brunner db772305c6 xfrmi: Only build if libcharon is built
The kernel-netlink plugin is only built if libcharon is.

Closes strongswan/strongswan#167.
2020-05-07 09:19:27 +02:00
Tobias Brunner b6fcdc71a6 pkcs11: Optionally hash data for PKCS#1 v1.5 RSA signatures in software
If cards/libraries don't support signature mechanisms with hashing, we fall
back to do it ourselves in software and pass the PKCS#1 digestInfo ASN.1
structure to sign via CKM_RSA_PKCS mechanism.

Closes strongswan/strongswan#168.
2020-05-07 09:11:19 +02:00
Tobias Brunner b3e7b79cc5 scripts: Initialize libstrongswan in id2sql to fix a crash
Since 770f4ccee1 ("identification: Optionally match RDNs in any order
and accept missing RDNs") the DN parser requires lib->settings.
2020-05-04 17:00:45 +02:00
Thomas Egerer d2c15b7bf9 vici: Allow maximum vici message size configuration via compile option
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2020-04-14 16:55:49 +02:00
Tobias Brunner e0b1b12028 Use Botan 2.14.0 for tests
Requires at least GCC 5.0 to build with `--amalgamation`, so it's
disabled for our Ubuntu 16.04 build.
2020-04-07 16:37:27 +02:00
Andreas Steffen 3273667b0b Version bump to 5.8.4 2020-03-29 12:49:52 +02:00
Tobias Brunner c5c1898d73 openssl: Allow squeezing multiple times from SHAKE128/256 XOFs
OpenSSL currently doesn't support squeezing bytes out of an XOF multiple
times.  Unfortunately, EVP_DigestFinalXOF() completely resets the context
and later calls not simply fail, they cause a null-pointer dereference in
libcrypto.  This fixes the crash at the cost of repeating initializing
the whole state and allocating too much data for subsequent calls.

There is an open issue and PR that might add a function that allows
squeezing more data from an XOF in a future version of OpenSSL.
2020-03-29 12:49:52 +02:00
Tobias Brunner 6c98164f60 charon-nm: Allow using fixed source ports
This could be useful in cases a client behind a NAT has to be made reachable
via port forwarding.

Closes strongswan/strongswan#166.
2020-03-27 14:25:38 +01:00
Thomas Egerer 99bef7b686 settings: Use strtoul(3) for settings to int conversion
strtol(3) accepts values in the range of [LONG_MIN;LONG_MAX].  Based
on the architecture (32 or 64 bits), these values expand to either
0x8000000000000000/0x7fffffffffffffff for 64-bit builds, or
0x80000000/0x7fffffff for 32-bit builds.

The behavior when retrieving non-default values for charon.spi_min or
charon.spi_max, for example, depends on the architecture of the target
platform.  While 0xC000001/0xCFFFFFFE work fine on a 64-bit build, on a
32-bit build, due to the use of strtol(3), an ERANGE causes get_int()
to return the default values.

By using strtoul(3) the default is only returned if the input value
exceeds 32 or 64 bits, based on the platform.  Negative values are still
parsed correctly.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2020-03-26 15:26:59 +01:00
Tobias Brunner cb26c5547c quick-mode: Make sure we have a proposal before determining lifetimes
Fixes: e0dd36c9c7 ("ikev1: Get and set the lifetimes of the selected proposal/transform")
2020-03-26 08:41:00 +01:00
Tobias Brunner 6987f6b3eb unit-tests: Update expired certificates for TLS tests 2020-03-25 15:31:07 +01:00
Tobias Brunner b2d3726501 nm: Version bump to 1.5.0 2020-03-25 10:14:46 +01:00
Andreas Steffen 0728387ea9 Version bump to 5.8.3 2020-03-24 16:01:04 +01:00
Tobias Brunner 393e0167fd charon-nm: Correctly set remote auth class for PSK authentication
Fixes: bc3eda99ba ("charon-nm: Add support for EAP-TLS")
2020-03-20 16:06:12 +01:00
Andreas Steffen c88a4996fa Version bump to 5.8.3rc1 2020-03-19 08:43:10 +01:00
Tobias Brunner 298c389bfa NEWS: Add news for 5.8.3 2020-03-13 15:15:25 +01:00
Tobias Brunner 9f91f0b3c8 openssl: Add support for SHAKE128/256 2020-03-10 14:12:34 +01:00
Tobias Brunner 112de13f1f openssl: Add support for SHA-3 2020-03-10 14:12:34 +01:00
Tobias Brunner bbedad78c3 Merge branch 'throw-type-routes'
Implements simpler routes for passthrough policies on Linux, which
basically act as fallbacks on routes in other routing tables.  This way
they require less information (e.g. no interface or source IP) and can
be installed earlier and are not affected by updates.

Closes strongswan/strongswan#165.
Fixes #3118.
2020-03-10 12:49:53 +01:00
Tobias Brunner dfd261d2de kernel-netlink: Extract shared route handling code in net/ipsec 2020-03-10 10:30:39 +01:00
Tobias Brunner e23708bdf3 kernel-netlink: Don't require an interface name for passthrough policies 2020-03-10 10:26:42 +01:00
Tobias Brunner b0b6bd2470 kernel-netlink: Allow blank source address in routes for passthrough policies 2020-03-10 10:25:19 +01:00
Noel Kuntze 09f4bccfea kernel-netlink: Implement passthrough type routes and use them on Linux
Enables us to ignore any future kernel features for routes unless
we actually need to consider them for the source IP routes.

Also enables us to actually really skip IPsec processing for those networks
(because even the routes don't touch those packets). It's more what
users expect.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2020-03-10 10:20:58 +01:00
Tobias Brunner 4958acc0c2 kernel-interface: Reallocate previously used reqids
This is mainly an issue on FreeBSD where the current kernel still only
allows the daemon to use reqids < IPSEC_MANUAL_REQID_MAX (0x3fff = 16383).

Fixes #2315.
2020-03-09 15:27:03 +01:00
Thomas Egerer 05e373aeb0 ike: Optionally allow private algorithms for IKE/CHILD_SAs
Charon refuses to make use of algorithms IDs from the private space
for unknown peer implementations [1]. If you chose to ignore and violate
that section of the RFC since you *know* your peers *must* support those
private IDs, there's no way to disable that behavior.

With this commit a strongswan.conf option is introduced which allows to
deliberately ignore parts of section 3.12 from the standard.

[1] http://tools.ietf.org/html/rfc7296#section-3.12

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2020-03-06 11:15:15 +01:00
Tobias Brunner 61769fd1e3 openssl: Don't check signature if issuer doesn't match always
Doing this for the self-signed check also (i.e. if this and issuer are
the same) is particularly useful if the issuer uses a different key type.
Otherwise, we'd try to verify the signature with an incompatible key
that would result in a log message.

Fixes #3357.
2020-03-06 11:12:07 +01:00
Tobias Brunner 5761077091 nm: Update NEWS for next release 2020-03-06 11:06:11 +01:00
Tobias Brunner 14a779956e Merge branch 'ikev1-transform-nr'
With these changes we return the lifetimes of the actually selected
transform back to the client, which is an issue if the peer uses
different lifetimes for different proposals.  We now also return the
correct transform and proposal IDs.

Fixes #3329.
2020-03-06 10:47:34 +01:00
Tobias Brunner e0dd36c9c7 ikev1: Get and set the lifetimes of the selected proposal/transform
Previously, we simply used the lifetimes of the first
proposal/transform, which is not correct if the initiator uses different
lifetimes in its proposals/transforms.
2020-03-06 10:31:30 +01:00
Tobias Brunner 1c6b43b8ea proposal-substructure: Start numbering IKEv1 proposals with 1 2020-03-06 10:31:30 +01:00
Tobias Brunner 859f9c8c83 proposal-substructure: Encode transform number of selected IKEv1 proposal 2020-03-06 10:31:30 +01:00
Tobias Brunner 7da3143aac proposal-substructure: Store transform number for IKEv1 proposals 2020-03-06 10:31:30 +01:00
Tobias Brunner e630f2d373 proposal: Add IKEv1 transform number on which a proposal is based 2020-03-06 10:31:30 +01:00
Tobias Brunner 479c85d569 libtls: Remove unused variable in TLS socket implementation
Not used anymore since c43e8fdec4 ("Block TLS read when sending data,
but have to wait for the handshake data first").
2020-03-06 10:30:16 +01:00
Andreas Steffen 68e8fedccb Version bump to 5.8.3dr1 2020-03-04 22:27:13 +01:00
Tobias Brunner 0399314903 script: Fix upper bounds
^ is the XOR operator.
2020-03-04 17:07:32 +01:00
Tobias Brunner e1cc667920 pubkey-speed: Add sanity check for the number of rounds
The allocated buffer for the signatures is based on this, which LGTM
doesn't like.
2020-03-03 11:34:22 +01:00
Tobias Brunner 7a13246668 crypt-burn: Add sanity check for buffer length
This value is passed to chunk_alloc(), which LGTM complains about.
2020-03-03 11:32:31 +01:00
Tobias Brunner 1966f4332b configure: Make sure Python is available for static builds
We need Python to create files that reference the plugin constructors.
Without it, empty files are created and plugins can't be loaded.

Fixes #3349.
2020-02-28 13:55:18 +01:00
Tobias Brunner 1f2c83db61 travis: Enable caching for sonarcloud scan 2020-02-21 16:11:44 +01:00
Tobias Brunner 96b61792df ike: Don't reestablish IKE_SAs for which a deletion is queued
If an IKE_SA is terminated while a task is active, the delete task is
simply queued (unless the deletion is forced).  If the active task times
out before any optional timeout associated with the termination hits, the
IKE_SA previously was reestablished without considering the termination
request.

Fixes #3335.
2020-02-21 10:38:13 +01:00
Tobias Brunner 17fc6234c4 Remove obsolete packages directory
These Debian package sources have not been updated for years and are
severely out-of-date.  Since the Debian packages are properly
maintained nowadays, we don't have to provide our own package sources
to serve as examples.

References #3344.
2020-02-21 09:52:49 +01:00
Tobias Brunner 89e5eb7213 travis: Bump tpm2-tss to 2.3.3 2020-02-21 09:52:49 +01:00
Tobias Brunner e365bef4a4 travis: Remove deprecated `sudo` option, set default OS
Also replaces `matrix` with the current official name `jobs`.
2020-02-21 09:49:27 +01:00
Tobias Brunner cfed3a87ee charon-nm: Use better default directory for D-Bus policy file
Also makes it configurable via configure script.  Depending on `$datadir` is
not ideal as package maintainers might set that to a custom value.  Depending
on `$datarootdir` might have been better, the default if pkg-config fails is
now based on that.

References #3339.
2020-02-21 09:46:13 +01:00
Tobias Brunner 658b6df4d8 travis: Add build tests for NM plugin 2020-02-14 14:53:26 +01:00
Tobias Brunner 7eab520bbf nm: Ignore generated POT file 2020-02-14 14:53:26 +01:00
Tobias Brunner ca3ff27101 nm: Only check PSK length if one is actually stored 2020-02-14 14:51:43 +01:00
Tobias Brunner c41419fa2e Merge commit 'nm-client-id'
Makes the client's IKE identity configurable in the NM GUI.  For PSK
authentication the identity is now configured via that new field
and not the username anymore (old configs still work and are migrated
when edited).  The client identity now also defaults to the IP address
if not configured when using EAP/PSK.

Fixes #2581.
2020-02-14 14:47:34 +01:00
Tobias Brunner d57d5f510d nm: Make local identity configurable
For PSK authentication we now use the local identity and not the username
field.
2020-02-14 14:45:32 +01:00
Tobias Brunner ff8f6b15aa charon-nm: Add support for custom local IKE identities 2020-02-14 14:35:44 +01:00
Tobias Brunner 571769fe50 Merge branch 'nm-reauth'
With these changes, the NM service should be able to handle
reauthentication (and redirection) by switching to the new IKE_SA and
not considering the old SA going down an error.

Fixes #852.
2020-02-14 13:58:50 +01:00
Tobias Brunner 5575aaf5c8 charon-nm: Keep listener registered even on failures
NM doesn't seem to terminate the daemon on failures, so we might not get
further events for later retries.
2020-02-14 13:55:42 +01:00
Tobias Brunner 3d2f5ae003 charon-nm: Support reauthentication and redirection 2020-02-14 13:55:42 +01:00
Tobias Brunner 4373a59bf5 Merge branch 'nm-eap-tls'
Adds support for EAP-TLS to the NM plugin.  The certificates/key
source (file, smartcard, agent) can now be selected independently of
the authentication method (i.e. for both certificate and EAP-TLS auth).

Fixes #2097.
2020-02-14 13:51:44 +01:00
Tobias Brunner 661e1044c0 nm: Make EAP-TLS configurable
A new combo field allows selecting where the certificate/key is stored.
2020-02-14 13:50:32 +01:00
Tobias Brunner bc3eda99ba charon-nm: Add support for EAP-TLS
The code is structured similar to that in the Android client, but two-round
authentication (cert+EAP) is not supported as that might require multiple
secrets ("password" is currently the only secret field used for every
method) and other details are currently missing too (like configurable
client identities).
2020-02-14 13:44:39 +01:00
Tobias Brunner 1157d3e031 Merge branch 'nm-server-port'
Adds the option to use a custom server port in the NM plugin.

Fixes #625.
2020-02-14 13:36:50 +01:00
Tobias Brunner e85a43b7b6 nm: Make server port configurable in GUI 2020-02-14 13:36:16 +01:00
Tobias Brunner 60777574c1 charon-nm: Add support for custom server ports 2020-02-14 13:36:16 +01:00
Tobias Brunner eb256e5ba1 Merge branch 'nm-remote-id'
This adds an optional field to the NM plugin to configure the server
identity, so it can differ from the address or certificate subject,
which are used by default.

It also updates the Glade file to GTK+ 3.2.

Closes strongswan/strongswan#57.
2020-02-14 13:32:06 +01:00
Tobias Brunner 7c6bb33151 nm: Update German translation 2020-02-14 11:19:49 +01:00
Tobias Brunner a7bda9a95e nm: Make remote identity editable in GUI 2020-02-14 11:19:49 +01:00
Tobias Brunner 19e64e101d charon-nm: Add support for a specific remote identity 2020-02-14 11:19:49 +01:00
Tobias Brunner f9956ca633 nm: Add hint regarding password storage policy
Requires targeting GTK 3.2.
2020-02-14 11:19:49 +01:00
Tobias Brunner 23de1602f9 nm: Replace the term "gateway" with "server" 2020-02-14 11:19:49 +01:00
Tobias Brunner d46f804b09 nm: Update Glade file for GTK 3.0
That's the version we check for in the configure script.
2020-02-14 11:19:49 +01:00
Tobias Brunner b2b69f4156 configure: Depend on libip4tc instead of libiptc
The libiptc meta-package apparently will be removed e.g. from Debian.
We currently only need IPv4 support in the connmark and forecast plugins.

Fixes #3338.
2020-02-14 10:07:23 +01:00
Tobias Brunner cb25022197 unit-tests: Increase timeout for test vectors suite
These occasionally fail due to the current timeout on IBM Power on Travis.
2020-02-13 16:42:13 +01:00
Tobias Brunner ead067e775 Revert "travis: Add workaround for a tox/virtualenv/six issue"
This reverts commit d450e926de.

Was fixed by making tox depend on newer versions of six so the package
gets installed/updated automatically now when installing tox.  There is
also some ongoing work that tries to make virtualenv work with older
versions of six.
2020-02-13 16:34:27 +01:00
Tobias Brunner 19b2f870e2 enumerator: Fall back to lstat() if stat() fails when enumerating dirs/files
This happens e.g. if the path is for an invalid symlink.
2020-02-13 11:54:19 +01:00
Tobias Brunner fdce492ed0 cirrus: Remove bashisms from test script to make it compatible with /bin/sh
Bash is not installed on the FreeBSD images here and the location would
be different anyway (`/usr/local/bin/bash`, so we'd have to change the
hashbang to e.g. `/usr/bin/env bash`).
2020-02-13 10:23:30 +01:00
Tobias Brunner d450e926de travis: Add workaround for a tox/virtualenv/six issue
virtualenv is installed as dependency of tox and 20.0.0 added a
dependency on a newer version of six, which is not automatically
installed/updated.
2020-02-12 11:20:02 +01:00
Josh Soref d30498edf1 ikev2: Fix spelling of routability
References strongswan/strongswan#164.
2020-02-11 18:23:34 +01:00
Josh Soref b3ab7a48cc Spelling fixes
* accumulating
* acquire
* alignment
* appropriate
* argument
* assign
* attribute
* authenticate
* authentication
* authenticator
* authority
* auxiliary
* brackets
* callback
* camellia
* can't
* cancelability
* certificate
* choinyambuu
* chunk
* collector
* collision
* communicating
* compares
* compatibility
* compressed
* confidentiality
* configuration
* connection
* consistency
* constraint
* construction
* constructor
* database
* decapsulated
* declaration
* decrypt
* derivative
* destination
* destroyed
* details
* devised
* dynamic
* ecapsulation
* encoded
* encoding
* encrypted
* enforcing
* enumerator
* establishment
* excluded
* exclusively
* exited
* expecting
* expire
* extension
* filter
* firewall
* foundation
* fulfillment
* gateways
* hashing
* hashtable
* heartbeats
* identifier
* identifiers
* identities
* identity
* implementers
* indicating
* initialize
* initiate
* initiation
* initiator
* inner
* instantiate
* legitimate
* libraries
* libstrongswan
* logger
* malloc
* manager
* manually
* measurement
* mechanism
* message
* network
* nonexistent
* object
* occurrence
* optional
* outgoing
* packages
* packets
* padding
* particular
* passphrase
* payload
* periodically
* policies
* possible
* previously
* priority
* proposal
* protocol
* provide
* provider
* pseudo
* pseudonym
* public
* qualifier
* quantum
* quintuplets
* reached
* reading
* recommendation to
* recommendation
* recursive
* reestablish
* referencing
* registered
* rekeying
* reliable
* replacing
* representing
* represents
* request
* request
* resolver
* result
* resulting
* resynchronization
* retriable
* revocation
* right
* rollback
* rule
* rules
* runtime
* scenario
* scheduled
* security
* segment
* service
* setting
* signature
* specific
* specified
* speed
* started
* steffen
* strongswan
* subjectaltname
* supported
* threadsafe
* traffic
* tremendously
* treshold
* unique
* uniqueness
* unknown
* until
* upper
* using
* validator
* verification
* version
* version
* warrior

Closes strongswan/strongswan#164.
2020-02-11 18:23:07 +01:00
Tobias Brunner baf29263d5 pem: Support parsing PEM-encoded Ed448 keys 2020-02-10 13:37:31 +01:00
Tobias Brunner 878afdf90b pki: Add support for Ed448 keys/certificates 2020-02-10 13:37:31 +01:00
Tobias Brunner 85a35fc99d openssl: Support certificates with Ed25519/448 keys 2020-02-10 13:37:31 +01:00
Tobias Brunner 3361f81f1c pkcs1: Support parsing Ed448 public keys 2020-02-10 13:37:31 +01:00
Tobias Brunner 18bee9306a nm: Replace deprecated g_type_class_add_private()
Fixes #2765, #3197.
2020-02-05 10:54:37 +01:00
Tobias Brunner 0f141fb095 soup: Use soup_session_new() to avoid deprecation warning
There are a ton of libsoup/GLib-related "leaks" that we can't whitelist
and with leak detective active there is a delay that interestingly doesn't
happen with soup_session_sync_new(), so tests failed with a timeout (actually
they hung due to the lock in the fetcher manager).
On Travis, the curl plugin is used for the tests, so that's not an issue
there (and without LD the tests complete quickly and successfully).
2020-02-05 10:49:35 +01:00
Tobias Brunner 5833bc4b9c travis: Build soup plugin
We disabled this due to issues with the GLib version shipped with
Ubuntu 12.04 (see ab23a0f86a).
2020-02-05 10:49:20 +01:00
Tobias Brunner f78dfb7e28 vici: Options are optional in get_pools() of Python bindings
Fixes #3319.
2020-02-03 10:52:31 +01:00
Tobias Brunner ef4113a49d libtpmtss: Fix problematic usage of chunk_from_chars() in TSS2 implementations
See 8ea13bbc5c for details.

References #3249.
2020-01-30 18:18:33 +01:00
Tobias Brunner 776433505b x509: Replace problematic calls of chunk_from_chars() for keyUsage extension
As noted in 8ea13bbc5c newer compilers might optimize out the
assignment leading to invalid values in the keyUsage extension (as the
length was still set, the extension was encoded, just not with the
intended values).

Fixes #3249.
2020-01-30 18:18:28 +01:00
Tobias Brunner d16e810778 pki: Remove unnecessary and problematic chunk_from_chars() usage in --signcrl
If the serial is not yet set, the same default value is set just below.

See 8ea13bbc5c for details on chunk_from_chars().

References #3249.
2020-01-30 18:18:14 +01:00
Tobias Brunner d5cf2d1f85 tls-crypto: Fix usage of chunk_from_chars()
See 8ea13bbc5c for details.

References #3249.
2020-01-30 18:18:06 +01:00
Tobias Brunner da9e4fa04b lgtm: Build external dependencies for a more complete analysis
The build system is a bit limited, only the repository directory and
LGTM_WORKSPACE is writable.  sudo doesn't work at all, for others we
don't have enough permission.
2020-01-30 17:12:48 +01:00
Tobias Brunner 2cb4af6696 wolfssl: Use pkg-config to check for wolfSSL
The other checks trigger an automatic install of the old and incompatible
Ubuntu package on LGTM.
2020-01-30 17:12:05 +01:00
Tobias Brunner 04ce39e7c0 libtpmtss: Only check for legacy TSS2 libs if newer are not found
On LGTM, legacy packages are installed automatically otherwise.
2020-01-30 15:37:45 +01:00
Tobias Brunner ed8430630f travis: tpm2-tss switched the default crypto backend to OpenSSL with 2.2.0 2020-01-30 15:37:45 +01:00
Tobias Brunner c9a3430368 travis: Trigger code review on lgtm.com
Only the master (daily) and pull requests are scanned automatically.
2020-01-30 15:37:45 +01:00
Tobias Brunner 48017a2740 conf: Complete ordering functions for ConfigOption class 2020-01-29 13:31:42 +01:00
Tobias Brunner 1147973661 pkcs11: Avoid naming conflict with method parameter 2020-01-28 15:32:43 +01:00
Tobias Brunner 18a3e6d80f systime-fix: Replace asctime() with thread-safe asctime_r()
According to the man page, the buffer should have room for at least
26 characters.
2020-01-28 15:32:43 +01:00
Tobias Brunner 584e8197fe load-tester: Avoid naming conflict with local certificate variables 2020-01-28 15:32:43 +01:00
Tobias Brunner a7126dd47e sw-collector: Avoid naming conflicts with local count variables 2020-01-28 15:32:43 +01:00
Tobias Brunner f168f5782b eap-aka-3gpp2: Fix a bunch of typos 2020-01-28 15:32:43 +01:00
Tobias Brunner 378fe7a4bf eap-aka-3gpp2: Avoid naming conflict with parameters of crypto functions 2020-01-28 15:32:43 +01:00
Tobias Brunner 719cfc7846 eap-aka-3gpp2: Avoid naming conflict with local AMF variable 2020-01-28 15:32:43 +01:00
Tobias Brunner b7019a5c9e pool: Avoid conflict with start/end variables used in many commands 2020-01-28 15:32:43 +01:00
Tobias Brunner 26f20cc258 aesni: Namespace include guard for AES-CMAC
Was the same as in the cmac plugin.
2020-01-28 15:32:43 +01:00
Tobias Brunner e438915e62 tls-prf: Remove unused/undeclared argument in TLS 1.0/1.1 PRF constructor 2020-01-28 15:32:43 +01:00
Tobias Brunner ea1f4cd7a9 pki: Avoid naming conflict with global variables for passed arguments 2020-01-28 15:32:43 +01:00
Tobias Brunner d493dc18d6 scepclient: Avoid name conflict with global PKCS#7 chunk
Use the same name as further down below in the file.

Fixes: 04ff78aa33 ("scepclient: Store received RA certificates, using CA cert name as base.")
2020-01-28 15:32:43 +01:00
Tobias Brunner 42928551ab starter: Avoid hiding global variable when checking PID file 2020-01-28 15:29:40 +01:00
Tobias Brunner cab86465bb copyright: Make strings static const
They are not used anywhere else.
2020-01-28 15:29:40 +01:00
Tobias Brunner 90df054f14 plugin-constructors: Remove unused import for `sys` 2020-01-28 15:29:40 +01:00
Tobias Brunner c584a6b2dc vici: Remove unused import in Python bindings 2020-01-28 15:29:40 +01:00
Tobias Brunner df4274171e vici: Remove unnecessary `pass` statement 2020-01-28 15:29:40 +01:00
Tobias Brunner 7bcbf20b3d array: Avoid overflow in size calculation
While it's unlikely that so many (large) items are allocated, this is
technically more correct.  The result previously could overflow an
unsigned int (the conversion to size_t happened afterwards).
2020-01-28 15:29:40 +01:00
Tobias Brunner 73ee7b6664 swanctl: Add missing header guards for load commands 2020-01-28 15:29:40 +01:00
Tobias Brunner 91c6387e69 swanctl: Add missing `extern` for `swanctl_dir` variable in header
This clearly never was correct, but didn't cause problems so far.
However, GCC 10 will default to `-fno-common` instead of
`-fcommon` (https://gcc.gnu.org/PR85678), so compilation there fails
with something like:

```
libtool: link: gcc ... -o .libs/swanctl ...
ld: commands/load_authorities.o:strongswan/src/swanctl/./swanctl.h:33:
  multiple definition of `swanctl_dir'; commands/load_all.o:strongswan/src/swanctl/./swanctl.h:33: first defined here
```

Fixes: 501bd53a6c ("swanctl: Make credential directories relative to swanctl.conf")
Closes strongswan/strongswan#163.
2020-01-28 15:29:40 +01:00
Tobias Brunner 8ea13bbc5c lgtm: Add query to detect problematic uses of chunk_from_chars()
GCC 9+ and clang 4+ (partially) optimize out usages of
chunk_from_chars() if the value is read outside of the block where the
macro is used.  For instance:

```
chunk_t chunk = chunk_empty;
if (...)
{
	chunk = chunk_from_chars(0x01, 0x06);
}
/* do something with chunk */
```

The chunk_from_chars() macro expands to a chunk_t declaration, which is
technically only defined inside that block.

Still, with older GCC versions the fourth line was compiled to something
like this:

```
mov     WORD PTR [rsp+14], 1537 # 0x0106 in little-endian
lea     rdx, [rsp+14]
mov     ecx, 2
```

However, with GCC 9.1 and -O2 the first instruction might be omitted
(strangely the others usually were not, so the chunk pointed to whatever
was stored on the stack).  It's not easily reproducible, so there are
situations where the seemingly identical code is not optimized in this
way.

This query should detect such problematic uses of the macro (definition
and usage in different blocks).

References #3249.
2020-01-27 18:31:09 +01:00
Tobias Brunner 9c6ab71782 lgtm: Add config for a more complete build on lgtm.com 2020-01-27 18:00:49 +01:00
Tobias Brunner 3be430cc13 travis: Build on ARM64, IBM Power and IBM Z architectures
IBM Z is big-endian, IBM Power runs in little-endian mode.

Botan requires a fix for issues with GCC and amalgamation enabled (target
pragma ‘*’ is invalid) on ARM64 and IBM Power, while wolfSSL can't be
compiled successfully on IBM Z without an additional patch.

libunwind is not available for x390x, but since we explicitly disable
such backtraces it's not necessary anyway.
2020-01-22 15:10:09 +01:00
Tobias Brunner 3bc0c9807a sha3: Fix readLane() macro on big-endian platforms 2020-01-20 11:05:17 +01:00
Tobias Brunner b0b928dd0a Use Botan 2.13.0 for tests 2020-01-16 08:30:47 +01:00
Tobias Brunner ce4ed21fcb scepclient: Add missing short options (-i, -T) 2020-01-15 12:02:18 +01:00
Tobias Brunner dc4058ef16 Merge branch 'vici-pytest'
Adds tox.ini to test with tox (which is now used on Travis) and includes
the tests in the source distribution.
2020-01-14 16:53:53 +01:00
Tobias Brunner ecf161e517 vici: Move Python test dir and include it in sdist
This is the recommended location and import config as it allows running the
tests against installed versions of the package.  And while the test file
itself is automatically included in the source distribution this way, the
__init__.py file is not, so we still have to update MANIFEST.in.
2020-01-14 16:53:19 +01:00
Tobias Brunner 6352954807 travis: Run python tests with tox 2020-01-14 15:27:06 +01:00
Tobias Brunner b723431540 vici: Run Python tests via tox if available
Since we use the serial test harness we can't use AM_TESTS_ENVIRONMENT.
The script is necessary for out-of-tree builds.
2020-01-14 15:26:52 +01:00
Tobias Brunner 574621d80a vici: Fix several PEP8 issues 2020-01-14 15:26:32 +01:00
Tobias Brunner d5153c5897 vici: Add tox.ini to run tests with tox
Some of the interpreters might not be available on the host system, use
--skip-missing-interpreters to not fail in that case.
2020-01-14 15:26:29 +01:00
Tobias Brunner c170bb593b vici: List newer Python versions in setup.py 2020-01-14 10:48:53 +01:00
Tobias Brunner 282c57b131 travis: Bump wolfSSL to 4.3.0 2020-01-13 15:49:57 +01:00
Tobias Brunner 846dde91ae wolfssl: Undef RSA_PSS_SALT_LEN_DEFAULT as wolfSSL 4.3.0 defines it as enum 2020-01-13 15:49:57 +01:00
Tobias Brunner 83c8f887d9 Revert "travis: Add a workaround for a bug regarding libtool installed via Homebrew"
This reverts commit 1806ba0890 as the
workaround is not required anymore and now actually fails because
pre-installed tools have a dependency on libtool.
2019-12-19 11:42:12 +01:00
Andreas Steffen e5f18a46b7 Version bump to 5.8.2 2019-12-17 14:30:41 +01:00
Andreas Steffen b9eade0ca2 Version bump to 5.8.2rc2 2019-12-16 22:11:43 +01:00
Tobias Brunner a3166c8188 kernel-netlink: Use correct config option name for HW offloading check
Fixes: a605452c03 ("kernel-netlink: Check for offloading support in constructor")
2019-12-13 17:20:51 +01:00
Tobias Brunner 8d9a7fcae3 drbg: Fix Doxygen group in headers 2019-12-12 11:09:06 +01:00
Tobias Brunner a669145086 Fixed some typos, courtesy of codespell 2019-12-12 11:09:06 +01:00
Tobias Brunner 174bfe51f9 NEWS: Added some news for 5.8.2 2019-12-12 11:09:06 +01:00
Thomas Egerer cf18951efd openssl: Make some additional arguments const
Related to openssl 1.1.x changes.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2019-12-11 13:09:04 +01:00
Tobias Brunner 8ee1242f14 libtpmtss: Convert RSA exponent to big-endian when provided by a TPM 2.0
While the TPM expects and returns the data in big-endian, the SAPI
implementation converts it to native-endianness.  As stated in the
SAPI specification (section 3.2):

  8. All SAPI data SHALL be in native-endian format.  This means that
     the SAPI implementation will do any endian conversion required for
     both inputs and outputs.

So to use the exponent in a chunk we have to convert it to big-endian again.

Fixes: 7533cedb9a ("libtpmtss: Read RSA public key exponent instead of assuming its value")
2019-12-10 15:19:32 +01:00
Tobias Brunner a84aeb01aa ikev2: Destroy IKE_SA if INVALID_SYNTAX notify is received in response
RFC 7296, section 2.21.3:

   If a peer parsing a request notices that it is badly formatted (after
   it has passed the message authentication code checks and window
   checks) and it returns an INVALID_SYNTAX notification, then this
   error notification is considered fatal in both peers, meaning that
   the IKE SA is deleted without needing an explicit Delete payload.
2019-12-09 12:26:54 +01:00
Tobias Brunner 10e0faf477 ikev2: Destroy IKE_SA when receiving invalid authenticated requests
RFC 7296, section 2.21.3:

   If a peer parsing a request notices that it is badly formatted (after
   it has passed the message authentication code checks and window
   checks) and it returns an INVALID_SYNTAX notification, then this
   error notification is considered fatal in both peers, meaning that
   the IKE SA is deleted without needing an explicit Delete payload.
2019-12-09 12:26:54 +01:00
Tobias Brunner 51ac22579d ikev2: Send INVALID_MAJOR_VERSION notify using the same exchange type and MID
This is per RFC 7296, section 1.5.
2019-12-09 12:26:54 +01:00
Tobias Brunner e3e0fe41ab sshkey: Rename variables that conflict with function argument 2019-12-09 11:34:30 +01:00
Tobias Brunner a6723ee3e0 chunk: Rename hash key variable to avoid conflicts with function arguments 2019-12-09 11:23:02 +01:00
Tobias Brunner d3ca9fcda4 attr: Remove unused/undeclared argument in provider constructor 2019-12-09 11:05:25 +01:00
Andreas Steffen c2d6ac1124 Version bump to 5.8.2rc1 2019-12-07 23:06:22 +01:00
Tobias Brunner 3d40bf6491 configure: Drop unnecessary gperf version check
While the check probably made sense when strongSwan 4.x was started, gperf
version 3.0.1 was released in 2003, so it's very unlikely that version 2.x
is still around anywhere.
2019-12-06 10:30:52 +01:00
Tobias Brunner 72373d940a configure: Abort if gperf is not found but generated files don't exist
When building from a tarball gperf is not required as the generated
files already exist, however, when building from the repository that's
not the case, so warn the user if gperf is not found.
2019-12-06 10:30:52 +01:00
Tobias Brunner 251ac44df3 configure: Declare GPERF and PERL as variables
These are documented in --help and will be cached.
2019-12-06 10:30:52 +01:00
Tobias Brunner c81a8a8f36 kernel-netlink: Properly compare routes for policies without gateway/netxhop
This happened when installing a duplicate bypass policy for a locally
connected subnet.  The destructor and the kernel-net part already
handle this correctly.
2019-12-06 10:28:13 +01:00
Tobias Brunner 6b347d5232 openssl: Ensure underlying hash algorithm is available during HMAC init
Without this we only would learn that the algorithm isn't actually
available (e.g. due to FIPS mode) when set_key() is called later, so there
isn't any automatic fallback to other implementations.

Fixes #3284.
2019-12-06 10:27:24 +01:00
Tobias Brunner 96b8fa72b3 Merge branch 'ca-identity-constraint'
This adds a new constraint for vici/swanctl.conf that enforces that the
certificate chain of the remote peer contains a CA certificate with a
specific identity.

This is similar to the existing CA constraints, but doesn't require that
the CA certificate is locally installed, for instance, intermediate CA
certificates received by the peers.

Wildcard identity matching (e.g. "..., OU=Research, CN=*") could also be
used for the latter, but requires trust in the intermediate CA to only
issue certificates with legitimate subject DNs (e.g. the "Sales" CA must
not issue certificates with "OU=Research").  With the new constraint
that's not necessary as long as a path length constraint prevents
intermediate CAs from issuing further intermediate CAs.
2019-12-06 10:23:59 +01:00
Tobias Brunner ae9b748a77 vici: Log certificate constraints for loaded configs 2019-12-06 10:07:47 +01:00
Martin Willi f95d512251 testing: Use identity based CA restrictions in rw-hash-and-url-multi-level
This is a prominent example where the identity based CA constraint is
benefical. While the description of the test claims a strict binding
of the client to the intermediate CA, this is not fully true if CA operators
are not fully trusted: A rogue OU=Sales intermediate may issue certificates
containing a OU=Research.

By binding the connection to the CA, we can avoid this, and using the identity
based constraint still allows moon to receive the intermediate over IKE
or hash-and-url.
2019-12-06 10:07:47 +01:00
Martin Willi 026024bc02 swanctl: Include ca_id property in list-conns command 2019-12-06 10:07:46 +01:00
Martin Willi 55fc514ed2 swanctl: Document the remote ca_id option for identity based CA constraints 2019-12-06 10:07:46 +01:00
Martin Willi 3c71a3201f vici: Introduce a ca_id option identity based CA certificate constraints 2019-12-06 10:07:46 +01:00
Martin Willi c70201f1e3 auth-cfg: Add support for identity based CA authentication constraints
Enforcing CA based constraints previously required the CA certificate file
to be locally installed. This is problematic from a maintencance perspective
when having many intermediate CAs, and is actually redundant if the client
sends its intermediate cert in the request.

The alternative was to use Distinguished Name matching in the subject
identity to indirectly check for the issuing CA by some RDN field, such as OU.
However, this requires trust in the intermediate CA to issue only certificates
with legitime subject identities.

This new approach checks for an intermediate CA by comparing the issuing
identity. This does not require trust in the intermediate, as long as
a path len constraint prevents that intermediate to issue further
intermediate certificates.
2019-12-06 10:07:46 +01:00
Tobias Brunner 7035340b21 farp: Ignore SAs with 0.0.0.0/0 remote traffic selector
This is mostly to avoid hijacking the local LAN if the farp plugin is
inadvertently active on a roadwarrior.

Fixes #3116.
2019-12-06 10:06:16 +01:00
Tobias Brunner 202c204785 farp: Only cache IPv4 traffic selectors
Since ARP is IPv4 only there is no point caching IPv6 traffic
selectors/CHILD_SAs.
2019-12-06 09:58:29 +01:00
Tobias Brunner dc1e02e1de Merge branch 'ocsp-nonce'
This makes sure the nonce sent in an OCSP request is contained in the
response (it also fixes parsing the nonce, which didn't matter so far
as it was never used)
2019-12-06 09:53:26 +01:00
Tobias Brunner 27756b081c revocation: Check that nonce in OCSP response matches 2019-12-06 09:52:30 +01:00
Tobias Brunner cd0e4d5297 x509: Correctly parse nonce in OCSP response
Fixes: d7dc677ee5 ("x509: Correctly encode nonce in OCSP request")
2019-12-06 09:52:30 +01:00
Tobias Brunner 5333db58ac x509: Add getter for nonce in OCSP request/response implementations 2019-12-06 09:50:55 +01:00
Tobias Brunner 5b23427b37 credentials: Add getter for nonce in OCSP request and response interface 2019-12-06 09:50:55 +01:00
Andreas Steffen a43407df52 drbg: Don't generate more than 2^16 bytes 2019-11-28 21:29:26 +01:00
Tobias Brunner 8b6aadae9c Merge branch 'aes-ecb'
Adds support for AES in ECB mode (where supported by the underlying
library/API) and uses it for the CTR-DRBG implementation.
2019-11-28 17:16:36 +01:00
Andreas Steffen 86a4b95eac drbg: Use AES_ECB encryption 2019-11-28 17:03:09 +01:00
Andreas Steffen b7e840af5c gcrypt: Added AES_ECB support 2019-11-28 17:03:09 +01:00
Andreas Steffen a46e436e29 af-alg: Added AES_ECB support 2019-11-28 17:03:09 +01:00
Andreas Steffen f884ee6497 aes: Added AES_ECB support 2019-11-28 17:03:09 +01:00
Andreas Steffen 6f44bd6fe8 openssl: Added AES_ECB support 2019-11-28 17:03:08 +01:00
Andreas Steffen 20f3d04b13 aesni: Added AES_ECB support 2019-11-28 17:03:08 +01:00
Tobias Brunner 1352413272 vici: Update Python egg if strongSwan version changed
Mainly useful when using the build-strongswan script of the testing
environment.
2019-11-28 16:52:30 +01:00
Andreas Steffen 11e9d2b8d1 drbg: The drbg instance owns the entropy rng 2019-11-28 09:55:56 +01:00
Andreas Steffen ccaedf8761 Version bump to 5.8.2dr2 2019-11-26 22:36:55 +01:00
Tobias Brunner b290f43c5f Merge branch 'hash-url-multi-level'
Adds support to send intermediate CA certificates in hash-and-URL
encoding.  For that it moves the generation of URLs from the config
backends to the ike-cert-post task.

Fixes #3234.
2019-11-26 14:48:25 +01:00
Tobias Brunner 91dabace11 testing: Add scenario with hash-and-URL encoding for intermediate CA certificates 2019-11-26 11:12:26 +01:00
Tobias Brunner d592ff72bc stroke: Remove obsolete certificate registration for hash-and-URL 2019-11-26 11:12:26 +01:00
Tobias Brunner ad14f3a60d vici: Remove obsolete certificate registration for hash-and-URL 2019-11-26 11:12:26 +01:00
Tobias Brunner d384f40f20 ike-cert-post: Encode intermediate CA certificates as hash-and-URL if possible 2019-11-26 11:12:26 +01:00
Tobias Brunner ae06cfad36 ike-cert-post: Generate URL for hash-and-URL here
This avoids having to register certificates with authority/ca backends
beforehand, which is tricky for intermediate CA certificates loaded
themselves via authority/ca sections.  On the other hand, the form of
these URLs can't be determined by config backends anymore (not an issue
for the two current implementations, no idea if custom implementations
ever made use of that possibility).  If that became necessary, we could
perhaps pass the certificate to the CDP enumerator or add a new method
to the credential_set_t interface.
2019-11-26 11:12:26 +01:00
Thomas Egerer a605452c03 kernel-netlink: Check for offloading support in constructor
This avoids races that could potentially occur when doing the check during
SA installation.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2019-11-26 11:00:28 +01:00
Tobias Brunner 29b4b2e8e2 testing: Import sys in Python updown script 2019-11-21 16:57:25 +01:00
Tobias Brunner ec2d2e4e5f android: New version after fixing fetching via HTTP on Android 9 2019-11-19 14:44:39 +01:00
Tobias Brunner 47c1e86a4c android: Add networkSecurityConfig to fetch CLRs/OCSP via HTTP
Android 9 restricts this to only HTTPS by default.

Fixes #3273.
2019-11-19 14:44:39 +01:00
Tobias Brunner e65f6c20da android: Update Gradle plugin 2019-11-19 14:44:39 +01:00
Tobias Brunner 0663ca5f57 Fix Android.mk for libstrongswan after adding DRBGs 2019-11-19 14:44:39 +01:00
Tobias Brunner 662574386a testing: Accept LANG and LC_* env variables via SSH on guests
The client config already includes SendEnv for them.  Without that these
variables currently default to POSIX.
2019-11-14 16:11:03 +01:00
Tobias Brunner 7cde77c638 swanctl: Document wildcard matching for remote identities 2019-11-12 10:59:38 +01:00
Tobias Brunner eea58222d5 conf: Replace deprecated OptionParser with ArgumentParser 2019-11-12 10:58:07 +01:00
zhangkaiheb@126.com a5b3c62091 testing: Remove unused connection definition in ikev2/force-udp-encaps 2019-11-07 11:35:43 +01:00
zhangkaiheb@126.com 9d8d85f23c testing: Fix SHA description in ikev*/esp-alg-null scenarios 2019-11-07 11:33:09 +01:00
Tobias Brunner 07083788e5 proposal: Fix typos and clarify things in comments 2019-11-04 15:22:18 +01:00
Kenyon Ralph 64e68d2298 man: Correct typo in description of closeaction
Closes strongswan/strongswan#158.
2019-10-29 10:50:49 +01:00
Tobias Brunner a0a03c25f7 Merge branch 'enum-strings'
Adds a compile check the number of enum strings and updates several of
these lists, in particular, the one in the pfkey-kernel plugin, where
strings for several new extensions on FreeBSD were missing.

Fixes #3210.
2019-10-28 18:46:11 +01:00
Tobias Brunner f3d8179b4b kernel-pfkey: Add additional strings for extensions on different platforms
Don't define structs for macOS as we don't need them (that's true for
most of the others too, though) and at least one is defined inside an extra
ifdef.
2019-10-28 14:26:32 +01:00
Tobias Brunner 45c8399d78 Add missing strings to several enum string definitions 2019-10-28 14:26:32 +01:00
Tobias Brunner 8b98482e04 enum: Add compile-time check for missing strings
If strings are missing (e.g. because the last value of a range changed
unknowingly or adding a string was simply forgotten) compilation will
now fail.

This could be problematic if the upper limit is out of our control (e.g.
from a system header like pfkeyv2.h), in which case patches might be
required on certain platforms (enforcing at least, and not exactly, the
required number of strings might also be an option to compile against
older versions of such a header - for internal enums it's obviously
better to enforce an exact match, though).
2019-10-28 14:26:32 +01:00
Tobias Brunner 1bf58f6ad8 kernel-netlink: Support extended table IDs for custom routes
This adds support for installing routes in tables with IDs > 255.
2019-10-25 16:21:22 +02:00
Tobias Brunner 08d0342ca6 vici: List additional information for deleted CHILD_SAs
If a CHILD_SA is terminated, the updown event is triggered after the
CHILD_SA is set to state CHILD_DELETED, so no usage stats or detail
information like SPIs were reported.  However, when an IKEv2 SA is
terminated, the updown event for its children is triggered without
changing the state first, that is, they usually remain in state
INSTALLED and detailed data was reported in the event.  IKEv1
CHILD_SAs are always terminated individually, i.e. with state
change and no extra data so far.

With this change usage stats are also returned for individually deleted
CHILD_SAs as long as the SA has not yet expired.

Fixes #3198.
2019-10-25 16:15:42 +02:00
Tobias Brunner 62e7c68b61 kernel-pfkey: Clear receive buffer before sending request
Many of the messages sent by the kernel, including confirmations to our
requests, are sent as broadcasts to all PF_KEY sockets.  So if an
external tool is used to manage SAs/policies (e.g. unrelated to IPsec)
the receive buffer might be filled, resulting in errors like these:

  error sending to PF_KEY socket: No buffer space available

To avoid this, just clear the buffer before sending any message.

Fixes #3225.
2019-10-25 13:53:06 +02:00
Tobias Brunner a463ef4435 Merge branch 'proposal-flags'
This uses flags for proposal selection and cloning that control
whether DH groups and algorithms from a private range are skipped, and
for selection whether configured or supplied proposals/algorithms are
preferred.
2019-10-24 17:47:45 +02:00
Tobias Brunner ec93acff03 proposal: Remove unused strip_dh() method 2019-10-24 17:43:21 +02:00
Tobias Brunner a2cb2c9cc8 proposal: Add selection flags to clone() method
This avoids having to call strip_dh() in child_cfg_t::get_proposals().
It also inverts the ALLOW_PRIVATE flag (i.e. makes it SKIP_PRIVATE) so
nothing has to be supplied to clone complete proposals.
2019-10-24 17:43:21 +02:00
Tobias Brunner 3187293e3d quick-mode: Promote selected DH group instead of stripping all others
Since only the first DH group is encoded for IKEv1 this should have the
same effect as removing all other groups.
2019-10-24 17:36:37 +02:00
Tobias Brunner c9599d4101 proposal: Extract proposal selection code in ike/child_cfg_t
Also invert the PREFER_CONFIGURED flag (i.e. make it PREFER_SUPPLIED)
so the default, without flags, is what we preferred so far.
2019-10-24 17:36:33 +02:00
Tobias Brunner a406bc60c5 proposal: Handle skipping DH groups directly in select() and matches()
Also renames the flag.
2019-10-24 17:33:57 +02:00
Thomas Egerer f930b732c4 proposal: Use flags to select/match proposals
During proposal selection with ike/child_cfgs a couple of boolean
variables can be set (e.g. private, prefer_self, strip_dh). To simplify
the addition of new parameters, these functions now use a set of flags
instead of indiviual boolean values.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2019-10-24 17:22:53 +02:00
Tobias Brunner 8346db09dd travis: Bump wolfSSL to 4.2.0 2019-10-23 17:50:20 +02:00
Tobias Brunner b3db361727 Merge branch 'ipv6-addrs-mobike'
Address enumeration on Linux now ignores deprecated addresses and
whether temporary or permanent IPv6 addresses are included now depends
on the charon.prefer_temporary_addrs setting.

Closes #3192.
2019-10-22 14:55:28 +02:00
Tobias Brunner 9f12b8a61c kernel-netlink: Enumerate temporary IPv6 addresses according to config
This way we announce only permanent addresses via MOBIKE by default, and
temporary ones if the option is enabled.
2019-10-22 14:14:44 +02:00
Tobias Brunner 64795cc416 kernel-netlink: Don't enumerate deprecated IPv6 addresses 2019-10-22 14:13:32 +02:00
Tobias Brunner cf98706bb8 utils: Handle NULL consistently if memwipe() is implemented via explicit_bzero()
Our own implementation ignores NULL values, however, explicit_bzero()
can't handle that, as indicated by the `__nonnull ((1))` attribute in the
function's signature in string.h, and causes a segmentation fault.  This
was noticed in one of the unit tests for NewHope.  Since we usually use
memwipe() via chunk_clear(), which already ignores NULL pointers, this
is not that much of an issue in practice.

Fixes: 149d1bbb05 ("memory: Use explicit_bzero() as memwipe() if available")
2019-10-21 13:58:12 +02:00
Tobias Brunner 393e39a1bc travis: Switch to the Ubuntu 18.04 (bionic) image for tests
Do two full build tests on 16.04 (xenial) and the two for OpenSSL 1.0
also run there.  Since 18.04 ships OpenSSL 1.1.1, which conflicts with
our custom built version, we skip that until OpenSSL 3.0 is released.
A workaround is required for an issue with sonarqube on bionic.
2019-10-21 13:58:12 +02:00
Tobias Brunner 768e013790 prf-plus: Fail after counter has wrapped around
The behavior is undefined if this happens (RFC 7296, section 2.13).
Instead of switching to the non-counter mode, or letting the counter
wrap, this makes it clear that the usage was not as intended.
2019-10-21 13:53:11 +02:00
Tobias Brunner c75010080a prf-plus: Fix a potential memory leak if get_bytes() fails 2019-10-21 12:22:22 +02:00
Tobias Brunner 1b96e4a465 drbg-ctr: Remove unused variable 2019-10-21 10:32:59 +02:00
David Garske 29f7017663 wolfssl: Fix for issue with blinding not defined
Closes strongswan/strongswan#156.
2019-10-21 09:56:55 +02:00
Andreas Steffen 4f4e026d3b Version bump to 5.8.2dr1 2019-10-18 16:26:41 +02:00
Andreas Steffen f05e9eebb0 testing: Added drbg plugin where required 2019-10-18 16:24:39 +02:00
Andreas Steffen e36af6fc2f gmp: Use NIST DRBG for RSA key pair generation 2019-10-18 16:24:39 +02:00
Andreas Steffen ea41f759b3 stroke: List drbgs in list_algs 2019-10-18 16:24:39 +02:00
Andreas Steffen c738704ab6 vici: List drbgs in get_algorithms 2019-10-16 16:46:24 +02:00
Andreas Steffen 6d3a743d90 ntru: Replaced ntru_drbg by drbg 2019-10-16 16:46:24 +02:00
Andreas Steffen 737375a2d2 drbg: Implemented NIST SP-800-90A DRBG 2019-10-16 16:46:24 +02:00
Tobias Brunner 2a7937f179 Merge branch 'android-updates'
Makes the local identity configurable and includes a fix for Android 10,
plus a break-before-make reauth issue (not Android specific) and some
deprecation workarounds.
2019-10-15 17:28:25 +02:00
Tobias Brunner 6e12aa68b3 android: New release after making local identity configurable
This also includes a fix for Android 10 and some older fixes for
API level 28 compatibility and a crash on Huawei devices.  The API
used to detect network changes is also replaced on newer Android
versions and an issue with DELETES received during break-before-make
reauthentication is also fixed.
2019-10-15 17:25:42 +02:00
Tobias Brunner 60457e2aef ike-delete: Continue break-before-make reauth if server concurrently deletes SA
There seem to be servers around that, upon receiving a delete from the
client, instead of responding with an empty INFORMATIONAL, send a delete
themselves.
2019-10-15 17:25:37 +02:00
Tobias Brunner 71d143149c android: Replace deprecated CONNECTIVITY_ACTION on newer Android versions
It was deprecated in API level 28, registerNetworkCallback is available
since API level 21, but ConnectivityManager got some updates with 24
(e.g. default network handling) so we start using it then.
2019-10-15 17:07:02 +02:00
Tobias Brunner 1227b43fe4 android: Don't use specific key types to select user certificates
Android 10 will honor the preselection and could, thus, hide some
installed certificates if we only pass "RSA".  The dialog will also only
be shown if there are actually certificates installed (i.e. users will
have to do that manually outside of the app or via profile import).

Fixes #3196.
2019-10-15 17:06:36 +02:00
Tobias Brunner a82673346e android: Import local identity for all authentication types 2019-10-15 17:05:56 +02:00
Tobias Brunner 698a18e7a5 android: Allow configuration of client identity for all authentication types
This replaces the drop-down box to select certificate identities with a
text field (in the advanced settings) with auto-completion for SANs
contained in the certificate.

The field is always shown and allows using an IKE identity different from
the username for EAP authentication (e.g. to configure a more complete
identity to select a specific config on the server).

Fixes #3134.
2019-10-15 17:05:56 +02:00
Tobias Brunner df0214baa6 android: Rename adapter for gateway address auto-completion 2019-10-15 12:18:45 +02:00
Tobias Brunner 999287f679 android: No auto-completion required for DNS server text box 2019-10-15 12:18:45 +02:00
Tobias Brunner 2e74fc2197 android: Add helper to read strings from text boxes 2019-10-15 12:18:45 +02:00
Tobias Brunner 54a4a3632d android: Fix deprecation warning related to FragmentPagerAdapter 2019-10-15 12:18:45 +02:00
Tobias Brunner 2ee1c6b106 android: Update AndroidX libraries 2019-10-15 12:18:45 +02:00
Tobias Brunner 57d61730b0 android: Update Gradle plugin 2019-10-15 12:18:45 +02:00
Patryk Duda 121390fb3c kernel-pfkey: Pass ESN flag to kernel if ESN is enabled
This patch adds passing the ESN flag to the kernel if ESN was negotiated
and the appropriate flag is present in the kernel headers, which will
be the case in future FreeBSD releases.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
Closes strongswan/strongswan#155.
2019-10-14 18:03:34 +02:00
Tobias Brunner 9cc24ca39e Use Botan 2.12.1 for tests 2019-10-14 11:43:58 +02:00
Tobias Brunner 0736882678 Use Botan 2.12.0 for tests 2019-10-07 14:31:40 +02:00
Felix Kaiser 7c74ce9190 vici: Use unique names for CHILD_SAs in the child-updown event too
The unique names were introduced for the list-sas command in commit
04c0219e55.  However, the child-updown
event wasn't updated to match.  Even though the documentation suggests
that the section name of the CHILD_SAs are the same in both messages.

The original name is already being returned in the "name" attribute,
so it'll still be available.

Example:

    >>> import vici, json
    >>> s = vici.Session()

    # First, for comparison, the list-sas command:
    >>> print(json.dumps(list(s.list_sas()), sort_keys=True, indent=4, separators=(',', ': ')))
    [
        {
            "vti0": {
                "child-sas": {
                    "vti0-1": {
                        ...

    # A child-updown event before the change:
    >>> for x in s.listen(["child-updown"]): print(json.dumps(x, sort_keys=True, indent=4, separators=(',', ': ')))
    [
        "child-updown",
        {
            "vti0": {
                "child-sas": {
                    "vti0": {   # <-- wrong: inconsistent with list-sas
                        ...

    # A child-updown event after the change:
    >>> s = vici.Session()
    >>> for x in s.listen(["child-updown"]): print(json.dumps(x, sort_keys=True, indent=4, separators=(',', ': ')))
    [
        "child-updown",
        {
            "vti0": {
                "child-sas": {
                    "vti0-1": {  # <-- fixed

Closes strongswan/strongswan#153.
2019-10-04 10:11:18 +02:00
Tobias Brunner d3bd576c46 fuzz: Add fuzzer for identification_t 2019-09-30 10:10:43 +02:00
Tobias Brunner 936d101d99 travis: Bump tpm2-tss to 2.3.1 2019-09-26 11:57:52 +02:00
David Garske 1a256ca65a wolfssl: Fixes for building with OpenSSL compatibility layer
Resolves conflicts with building against wolfSSL when
`--enable-opensslextra` is set, namely the `WOLFSSL_HMAC_H_`,
`RNG` and `ASN1_*` name conflicts.

Closes strongswan/strongswan#151.
2019-09-26 09:06:11 +02:00
Tobias Brunner 095a2c2eac openssl: Don't manually seed DRBG with OpenSSL 1.1.1
According to the documentation, it's generally not necessary to manually
seed OpenSSL's DRBG (and it actually can cause the daemon to lock up
during start up on systems with low entropy if OpenSSL is already trying
to seed it itself and holds the lock).  While that might already have been
the case with earlier versions, it's not explicitly stated in their
documentation.  So we keep the code for these versions.
2019-09-24 16:42:46 +02:00
Tobias Brunner 55879d3200 travis: Bump OpenSSL to 1.1.1d 2019-09-24 16:38:56 +02:00
Tobias Brunner b0c84c7542 daemon: Correctly re-register custom loggers in set_level()
Fixes: 2080c7e1e2 ("charon: Add custom logger to daemon")
Fixes #3182.
2019-09-20 14:16:09 +02:00
worldofpeace 9b0cc5c5cb charon-nm: Move D-Bus conf file to $(datadir)/dbus-1/system.d
Since D-Bus 1.9.18 configuration files installed by third-party should
go in share/dbus-1/system.d. The old location is for sysadmin overrides.

Closes strongswan/strongswan#150.
2019-09-17 10:33:01 +02:00
Tobias Brunner a9fcf28007 conf: Fix typo in documentation of charon.rdn_matching
Fixes #3165.
2019-09-03 10:26:29 +02:00
Andreas Steffen 1e38151b30 Version bump to 5.8.1 2019-09-02 14:39:16 +02:00
Andreas Steffen 7cfe85cc85 Version bump to 5.8.1rc2 2019-08-29 11:15:18 +02:00
Andreas Steffen d2b771203f Version bump to 5.8.1rc1 2019-08-28 16:38:40 +02:00
Tobias Brunner 17c9972252 Fixed some typos, courtesy of codespell 2019-08-28 14:03:41 +02:00
Tobias Brunner 82cd511cc9 NEWS: Added some news for 5.8.1 2019-08-28 12:17:44 +02:00
Tobias Brunner 902f38dd3e ikev2: Check the length of received COOKIE notifies
As specified by RFC 7296, section 2.6, the data associated with COOKIE
notifications MUST be between 1 and 64 octets in length (inclusive).

Fixes #3160.
2019-08-28 12:15:27 +02:00
Tobias Brunner 8cd5f33dd8 libipsec: Fix compiler warning with GCC 9
The compiler complains that "taking address of packed member ... of
class or structure 'ip6_hdr' may result in an unaligned pointer value".
We don't care if the address is aligned as we explicitly use untoh16()
to convert the read value.
2019-08-28 11:10:49 +02:00
Tobias Brunner d6949b15ab cirrus: Run automated tests on FreeBSD via Cirrus CI 2019-08-28 11:10:49 +02:00
Tobias Brunner 535277afc5 Fix issue with $< automatic variable on FreeBSD
BSD make only evaluates $< for implicit rules, so building from the
repository won't work unless GNU make is installed and used, or we
replace affected uses like this.
2019-08-27 18:12:28 +02:00
Tobias Brunner 0a29ace908 Merge branch 'android-updates'
Some fixes for Android 9 (28) and other issues.  Also migrated to
AndroidX.

Closes strongswan/strongswan#148.
2019-08-26 11:29:09 +02:00
Tobias Brunner 3716af079e android: Avoid crash related to TileService on Huawei devices
No idea when exactly this happens but on many Huawei devices (and
only on them) it seems that onStartListening is sometimes called after
onDestroy i.e. when the database was already closed.  This caused an
InvalidStateException in getProfile via updateTile when retrieving the
current profile.  It's possible that it happens during shutdown (there
have been similar reports related to TileService implementations) so
users might not even notice, but it pollutes the Play Console, so this
workaround now makes sure the database is open when updateTile is called.
2019-08-26 11:28:16 +02:00
Tobias Brunner 8af50736e1 android: Fix null pointer dereference in TextInputLayoutHelper
The AndroidX/Material version of TextInputLayout actually supports a
helper text, but it is always shown, so we continue to use our version.
2019-08-26 11:20:48 +02:00
Tobias Brunner 9a305b7cbe android: Replace deprecated Html.fromHtml with version from AndroidX 2019-08-26 11:20:48 +02:00
Tobias Brunner 3b9696fc9b android: Migrate from support libraries to AndroidX
The support libraries will not be developed further.
2019-08-26 11:20:48 +02:00
Tobias Brunner 07a7d842f1 android: Request FOREGROUND_SERVICE permission
This is required since API 28 to call Service.startForeground.
2019-08-26 11:20:48 +02:00
Tobias Brunner d59158df7b android: Switch to Loaders from the support library
They are officially deprecated as of API 28 (recommended replacement is
a combination of ViewModels and LiveData, maybe something to look into
later).
2019-08-26 11:20:48 +02:00
Tobias Brunner ef57913d37 android: Set compile-/targetSdkVersion to 28
This is mandatory for new apps since August 1, 2019 and will be for existing
apps in November 1, 2019.
2019-08-26 11:20:48 +02:00
Tobias Brunner 1ce5dd92fe android: Update Gradle plugin 2019-08-26 11:20:48 +02:00
Tobias Brunner 770f4ccee1 identification: Optionally match RDNs in any order and accept missing RDNs 2019-08-26 11:15:53 +02:00
Martin Willi c0d5c6553a Run gperf with --output-file instead of output redirection
When missing gperf, the redirection generates an empty file, which must
be manually removed after gperf has been installed. This is difficult
to diagnose, as the produced build error is cryptic.

Use --output-file of gperf instead to avoid creating an empty file if
gperf is missing. This still requires the user to re-run ./configure
after installing gperf, though.
2019-08-26 10:56:36 +02:00
Tobias Brunner 9543a771dd updown: Pass the local interface the traffic to the peer actually takes
If the local IP is not on the interface the peer is reached through,
firewall rules will be installed with the wrong interface.

Fixes #3095.
2019-08-26 10:55:01 +02:00
Tobias Brunner 0ee64f88e5 attributes: Add definition of some additional configuration attributes 2019-08-26 10:16:48 +02:00
Tobias Brunner a4279fcc38 asn1: Fix a compiler warning with GCC 9.1
Compiling with GCC 9.1, as e.g. happens on AppVeyor, results in the
following warning:

asn1/asn1.c: In function 'asn1_integer':
asn1/asn1.c:871:24: error: '<Ucb40>' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  871 |  len = content.len + ((*content.ptr & 0x80) ? 1 : 0);
      |                        ^~~~~~~~~~~~

Some experiments showed that the problem was the chunk_from_chars()
assignment.  This might be because the temporary chunk_t that was assigned
to the variable was defined in a sub-block, so it might actually be
undefined later when *content.ptr is read.
2019-08-23 09:06:34 +02:00
Tobias Brunner a1295ff9cb load-tester: Add digitalSignature keyUsage flag to test certificate
This allows using the certificate, which is technically a CA cert, as
end-entity certificate again after the RFC4945-related changes added
with 5.6.3.

Fixes #3139.
2019-08-22 15:33:14 +02:00
Tobias Brunner b9949e98c2 Some whitespace fixes
Didn't change some of the larger testing scripts that use an inconsistent
indentation style.
2019-08-22 15:18:06 +02:00
Tobias Brunner 68346b6962 Add an .editorconfig file
It's currently not possible to configure our indentation scheme for
continuation lines (i.e. use 1-3 spaces to align with the upper line).
There is an issue open regarding this, see [1].  So we can't run e.g.
eclint over our codebase to detect issues without getting a lot of
false positives.

The main trigger was that this sets the preferred tab width in GitHub's
code browser.

[1] https://github.com/editorconfig/editorconfig/issues/323

References #3111.
2019-08-22 15:18:06 +02:00
Tobias Brunner 149d1bbb05 memory: Use explicit_bzero() as memwipe() if available 2019-08-22 15:04:45 +02:00
Tobias Brunner f00c9f91a3 travis: Bump wolfSSL to 4.1.0 2019-08-12 14:25:56 +02:00
Tobias Brunner 05e3751ebb fuzz: Support build with -fsanitize=fuzzer instead of libFuzzer.a
Recent clang versions (6.0+) include libFuzzer and OSS-Fuzz switched to
that mode a while ago.
2019-07-17 11:44:27 +02:00
Tobias Brunner de07b77442 Use Botan 2.11.0 for tests 2019-07-02 11:35:21 +02:00
Tobias Brunner 6051d9b5e4 botan: Replace deprecated FFI function calls
Several "wrapper" functions have been marked deprecated with 2.11.0.
2019-07-02 11:35:21 +02:00
Andreas Steffen ab1aa03bf5 Version bump to 5.8.1dr1 2019-06-26 17:32:33 +02:00
krinfels 4b25885025 libtpmtss: Protect TPM 2.0 context by mutex
Each private key object created to access a key residing in a TPM 2.0
creates a context structure used for communication with the TSS.
When multiple IKE SAs are established at the same time and using the
same private key, it is possible to make concurrent calls to the
TSS with the same context which results in multiple threads writing
to the same place in memory causing undefined behaviour.

Fix this by protecting calls to the TSS with a mutex unique for
each TPM 2.0 context object.
2019-06-26 16:30:01 +02:00
Tobias Brunner 07a6e59b1c android: Fix remote identity fallback after changing IKE config creation
Fixes: 9486a2e5b0 ("ike-cfg: Pass arguments as struct")
2019-06-18 10:22:57 +02:00
Tobias Brunner 44e74d9f3e android: Fix typo when building IKE config
Fixes: 9486a2e5b0 ("ike-cfg: Pass arguments as struct")
2019-06-18 10:21:07 +02:00
Tobias Brunner 6cc0688e1e travis: Bump OpenSSL to 1.1.1c 2019-05-28 15:28:06 +02:00
Sheena Mira-ato fe3ae5be5d Add compile option to disable internal handling of fatal signals
By default, charon and its derivatives internally handle the SIGSEGV,
SIGILL, and SIGBUS signals raised by threads (segv_handler).  Add a compile
option so that the signal handling can optionally be done externally.

Closes strongswan/strongswan#132.
2019-05-28 10:44:48 +02:00
Tobias Brunner 71141cc8c9 ikev1: Do a rekey check before installing CHILD_SAs as responder
If CHILD_SAs are created while waiting for the third QM message we'd not
notice the redundancy and updown events would be triggered unevenly.
This is consistent with the behavior on the initiator, which already does
this check right before installation. Moving the existing check is not
possible due to the narrow hook and moving the installation changes which
peer installs the SAs first and could have other side-effects (e.g. in
error or conflict cases).  Still, this might result in CHILD_SA state
discrepancies between the two peers.

Fixes #3060.
2019-05-22 18:28:31 +02:00
SophieK 3aa7b2dc3a Avoid enumerating certificates with non-matching key type
If the key type was specified but the ID was NULL or matched a subject, it
was possible that a certificate was returned that didn't actually match
the requested key type.

Closes strongswan/strongswan#141.
2019-05-21 10:22:30 +02:00
Andreas Steffen 55dd0361b8 Version bump to 5.8.0 2019-05-20 12:31:08 +02:00
Tobias Brunner fbfe5a2724 proposal: Add missing curve448/x448 keywords
Fixes #3064.
2019-05-20 09:43:59 +02:00
Tobias Brunner 802da663c2 nm: Version bump to 1.4.5 2019-05-14 10:38:32 +02:00
Andreas Steffen 74ac0c9efd Version bump to 5.8.0rc1 2019-05-10 12:55:48 +02:00
Andreas Steffen 47879ca638 testing: Use strongswan systemd service 2019-05-10 12:55:09 +02:00
Andreas Steffen 6d8e6ec61b testing: Load PEM keys in ikev2/net2-net-rsa scenario 2019-05-10 12:54:28 +02:00
Andreas Steffen c9d898c9f4 testing: Copy keys and certs to swanctl/rw-newhope-bliss scenario 2019-05-10 12:53:33 +02:00
SophieK 7e0e3ef4e0 keymat_v1: Avoid memory leak during IKE key derivation in some error cases
Closes strongswan/strongswan#138.
2019-05-09 10:07:52 +02:00
Tobias Brunner 78cad110ea Merge branch 'build-certs'
Adds a script to generate the keys and certificates used for regression
tests dynamically.  They are built with the pki version installed in the
root image so it's not necessary to have an up-to-date version with all
required plugins installed on the host system.
2019-05-08 14:57:03 +02:00
Tobias Brunner 27f6d37544 testing: Return an error if any command in the certificate build script fails 2019-05-08 14:56:48 +02:00
Tobias Brunner d3f678c08f testing: Build certificates before guests after building strongSwan
If the script is run on a clean working copy, building the guests will
fail if the certificates don't exist.
2019-05-08 14:56:48 +02:00
Tobias Brunner 287149cbf9 testing: Automatically build guest images after generating certificates
This (re-)generates the CRLs on winnetou.
2019-05-08 14:56:48 +02:00
Tobias Brunner ac66ca25f9 testing: Use custom plugin configuration to build SHA-3 CA 2019-05-08 14:56:48 +02:00
Tobias Brunner 532060c0fa pki: Plugins to load may be defined via PKI_PLUGINS env variable 2019-05-08 14:56:48 +02:00
Tobias Brunner 21280da9f5 testing: Fix ikev2/net2net-rsa scenario 2019-05-08 14:56:48 +02:00
Tobias Brunner da8e33f3ca testing: Add wrapper script to build certificates in root image
This does not modify the root image but uses the strongSwan version
installed there (avoids build dependencies on version installed on the
host to use pki to generate all the keys and certificates).
2019-05-08 14:56:48 +02:00
Andreas Steffen a89ad28b89 testing: Upgrade to Linux 5.1 kernel 2019-05-08 14:56:48 +02:00
Andreas Steffen df6441a13f pki: Allow inclusion of [unsupported] critical X.509 extension 2019-05-08 14:56:48 +02:00
Andreas Steffen b213204b3b testing: Updated build-certs script 2019-05-08 14:56:48 +02:00
Andreas Steffen cfeae14b06 testing: Deleting dynamic test keys and certificates 2019-05-08 14:56:48 +02:00
Tobias Brunner 2a72056cee testing: Exclude files that are ignored in Git from the distribution
Since the complete hosts and tests directories are part of the tarball
this would include generated certificates and keys.
2019-05-08 14:56:48 +02:00
Andreas Steffen 92c001f766 testing: Remove dynamic keys and certs from repository 2019-05-08 14:56:48 +02:00
Andreas Steffen 00f1d09729 testing: Build data.sql files for SQL test cases 2019-05-08 14:56:48 +02:00
Tobias Brunner 0c924641e6 pki: Add different output options for --keyid
Makes machine-processing these identifiers easier.
2019-05-08 14:56:48 +02:00
Tobias Brunner 05275905ef testing: Build CERT and IPSECKEY RRs for strongswan.org zone
Also copy generated keys to DNSSEC test cases.
2019-05-08 14:56:48 +02:00
Tobias Brunner 1e059c837b testing: Rename public keys in DNSSEC scenarios
We will generate PEM-encoded public keys with the script.
2019-05-08 14:56:48 +02:00
Tobias Brunner 326bb5f2c5 testing: Convert keys and certificates for all TKM scenarios 2019-05-08 14:56:48 +02:00
Tobias Brunner 0136852f19 testing: Disable leak detective in build-certs script 2019-05-08 14:56:48 +02:00
Andreas Steffen 8db01c6a3f testing: Script building fresh certificates 2019-05-08 14:56:48 +02:00
Tobias Brunner 3ee352a691 smp: Use correct printf specifier to print SPIs 2019-05-08 14:48:54 +02:00
Tobias Brunner e6e4113e9f fast: Use correct printf specifier to print content length 2019-05-08 14:48:54 +02:00
Tobias Brunner 12e64e5cf4 libimcv: Use proper printf specifier for unsigned issuer and responder IDs 2019-05-08 14:48:54 +02:00
Tobias Brunner 994cff3fac swima-collector: Use proper type for field precision 2019-05-08 14:48:54 +02:00
Tobias Brunner a4abb263c9 openssl: Fix build with OpenSSL 1.1.1 without compatibility layer
If OpenSSL is built with --api, defines for deprecated functions in
OpenSSL's header files are not visible anymore.

Fixes #3045.
2019-05-08 14:28:18 +02:00
Tobias Brunner 91dce6e876 travis: Build OpenSSL 1.1.1 without compatibility layer for older versions
Configuring 1.1.1 is not actually possible with 1.1.1b, not sure if
that's on purpose.
2019-05-08 14:27:19 +02:00
Tobias Brunner 885c05b0da travis: Make sure crypto plugins are actually loaded 2019-05-08 14:27:13 +02:00
Tobias Brunner ba817d2917 starter: Remove IPsec stack detection
Checking specifically for /proc/net/pfkey is not ideal as af_key will
eventually be removed in Linux kernels.  Support for KLIPS is long gone.
The detection also wasn't used for anything anymore (failures were just
ignored since the ports to BSD-based systems).  And modprobing doesn't seem
to be necessary either (charon-systemd doesn't do that, for instance).
2019-05-07 11:13:03 +02:00
Tobias Brunner c7a0b39bd6 vici: Add Python command wrappers to tarball
Fixes: e0f7da8644 ("vici: Extract command wrappers in Python bindings")
2019-05-06 15:51:05 +02:00
Tobias Brunner c88030807e pki: Fix memory leaks in --signcrl if signature scheme is not found
Fixes: dd4bd21c5a ("pki: Query private key for supported signature schemes")
2019-04-30 10:25:56 +02:00
Tobias Brunner bc0a01ff2e testing: Update documentation in headers of all updown scripts 2019-04-29 17:43:04 +02:00
Tobias Brunner b31bff125c swanctl: Move documentation of if_id_in/out after all mark-related options
Also fix a typo.
2019-04-29 17:38:28 +02:00
Tobias Brunner 02b348403a Fixed some typos, courtesy of codespell 2019-04-29 15:09:20 +02:00
Tobias Brunner c546c1ba71 nonce: Allow overriding the RNG quality used to generate nonces
Usually, changing this won't be necessary (actually, some plugins
specifically use different DRGBs for RNG_WEAK in order to separate
the public nonces from random data used for e.g. DH).
But for experts with special plugin configurations this might be
more flexible and avoids code changes.
2019-04-29 10:49:35 +02:00
SophieK 75d9dc40d4 unit-tests: Fix skipping of some ECDSA signature schemes
Closes strongswan/strongswan#137.
2019-04-29 09:56:49 +02:00
Tobias Brunner 23ff10551f NEWS: Added some news for 5.8.0 2019-04-26 18:54:58 +02:00
Tobias Brunner 6b952f6921 Merge branch 'update-vici-bindings'
Updates the command wrappers in all the bindings and simplifies calling
new commands (i.e. not yet wrapped) with the Python and Ruby bindings.

Fixes #3028.
2019-04-26 10:19:21 +02:00
Tobias Brunner eefa81120c vici: Update command wrappers in the Perl bindings
Note that load_key() now returns the complete response (to get the key
identifier).
2019-04-26 10:15:48 +02:00
Tobias Brunner 968866afc6 vici: Update some data in the Ruby gemspec 2019-04-26 10:15:48 +02:00
Tobias Brunner cc2ef8f8a7 vici: Some code style fixes in the Ruby bindings
As reported by rubocop (some issues were not fixed, in particular
related to class/method length metrics).
2019-04-26 10:15:43 +02:00
Tobias Brunner 1fef01af58 vici: Update command wrappers of the Ruby bindings
Also reorder them to match README.md.
2019-04-26 09:35:37 +02:00
Tobias Brunner 3b39444556 vici: Refactor how commands are called in the Ruby bindings
Also expose a method to call arbitrary commands, which allows calling not
yet wrapped commands. Exceptions are raised for all commands if the response
includes a negative "success" key (similar to how it's done in the Python
bindings).
2019-04-26 09:35:11 +02:00
Tobias Brunner 42fe703a95 vici: Fix formatting of return values for load-conn and load-authority commands 2019-04-26 09:35:10 +02:00
Tobias Brunner c5113c8105 vici: Add missing command wrappers for Python bindings
Also change some for which the return value became relevant.
2019-04-26 09:35:10 +02:00
Tobias Brunner e0f7da8644 vici: Extract command wrappers in Python bindings
This simplifies the interface and allows calling not yet wrapped
commands more easily.
2019-04-26 09:18:54 +02:00
Tobias Brunner 89c8ba525b eap-aka-3gpp2: Increase SQN after each authentication 2019-04-25 15:58:17 +02:00
Tobias Brunner f9e8f5a623 Merge branch 'childless'
Adds support for childless initiation of IKE_SAs (RFC 6023) e.g. to
force a separate DH exchange for all CHILD_SAs including the first one.

Also allows the initiation of only the IKE_SA via swanctl --initiate if
the peer supports this extension.

Closes strongswan/strongswan#99.
2019-04-25 15:32:02 +02:00
Tobias Brunner 012221a867 testing: Add swanctl/net2net-childless scenario 2019-04-25 15:23:19 +02:00
Tobias Brunner fbb0feeea9 unit-tests: Add unit tests for childless IKE_SA initiation 2019-04-25 15:23:19 +02:00
Tobias Brunner 1b19469c67 unit-tests: Make childless initiation configurable 2019-04-25 15:23:19 +02:00
Tobias Brunner e0678a8cc6 unit-tests: Add helper to create but not yet establish two IKE_SAs 2019-04-25 15:23:19 +02:00
Tobias Brunner 202fb101b8 unit-tests: Add macros to assert certain payloads are (not) in a message 2019-04-25 15:23:19 +02:00
Tobias Brunner c863960eb1 vici: Support initiation of IKE_SAs
The configuration must allow the initiation of a childless IKE_SA (which
is already the case with the default of 'accept').
2019-04-25 15:23:19 +02:00
Tobias Brunner 2889b77da2 vici: Make childless initiation of IKE_SAs configurable 2019-04-25 15:23:19 +02:00
Tobias Brunner 6b00d34b42 controller: Make child config optional for initiate() 2019-04-25 15:23:19 +02:00
Tobias Brunner ed521a7470 child-create: Initiate and handle childless IKE_SAs according to RFC 6023 2019-04-25 15:23:19 +02:00
Tobias Brunner 93104d0fe9 ike-init: Notify initiator if childless IKE_SAs are accepted 2019-04-25 14:31:39 +02:00
Tobias Brunner ddb083c164 ike-cfg: Add setting for childless IKE_SAs 2019-04-25 14:31:39 +02:00
Tobias Brunner 9486a2e5b0 ike-cfg: Pass arguments as struct 2019-04-25 14:31:33 +02:00
SophieK de77957eda proposal-substructure: Fix incorrect type for IKEv2 proposals
Luckily, the type is only used once when generating payloads and there it
doesn't matter because the encoding rules are the same.

Closes strongswan/strongswan#135.
2019-04-25 09:40:51 +02:00
Tobias Brunner 35392aa869 testing: Use renamed systemd unit
While the alias is available after enabling the unit, we don't
actually do that in our testing environment (adding a symlink manually
would work too, then again, why not just use the proper name?).
2019-04-24 13:57:48 +02:00
Tobias Brunner 1815c1de52 init: Rename systemd units
Use strongswan-starter for the legacy unit and simply strongswan for the
modern one (strongswan-swanctl is configured as alias, which should
cause the installation of symlinks when the service is enabled via
systemctl).
2019-04-24 13:57:48 +02:00
Tobias Brunner 20550480e1 Merge branch 'wolfssl'
Adds a plugin that uses wolfSSL for cryptographic operations.

Closes strongswan/strongswan#133.
2019-04-24 13:56:54 +02:00
Tobias Brunner d50bb81c7d travis: Run tests against wolfSSL
Check for wolfssl/options.h because if it isn't included, checking other
headers will trigger a warning about hardening the wolfSSL build, which
will cause the check to fail with -Werror.

If the file doesn't exist because user_settings.h is used, the check may
be skipped by configuring with `ac_cv_header_wolfssl_options_h=yes`.
2019-04-24 12:26:08 +02:00
Tobias Brunner d3329ee540 wolfssl: Fixes, code style changes and some refactorings
The main fixes are

 * the generation of fingerprints for RSA, ECDSA, and EdDSA
 * the encoding of ECDSA private keys
 * calculating p and q for RSA private keys
 * deriving the public key for raw Ed25519 private keys

Also, instead of numeric literals for buffer lengths ASN.1 related
constants are used.
2019-04-24 12:26:08 +02:00
Tobias Brunner 59be02519a unit-tests: Add tests for ECDSA fingerprints and encoding 2019-04-24 11:40:14 +02:00
Tobias Brunner 179aa72fdf unit-tests: Add tests for RSA fingerprints and encoding 2019-04-24 11:40:14 +02:00
Tobias Brunner a5a8f2bce2 chunk: Add helper to copy a chunk left-padded to a certain length 2019-04-24 11:40:14 +02:00
Sean Parkinson c92eade82c wolfssl: Add wolfSSL plugin for cryptographic implementations 2019-04-24 11:40:14 +02:00
Tobias Brunner 6a995a63f5 Merge branch 'android-fixes'
Fixes an upgrade issue and includes UTF8 support for EAP-MSCHAPv2.
2019-04-24 11:37:33 +02:00
Tobias Brunner 8da7dbe766 socket-default: Fix setting DSCP value on FreeBSD
Fixes #3030.
2019-04-23 11:49:04 +02:00
Tobias Brunner 8eafdc7f54 android: New release after fixing DB update and adding UTF-8 for EAP-MSCHAPv2 2019-04-16 15:58:31 +02:00
Tobias Brunner 199412a8ef android: Fix database upgrade from older versions 2019-04-16 15:08:23 +02:00
Tobias Brunner 4c0d74bc12 eap-mschapv2: Convert UTF-8-encoded passwords
Instead of assuming passwords are simply ASCII-encoded we now assume they are
provided UTF-8-encoded, which is quite likely nowadays.  The UTF-8 byte
sequences are not validated, however, only valid code points are encoded
as UTF-16LE.

Fixes #3014.
2019-04-16 11:26:49 +02:00
Tobias Brunner e601b89c00 testing: Use latest tkm-rpc and x509-ada versions
Includes fixes for larger signatures, critical extensions and
utf8Strings in DNs.
2019-04-15 18:31:12 +02:00
Tobias Brunner a3885b86e6 child-create: Make sure the mode selected by the responder is acceptable
Previously, the initiator would install the SA in transport mode if the
peer sent back the USE_TRANSPORT_MODE notify, even if that was not
requested originally.
2019-04-15 14:31:57 +02:00
Tobias Brunner 7b2236526c message: Enforce encryption except for INFORMATIONALs
The only messages that are generally sent encrypted but could be sent
unencrypted are INFORMATIONALs (currently only used for IKEv1 and ME
connectivity checks).  This should prevent issues if the keymat_t behaves
incorrectly and does not return an aead_t when it actually should.
2019-04-15 14:01:02 +02:00
Tobias Brunner cfac7305ab testing: Create new files in mounted strongSwan sources as regular user 2019-04-15 14:01:02 +02:00
Tobias Brunner 62d43ea694 ike-sa-manager: Extract IKE SPI labeling feature from charon-tkm
Might be useful for users of other daemons too. Note that compared to the
previous implementation in charon-tkm, the mask/label are applied in
network order.

Closes strongswan/strongswan#134.
2019-04-11 09:51:02 +02:00
Tobias Brunner f5ad3cf491 eap-aka-3gpp: Ignore test runner in repository 2019-04-04 18:40:22 +02:00
Tobias Brunner f36e375578 travis: Check for unignored build artifacts after the build 2019-04-04 18:40:22 +02:00
Tobias Brunner 5af924a650 ike-config: If we don't send a CFG_REQUEST, we don't expect a CFG_REPLY
Previously, attributes in an incorrectly sent CFG_REPLY would still be passed
to attribute handlers.  This does not prevent handlers from receiving
unrequested attributes if they requested at least one other.
2019-04-04 11:06:20 +02:00
Tobias Brunner b5ac0bd35f ike-config: Ignore unrequested virtual IP addresses
But forward them to handlers in case they requested them.
2019-04-04 11:06:20 +02:00
Tobias Brunner c334cd9f62 Merge branch 'xfrmi'
This adds support for XFRM interfaces, which replace VTI devices and are
available with 4.19+ Linux kernels.

IPsec SAs and policies are associated with such interfaces via interface
IDs that can be configured on the CHILD_SA-level (dynamic IDs may
optionally be allocated for each instance and even direction) or on the
IKE_SA-level (again, dynamic IDs may be optionally allocated per IKE_SA).
IDs on an IKE_SA are inherited by all CHILD_SAs created under it, unless
the child configuration overrides them.

The effect the interface ID has on policies is similar to that of marks,
i.e. they won't match packets unless they are routed via interface with
matching interface ID.  So it's possible to negotiate e.g. 0.0.0.0/0 as
traffic selector on both sides and then control the affected traffic via
routes/firewall.

It's possible to use separate interfaces for in- and outbound traffic (or
only use an interface in one direction and regular policies in the other).

Since iproute2 does not yet support XFRM interfaces, a small utility is
provided that allows creating and listing XFRM interfaces.

Interfaces may be created dynamically via updown/vici scripts or
statically (before or after establishing the SAs).  Routes must be added
manually as needed (the daemon will not install any routes for outbound
policies with an interface ID).

When moving XFRM interfaces to other network namespaces they retain access
to the SAs and policies created in the original namespace, which allows
providing IPsec tunnels for processes in other network namespaces without
giving them access to the IPsec keys or IKE credentials.

Fixes #2845.
2019-04-04 10:41:01 +02:00
Tobias Brunner 072de7c150 testing: Add scenario that uses IKE-specific interface IDs 2019-04-04 09:36:38 +02:00
Tobias Brunner 14e999c8d5 testing: Install python-daemon with strongSwan for use in updown scripts 2019-04-04 09:36:38 +02:00
Tobias Brunner 181801317b testing: Add /etc/resolv.conf when building strongSwan 2019-04-04 09:36:38 +02:00
Tobias Brunner ceca26c88e testing: Enable Python eggs in testing environment (i.e. vici's Python bindings) 2019-04-04 09:36:38 +02:00
Tobias Brunner ebe2bedebd configure: Fix package version for python packages for developer releases
According to PEP 440 the suffix for development releases is .devN and
not just devN.
2019-04-04 09:36:38 +02:00
Tobias Brunner 0396969a36 vici: Add support for interface ID configurable on IKE_SA 2019-04-04 09:36:38 +02:00
Tobias Brunner fafa76984d child-sa: Pass default interface ID inherited from IKE_SA
Also pass optional arguments as struct.
2019-04-04 09:36:38 +02:00
Tobias Brunner dec3c184a6 ike-sa: Add property for interface ID 2019-04-04 09:36:38 +02:00
Tobias Brunner 9347f72494 ipsec-types: Move allocation of unique interface IDs to helper function 2019-04-04 09:31:38 +02:00
Tobias Brunner c56b8c1a26 peer-cfg: Add property for interface ID 2019-04-04 09:31:38 +02:00
Tobias Brunner 28b702ad8b xfrmi: Use helpers for nested Netlink attributes 2019-04-04 09:31:38 +02:00
Tobias Brunner 2feba5aa22 kernel-netlink: Add helper functions for nested attributes 2019-04-04 09:31:38 +02:00
Tobias Brunner 760d7c9b4f testing: Add scenarios that use XFRM interfaces
The network namespace scenario requires a kernel patch in 4.19 and 4.20
kernels (the fix is included in 5.0 kernels).
2019-04-04 09:31:38 +02:00
Tobias Brunner 801a5d3133 kernel-netlink: Don't install routes for CHILD_SAs with interface ID 2019-04-04 09:31:38 +02:00
Tobias Brunner 5b2078ad09 testing: Enable XFRM interfaces and network namespaces in 4.19 and 5.0 kernel 2019-04-04 09:31:38 +02:00
Tobias Brunner d74ddd7893 xfrmi: Move to a separate directory to fix monolithic build 2019-04-04 09:31:38 +02:00
Tobias Brunner eef9236602 kernel-netlink: Add --list option to XFRM interfaces utility 2019-04-04 09:31:38 +02:00
Tobias Brunner 19b6d9a622 swanctl: Report interface IDs in --list-sas 2019-04-04 09:31:38 +02:00
Tobias Brunner aa841dbbfc vici: Report interface IDs 2019-04-04 09:31:38 +02:00
Tobias Brunner 3fa8c3e529 updown: Pass interface ID to updown script 2019-04-04 09:31:38 +02:00
Tobias Brunner 8ab336285a ike: Reuse interface ID during CHILD_SA rekeyings 2019-04-04 09:31:38 +02:00
Tobias Brunner a6014d99b7 child-sa: Configure interface ID on SAs and policies 2019-04-03 12:00:08 +02:00
Tobias Brunner 18ed5a07db vici: Make interface ID configurable 2019-04-03 12:00:08 +02:00
Tobias Brunner 07166ce25e ipsec-types: Add helper to parse interface ID 2019-04-03 12:00:08 +02:00
Tobias Brunner f99bd2a5a6 kernel-interface: Consider interface ID when allocating reqids 2019-04-03 12:00:08 +02:00
Tobias Brunner 72c96dbf9f child-cfg: Add property for interface ID 2019-04-03 12:00:08 +02:00
Tobias Brunner b32c3ce8fe kernel-netlink: Make interface ID configurable on SAs and policies 2019-04-03 12:00:08 +02:00
Tobias Brunner d1cd2a0541 include: Add XFRM attribute identifier for interface ID 2019-04-03 12:00:08 +02:00
Tobias Brunner 888593bb5b kernel-netlink: Add utility to create XFRM interfaces
This is mainly to see what's necessary to create them (in case we
integrate this into the daemon) and to experiment in our testing
environment without having to add a patched version of iproute2 (the
4.20.0 version in stretch-backports doesn't support XFRM interfaces
yet).  The regular version of iproute2 can be used for other operations
with these interfaces (delete, up, addrs etc.).
2019-04-03 12:00:08 +02:00
Tobias Brunner 735f9e6eb6 kernel-netlink: Calculate length of Netlink messages correctly
This is relevant when adding e.g. strings whose length are not aligned.
2019-04-03 12:00:08 +02:00
Tobias Brunner f43302dc10 Use Botan 2.10.0 for tests 2019-04-01 11:01:46 +02:00
Andreas Steffen 7b5eee65a0 Version bump to 5.8.0dr2 2019-03-30 17:11:34 +01:00
Andreas Steffen 195ee25dba testing: Updated expired certificates 2019-03-30 17:10:51 +01:00
Andreas Steffen d93532553c Testing: Removed tnc/tnccs-20-server-retry scenario 2019-03-29 17:04:43 +01:00
Andreas Steffen 6fcb3baae8 Corrected use of PB-TNC CRETRY and SRETRY batches
The PB-TNC finite state machine according to section 3.2 of RFC 5793
was not correctly implemented when sending either a CRETRY or SRETRY
batch. These batches can only be sent in the "Decided" state and a
CRETRY batch can immediately carry all messages usually transported
by a CDATA batch. strongSwan currently is not able to send a SRETRY
batch since full-duplex mode for PT-TLS isn't supported yet.
2019-03-29 17:04:43 +01:00
Tobias Brunner 35b82000f1 testing: Disable gcrypt plugin for swanctl
Sometimes swanctl hangs when initializing the plugin and it apparently
gathers entropy.
2019-03-28 18:16:56 +01:00
Tobias Brunner d49ad922c1 conf: Use actually configured path for strongswan.conf
References #2984.
2019-03-27 10:07:16 +01:00
Tobias Brunner 333adbc25b generator: Don't print any tainted values in DBG3 messages for U_INT_4
The bits not written to are marked tainted by valgrind, don't print
them in the debug messages.  Also use more specific printf-specifiers
for other values.
2019-03-27 10:00:09 +01:00
Sheena Mira-ato 69cbe2ca3f trap-manager: Wait for install to finish before uninstalling
There was a race condition between install() and uninstall()
where one thread was in the process of installing a trap
entry, and had destroyed the child_sa, while the other
thread was uninstalling the same trap entry and ended up
trying to destroy the already destroyed child_sa, resulting
in a segmentation fault in the destroy_entry() function.

The uninstall() function needs to wait until all the threads
are done with the installing before proceeding to uninstall
a trap entry.

Closes strongswan/strongswan#131.
2019-03-27 09:38:20 +01:00
Tobias Brunner 6ec9f68f32 sql: Handle %any better when looking up shared secrets
This can be the case for IKEv1 since 419ae9a20a ("ikev1: Default remote
identity to %any for PSK lookup if not configured").

Closes strongswan/strongswan#128.
2019-03-14 13:55:58 +01:00
Tobias Brunner 4f8c00e3ed Merge branch 'nm-ipv6'
Adds support for IPv6 to the NetworkManager backend and plugin.

Fixes #1143, #2586.
2019-03-14 13:46:33 +01:00
Tobias Brunner 398ea12cdb nm: Remove deprecated variables from autogen.sh 2019-03-14 13:42:08 +01:00
Tobias Brunner 05b7f1cbfe charon-nm: Add IPv6 support 2019-03-14 13:42:08 +01:00
Tobias Brunner 0af3a4f103 charon-nm: Handle IPv6 DNS server attributes 2019-03-14 13:42:08 +01:00
Tobias Brunner 0b117dc960 charon-nm: Set local address to %any so IPv6 may be used as outer address 2019-03-14 13:42:08 +01:00
Tobias Brunner 5538e29071 charon-nm: Request virtual IPv6 address and appropriate TS 2019-03-14 13:42:08 +01:00
Tobias Brunner 3567bf60ac nm: Enable IPv6 tab in NM connection dialog 2019-03-14 13:42:08 +01:00
Tobias Brunner 83674787d5 forecast: Only reinject packets that are marked or from the configured interface
This seems to avoid broadcast loops (i.e. processing and reinjecting the
same broadcast packet over and over again) as the packets we send via
AF_PACKET socket are neither marked nor from that interface.
2019-03-14 11:56:20 +01:00
Tobias Brunner 00a953d090 kernel-netlink: Use address labels instead of deprecation for IPv6 virtual IPs
In order to avoid that the kernel uses virtual tunnel IPs for traffic
over physical interfaces we previously deprecated the virtual IP.  While
this is working it is not ideal.  This patch adds address labels for
virtual IPs, which should force the kernel to avoid such addresses to
reach any destination unless there is an explicit route that uses it as
source address.
2019-03-14 11:33:59 +01:00
Tobias Brunner b4a23e3cea Merge branch 'android-updates'
Adds a copy function for VPN profiles and an option to set custom DNS
servers.
2019-03-14 10:56:07 +01:00
Andreas Steffen fa1f4d199e testing: Prolonged Duck end entity certificate 2019-03-13 19:02:42 +01:00
Andreas Steffen 08a7326181 Version bump to 5.8.0dr1 2019-03-13 19:02:42 +01:00
Tobias Brunner 023d47a08a child-create: Add missing space in DH retry log message 2019-03-13 10:30:49 +01:00
Tobias Brunner 7b9a8b3f75 android: New release after adding copy function and DNS server config 2019-03-08 17:08:11 +01:00
Tobias Brunner 347665420b Merge branch 'openssl-chapoly'
Adds support for ChaCha20-Poly1305 via OpenSSL.

Fixes #2946.
2019-03-08 15:56:01 +01:00
Tobias Brunner a21710d380 openssl: Add support for ChaCha20-Poly1305
It's available since OpenSSL 1.1.0.
2019-03-08 15:55:52 +01:00
Tobias Brunner 8fc6b2d0e0 openssl: Generalize the GCM implementation a bit
This will allow us to use the implementation also for other algorithms.
2019-03-08 15:55:52 +01:00
Tobias Brunner 451c2e7d58 Merge branch 'ikev1-redundant-updown'
Avoids calling updown script for redundant CHILD_SAs after IKEv1 rekey
collisions.

Fixes #2902.
2019-03-08 15:52:39 +01:00
Tobias Brunner 7f5cef5d1c ikev1: Don't trigger updown event and close action for redundant CHILD_SAs 2019-03-08 15:49:34 +01:00
Tobias Brunner bbc3d2a016 task-manager-v1: Add utility function to check if CHILD_SA is redundant 2019-03-08 15:49:34 +01:00
Tobias Brunner 090e2cf54c vici: Correctly parse inactivity timeout as uint32_t
Using parse_time() directly actually overwrites the next member in the
child_cfg_create_t struct, which is start_action, which can cause
incorrect configs if inactivity is parsed after start_action.

Fixes #2954.
2019-03-08 15:47:25 +01:00
Tobias Brunner 4ad397ef79 swanctl: Fix documentation of default value of hostaccess 2019-03-07 18:49:29 +01:00
Tobias Brunner 2ef473be15 android: Use helper to parse IP addresses where appropriate 2019-03-05 19:02:05 +01:00
Tobias Brunner 7028e9d31e android: Add helper to parse IP addresses from strings
Using InetAddress.fromName() is not ideal as it might result in a DNS
resolution, which causes an exception if we do it from the main thread.
2019-03-05 18:56:09 +01:00
Tobias Brunner 8e7ad9ace8 android: Make DNS servers configurable in the GUI 2019-03-05 18:17:56 +01:00
Tobias Brunner 1a39c3d98d android: Import DNS servers 2019-03-05 17:45:48 +01:00
Tobias Brunner dd5de792cf android: Use configured custom DNS servers 2019-03-05 17:36:09 +01:00
Tobias Brunner dda8b891dc android: Add properties for DNS servers 2019-03-05 16:51:21 +01:00
Tobias Brunner 94cb3b4ddd android: Add menu option to copy a profile
Some users requests something like that to use different server IPs.
Interestingly, it's actually also possible to configure multiple
hostnames/IPs, separated by commas, as server address in the profile, which
are then tried one after another.

It's also useful when testing stuff to quickly compare the behavior with
some setting changed between two otherwise identical profiles.
2019-03-05 16:40:20 +01:00
Tobias Brunner da4e08909e android: Remove buildToolsVersion
Finally a default is configured and we don't have to update this
constantly.
2019-03-05 15:32:33 +01:00
Tobias Brunner 20fdb2d42b android: Update Gradle plugin 2019-03-05 15:32:33 +01:00
Carl Smith 8e31d65730 child-sa: Remove temporary DROP policy using same parameters as when added
A temporary DROP policy is added to avoid traffic leak
while the SA is being updated. It is added with
manual_prio set but when the temporary policy is removed
it is removed with manual_prio parameter set to 0.
The call to del_policies_outbound does not match the original
policy and we end up with an ever increasing refcount.

If we try to manually remove the policy, it is not removed
due to the positive refcount. Then new SA requests fail with
"unable to install policy out for reqid 1618,
the same policy for reqid 1528 exists"

Fixes: 35ef1b032d ("child-sa: Install drop policies while updating IPsec SAs and policies")
Closes strongswan/strongswan#129.
2019-03-04 09:38:35 +01:00
Tobias Brunner 023cf17a90 load-tester: Update expired CA certificate
Closes strongswan/strongswan#126.
2019-02-28 17:31:43 +01:00
Tobias Brunner 8cafef2e10 travis: OpenSSL version bump 2019-02-26 16:03:28 +01:00
Tobias Brunner d091703a9e agent: Don't keep socket to ssh/gpg-agent open
Instead, create a socket when necessary.  Apparently, it can prevent
the agent from getting terminated (e.g. during system shutdown) if e.g.
charon-nm is still running with an open connection to the agent.
2019-02-20 10:43:19 +01:00
Shmulik Ladkani 71b22c250f vici: Fix wrong argument order for terminate_ike() in clear_start_action()
In 7b7290977 ("controller: Add option to force destruction of an IKE_SA")
the 'force' option was added as 3rd parameter to controller_t::terminate_ike.

However in vici's 'clear_start_action', the argument was incorrectly
placed as the 2nd parameter - constantly sending 0 (FALSE) as the
'unique_id' to terminate, rendering calls to 'handle_start_actions'
having undo=TRUE being unable to terminate the relevant conn.

For example, this is log of such a bogus 'unload-conn':

  strongswan[498]: 13[CFG] vici client 96 requests: unload-conn
  strongswan[498]: 13[CFG] closing IKE_SA #9
  strongswan[498]: 13[IKE] unable to terminate IKE_SA: ID 0 not found
  strongswan[498]: 09[CFG] vici client 96 disconnected

here, the unloaded conn's IKE id was 9, alas 'terminate_ike_execute'
reports failure to terminate "ID 0".

Fix by passing 'id, FALSE' arguments in the correct order.

Fixes: 7b7290977 ("controller: Add option to force destruction of an IKE_SA")
Signed-off-by: Shmulik Ladkani <shmulik@metanetworks.com>
Closes strongswan/strongswan#127.
2019-02-19 17:00:11 +01:00
Tobias Brunner 0f193be23d libimcv: Add Debian 9.7 to IMV database 2019-01-30 12:26:19 +01:00
Tobias Brunner c7f579fa17 kernel-netlink: Fix compilation on old kernels (< 2.6.39) 2019-01-24 10:55:24 +01:00
krinfels 7533cedb9a libtpmtss: Read RSA public key exponent instead of assuming its value
Up to now it was assumed that the RSA public key exponent is equal to 2^16+1.
Although this is probably true in most if not all cases, it is not correct
according to the TPM 2.0 specification.

This patch fixes that by reading the exponent from the structure returned
by TPM2_ReadPublic.

Closes strongswan/strongswan#121.
2019-01-21 11:52:08 +01:00
Tobias Brunner 220b0cb29c unit-tests: Verify that E and emailAddress result in the same ID 2019-01-18 11:15:16 +01:00
Tobias Brunner 6639288b1a Use Botan 2.9.0 for tests 2019-01-16 17:11:46 +01:00
Andreas Steffen eb16352232 Version bump to 5.7.2 2018-12-27 12:11:49 +01:00
Tobias Brunner e4a3ef2e4d Use https:// for URLs in documents
Also adds contribution guidelines (for Github) with links to the wiki.
2018-12-20 16:13:02 +01:00
Andreas Steffen 023b9c0edc Version bump to 5.7.2rc1 2018-12-19 13:21:48 +01:00
Tobias Brunner d1e58e11f7 NEWS: More news for 5.7.2 2018-12-18 14:48:18 +01:00
Tobias Brunner db82c0f594 Fixed some typos, courtesy of codespell 2018-12-18 11:14:19 +01:00
Tobias Brunner 0329645182 Merge branch 'radius-accounting-unclaimed'
Adds all IPs to RADIUS Accounting-Stop messages even those not claimed by
a client.  For instance, if the connection fails with FAILED_CP_REQUIRED,
adding the unclaimed addresses allows the RADIUS server to release the
leases early.

Fixes #2856.
2018-12-18 10:34:17 +01:00
Tobias Brunner 61efac6512 eap-radius: Don't clear unclaimed IPs early if accounting is enabled 2018-12-18 10:28:51 +01:00
Tobias Brunner 2de6d9d8d3 eap-radius: Add unclaimed IPs to Accounting-Stop messages
Some RADIUS servers may use these to release them early.
2018-12-18 10:28:51 +01:00
Tobias Brunner 0407d72acf eap-radius: Add method to explicitly clear unclaimed IPs
Instead of just enumerating them, removing and then destroying the entry
avoids having to keep the mutex locked.
2018-12-18 10:28:51 +01:00
Tobias Brunner 533efa91e2 eap-radius: Add RADIUS Accounting session ID to Access-Request messages
This allows e.g. associating database entries for IP leases and
accounting directly from the start.

Fixes #2853.
2018-12-17 09:46:09 +01:00
Tobias Brunner 501bd53a6c swanctl: Make credential directories relative to swanctl.conf
All directories are now considered relative to the loaded swanctl.conf
file, in particular, when loading it from a custom location via --file
argument.  The base directory, which is used if no custom location for
swanctl.conf is specified, is now also configurable at runtime via
SWANCTL_DIR environment variable.

Closes strongswan/strongswan#120.
2018-12-14 09:11:14 +01:00
Tobias Brunner 322daff844 openssl: Make sure to release the functional ENGINE reference
The functional reference created by ENGINE_init() was never released,
only the structural one created by ENGINE_by_id().  The functional
reference includes an implicit structural reference, which is also
released by ENGINE_finish().

Closes strongswan/strongswan#119.
2018-12-12 12:00:29 +01:00
Andreas Steffen 7cf3f97e56 Version bump to 5.7.2dr4 2018-12-09 19:53:31 +01:00
Andreas Steffen 77e4a420c3 libimcv: Updated openssl version in IMV database 2018-12-09 19:53:05 +01:00
Andreas Steffen 030de21b7b testing: Migrated ikev2 scenarios to swanctl 2018-12-09 13:16:41 +01:00
Tobias Brunner be1c7e3815 Merge branch 'ikev1-adopt-child-tasks'
Makes sure to adopt active and queued Quick Mode tasks if the peer
reauthenticates the IKE_SA while creating lots of CHILD_SAs.

Closes strongswan/strongswan#117.
2018-12-07 10:40:08 +01:00
Tobias Brunner 5e97a5e64b ike: Implement adopt_child_tasks() outside task managers 2018-12-07 10:32:12 +01:00
Tobias Brunner f536f6477d adopt-children-job: Adopt child-creating tasks from the old IKE_SA 2018-12-07 10:32:12 +01:00
Tobias Brunner b71604011a ike-sa: Expose task_manager_t::remove_task() 2018-12-07 10:32:12 +01:00
Tobias Brunner 4505e3c0df task-manager: Add method to remove a task from a queue 2018-12-07 10:32:12 +01:00
Tobias Brunner 44558547af ike-sa-manager: Migrate child creating tasks during IKEv1 reauth 2018-12-07 10:32:12 +01:00
Tobias Brunner 00c889f4ec ike-sa: Expose task_manager_t::adopt_child_tasks() 2018-12-07 10:32:12 +01:00
Tobias Brunner 157150ca91 charon-cmd: Register atexit() handler for libcharon_deinit twice
Similar to cbe9e575ee, this avoids issues with libraries that are
pulled in via plugins and register their own atexit() handlers.
2018-12-07 10:30:08 +01:00
Tobias Brunner 10f8834bf9 ikev2: Don't recreate IKE_SA if deletion fails after make-before-break reauth
Fixes: 7457143072 ("During reauthentication reestablish IKE_SA even if deleting the old one fails.")
Fixes #2847.
2018-12-07 10:28:21 +01:00
Tobias Brunner 01f462f0d3 ikev2: Ignore COOKIE notifies we already received
This could be due to a delayed response to an IKE_SA_INIT retransmit.

Fixes #2837.
2018-12-07 10:25:30 +01:00
Thomas Egerer eed20c21d3 ha: Add auth method for HA IKEv1 key derivation
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-12-07 10:17:56 +01:00
Tobias Brunner 13f92f649e Merge branch 'ha-pool-offset'
Ensure an even distribution of a pool's addresses among all segments.

Fixes #2828.
2018-12-07 10:16:21 +01:00
Tobias Brunner 5dbb826da5 ha: Divide virtual IPs evenly among all segments 2018-12-07 10:15:40 +01:00
Tobias Brunner 16a898f5f7 ha: Add getter for the number of segments 2018-12-07 10:15:05 +01:00
Tobias Brunner a8f91cd466 ha: Improve distribution of pool addresses over segments
This is particularly important for higher number of segments, but even
with small numbers there is a significant difference.  For instance,
with 4 segments the fourth segment had no IPs assigned with the old
code, no matter how large the pool, because none of the eight bits used
for the segment check hashed/mapped to it.
2018-12-07 10:12:14 +01:00
Tobias Brunner 872b9b3e8d kernel-pfkey: Read reqid directly from acquire if possible
Upcoming versions of FreeBSD will include an SADB_X_EXT_SA2 extension in
acquires that contains the reqid set on the matching policy.  This allows
handling acquires even when no policies are installed (e.g. to work with
FreeBSD's implementation of VTI interfaces, which manage policies
themselves).
2018-12-03 12:01:43 +01:00
Tobias Brunner c99d3b6f63 ikev2: Only set STAT_INBOUND for valid and expected messages 2018-12-03 12:00:24 +01:00
Tobias Brunner 631abb6810 scepclient: Don't use a block-scope buffer for the default DN
The correct behavior will depend on the compiler.

Fixes #2843.
2018-12-03 11:54:05 +01:00
Tobias Brunner 686a1b971d Merge branch 'openssl-25519/448'
Adds support for X25519/448 and Ed25519/448 via OpenSSL 1.1.1.
2018-11-30 16:48:02 +01:00
Tobias Brunner a4e698b6f9 travis: Don't run sonarcloud in forked repositories 2018-11-30 16:03:10 +01:00
Tobias Brunner 2a58030b78 travis: Use the latest OpenSSL release for unit tests
But also run the unit tests against the 1.0 version installed with
Ubuntu 16.04.
2018-11-30 16:03:10 +01:00
Tobias Brunner 7195914daf travis: Only use GCC for crypto plugin tests
They are already build-tested with Clang via "all" and others.
2018-11-30 15:57:35 +01:00
Tobias Brunner 25e62f01ea unit-tests: Add test suite for Ed448
Same issue with signature malleability as with Ed25519 and apparently
OpenSSL doesn't even explicitly verify that the most significant 10 bits
are all zero.
2018-11-30 15:57:35 +01:00
Tobias Brunner 8d7bf5b039 unit-tests: Add fingerprint test vectors for Ed25519 2018-11-30 15:47:21 +01:00
Tobias Brunner 2571898d32 curve25519: Prevent Ed25519 signature malleability
As per RFC 8032, section 5.1.7 (and section 8.4) we have to make sure s, which
is the scalar in the second half of the signature value, is smaller than L.
Without that check, L can be added to most signatures at least once to create
another valid signature for the same public key and message.

This could be problematic if, for instance, a blacklist is based on hashes
of certificates.  A new certificate could be created with a different
signature (without knowing the signature key) by simply adding L to s.

Currently, both OpenSSL 1.1.1 and Botan 2.8.0 are vulnerable to this, which is
why the unit test currently only warns about it.
2018-11-30 15:35:01 +01:00
Tobias Brunner 69756c0bff openssl: Use separate DRBG for RNG_STRONG and RNG_TRUE with OpenSSL 1.1.1
OpenSSL 1.1.1 introduces DRGBs and provides two sources (same security
profile etc. but separate internal state), which allows us to use one for
RNG_WEAK (e.g. for nonces that are directly publicly visible) and the other
for stronger random data like keys.
2018-11-30 15:35:01 +01:00
Tobias Brunner 6fc90cea74 leak-detective: Whitelist functions added in OpenSSL 1.1.1 2018-11-30 15:35:01 +01:00
Tobias Brunner cbf07ab5b0 openssl: Add support for Ed25519/Ed448 2018-11-30 15:35:01 +01:00
Tobias Brunner d222699c78 dh-speed: Add curve448 keyword 2018-11-30 14:54:33 +01:00
Tobias Brunner 9dfbe9442b test-vectors: Add vector for X448 2018-11-30 14:54:33 +01:00
Tobias Brunner 57cb4c8d2c openssl: Add support for X25519 and X448
While X25519 was already added with 1.1.0a, its use would be a lot more
complicated, as the helpers like EVP_PKEY_new_raw_public_key() were only
added in 1.1.1, which also added X448.
2018-11-30 14:53:38 +01:00
Tobias Brunner 2421b7ddb8 bypass-lan: Compare interface for unchanged policies
In case a subnet is moved from one interface to another the policies can
remain as is but the route has to change.  This currently doesn't happen
automatically and there is no option to update the policy or route so
removing and reinstalling the policies is the only option.

Fixes #2820.
2018-11-22 11:38:55 +01:00
Tobias Brunner ecba84a06b child-delete: Don't send delete for expired CHILD_SAs that were already rekeyed
The peer might not have seen the CREATE_CHILD_SA response yet, receiving a
DELETE for the SA could then trigger it to abort the rekeying, causing
the deletion of the newly established SA (it can't know whether the
DELETE was sent due to an expire or because the user manually deleted
it).  We just treat this SA as if we received a DELETE for it.  This is
not an ideal situation anyway, as it causes some traffic to get dropped,
so it should usually be avoided by setting appropriate soft and hard limits.

References #2815.
2018-11-22 11:31:53 +01:00
Tobias Brunner a9b9450c54 kernel-netlink: Update SA selector if it contains changed IP address(es) 2018-11-22 11:22:58 +01:00
Tobias Brunner 97c4551ec8 Avoid inclusion of unistd.h in generated lexers
Because the file is not available on all platforms the inclusion comes
after the user options in order to disable including it.  But that means
the inclusion also follows after the defined scanner states, which are
generated as simple #defines to numbers.  If the included unistd.h e.g.
uses variables in function definitions with the same names this could
result in compilation errors.

Interactive mode has to be disabled too as it relies on isatty() from
unistd.h.  Since we don't use the scanners interactively, this is not a
problem and might even make the scanners a bit faster.

Fixes #2806.
2018-11-22 11:17:35 +01:00
Tobias Brunner 85431bf2e7 Merge branch 'travis-xenial'
Run builds on Travis on Ubuntu Xenial (16.04) images.
2018-11-21 14:40:00 +01:00
Tobias Brunner 8a4f110243 travis: Use ccache for MinGW builds 2018-11-21 14:37:56 +01:00
Tobias Brunner b76a1cf284 travis: Use manual matrix expansion to improve overall run time
The sonarcloud build runs a long time now (the win32/64 builds are also
a lot slower on xenial), which increases the overall time a build takes
because we can't run these before regular matrix jobs run.  So we do a
manual matrix expansion to control the order of jobs (slower first).
This also removes the TEST=default build with GCC as that's basically
what TEST=dist does (except for forcing the printf implementation)
2018-11-21 14:37:56 +01:00
Tobias Brunner fb4103051e travis: Simplify explicitly included jobs
The first value for the compiler array (gcc) is inherited.
2018-11-21 14:37:56 +01:00
Tobias Brunner ff97733163 travis: Start with sonarcloud job first
Also change the condition, the environment variable is apparently still
around when the decision to run it is made.
2018-11-21 14:37:56 +01:00
Tobias Brunner 187ab29849 travis: Use two threads to analyze C code with SonarQube
On Nov 12, the scanner was updated and now takes a lot more time (about
3 times as much).  Using two threads reduces it a bit (by about 25%).
Using even more threads doesn't help or even increases the time again.
2018-11-21 14:37:56 +01:00
Tobias Brunner d8d756e306 Fix make distcheck if systemd is installed
The automatically determined path for systemd units is an absolute system
path that doesn't respect $(prefix).  That's a problem for make distcheck,
which is usually ran as regular user and it's not expected to have any
impact on the system (it does a local install in a subdir).  To avoid
these issues we override the configure flags used by make distcheck and
set the path to one relative to the specified prefix.
2018-11-21 14:36:38 +01:00
Tobias Brunner cab4b3a341 Doxyfile: Remove obsolete XML options 2018-11-21 14:36:38 +01:00
Tobias Brunner fa4599d160 gcrypt: Don't use thread callbacks for newer versions of libgcrypt
According to gcrypt.h these callbacks are not used anymore since
version 1.6 and with clang these actually cause deprecation warnings
that let the build on travis (-Werror) fail.
2018-11-21 14:36:38 +01:00
Tobias Brunner 248f34918f travis: Don't build TSS2 as root
This might prevent ccache from overwriting files in later builds.
2018-11-21 14:36:38 +01:00
Tobias Brunner 75853dbe4b travis: Add sleep in after_failure
This makes sure we get the complete output, which isn't always the case
otherwise (there is an unresolved bug for this in the Travis issue tracker).
2018-11-21 14:36:38 +01:00
Tobias Brunner cfdab423fb travis: Build on Ubuntu Xenial (16.04) 2018-11-21 14:36:38 +01:00
Tobias Brunner 9820e3dd59 Merge branch 'testing-stretch'
Use Debian stretch as base image for the testing environment.
2018-11-21 14:34:57 +01:00
Tobias Brunner 48afa6b783 testing: Switch to Debian stretch base images 2018-11-21 14:34:16 +01:00
Tobias Brunner 7511a6fd9c testing: Install a package via apt-get to get a second SWIMA software event
This installs tmux and its two dependencies libevent-2.0-5 and libutempter0.
For the tnc/tnccs-20-ev-pt-tls test scenario older, apparently replaced
versions of these packages are entered to the collector.db database, so that
dummy SWID tags for these packages can be requested via SWIMA.
2018-11-21 14:33:29 +01:00
Tobias Brunner b217bdf75f testing: Add additional memory to alice
strongTNC seems to require a lot more memory than we assign by default,
not sure this increase is enough.
2018-11-21 14:32:25 +01:00
Tobias Brunner b3d9ada385 testing: Generate some UTF-8 locales 2018-11-21 14:32:25 +01:00
Tobias Brunner 1741d1ac07 testing: Disable systemd's NTP service
This produces a lot of useless traffic as no NTP servers are reachable (or
even resolvable via winnetou).
2018-11-21 14:32:25 +01:00
Tobias Brunner c7a74fd3e5 testing: Allow enabling only timestamps without verbose command output
-t enables only the timestamps, -v additionally logs command output
(includes -t).
2018-11-21 14:32:25 +01:00
Tobias Brunner 2132031d0e testing: Show config files of FreeRADIUS 3.0 in test results 2018-11-21 14:32:25 +01:00
Tobias Brunner 231828f810 testing: Config changes for FreeRADIUS 3.0
Also includes some changes for jessie's version of FreeRADIUS 2 (was
previously a custom version).

Besides the move to a subdir the config files were adapted for 3.0.

The rlm_sim_files module was removed with FreeRADIUS 3 and Debian's
package of FreeRADIUS 2 does not ship it, so we now replicate it using
the files module (via users file, which is actually a symlink to
mods-config/files/authorize in the default installation of FreeRADIUS 3).
Another approach was tried using rlm_passwd, however, that module does
not read binary/hex data, only printable strings, which would require
changing the triplets.
For 2.x a hack in the site config is necessary to make the attributes
available to the EAP-SIM module.
2018-11-21 14:32:25 +01:00
Tobias Brunner a8112cc174 testing: Use freeradius instead of the removed radiusd to start FreeRADIUS 2018-11-21 14:32:25 +01:00
Tobias Brunner 2e39b1db0a testing: Remove unused/inexistent DSA key from sshd config 2018-11-21 14:32:25 +01:00
Tobias Brunner 30e68c80d2 testing: Only run DHCPv4 by setting an listening interface explicitly
Debian stretch's init script for isc-dhcp-server uses the INTERFACESv4|6
variables to decide whether to start the v4 and/or v6 DHCP server.

If they are not empty, the daemon is started for the respective version,
however, if both are empty (the default), to listen on all interfaces, the
daemon is started for both versions.  The latter would require a subnet
config for IPv6 as the daemon otherwise exits, letting the init script fail,
while keeping the successfully started v4 version running, which, in turn,
can't be stopped anymore with the init script because it thinks the daemon
is not running.

So it's not possible with this init script to start DHCPv4 on all interfaces
without having to configure and run DHCPv6 also.
2018-11-21 14:32:25 +01:00
Tobias Brunner c2742f9bf5 testing: Remove unused dhcpd config on moon 2018-11-21 14:32:25 +01:00
Tobias Brunner 9083ccd05c testing: Accept ping6 output with IP address after hostname
Newer versions of ping6 add the IP address after the FQDN in the output.
2018-11-21 14:32:25 +01:00
Tobias Brunner f9a42f828a testing: Install traceroute utility in base image
It seems this was previously installed automatically.
2018-11-21 14:32:24 +01:00
Tobias Brunner 99f6457e53 testing: Only attempt to copy patches if there are any 2018-11-21 14:32:24 +01:00
Tobias Brunner 2fbe44bef3 testing: Remove TNC@FHH dependencies and scenarios that rely on them
While we could continue to use FreeRADIUS 2.x that branch is officially EOL.
So instead of investing time and effort in updating/migrating the patches to
FreeRADIUS 3.x (the module changed quite significantly as it relies solely on
the naeap library in that release), for a protocol that is superseded anyway,
we just remove these scenarios and the dependencies.  Actually, the
complete rlm_eap_tnc module will be removed with FreeRADIUS 4.0.
2018-11-21 14:32:24 +01:00
Tobias Brunner babb979e42 libimcv: Add Debian 9.5 and 9.6 to IMV database 2018-11-21 14:32:24 +01:00
Tobias Brunner d3a59022dd testing: Remove Apache config hacks for Debian wheezy 2018-11-21 14:32:24 +01:00
Tobias Brunner af6e26ec08 testing: Support build with Debian stretch base image
Remove support for wheezy.
2018-11-21 14:32:24 +01:00
Tobias Brunner cbe9e575ee charon-systemd: Don't use atexit() to deinitialize the daemon
This is because OpenSSL 1.1 started to use atexit()-handlers of its own
to clean up.  Since the plugin is loaded and initialized after libcharon,
OpenSSL's cleanup functions ran before the daemon was properly
deinitialized (i.e. worker threads were still running and OpenSSL might
still be used during the deinit).  So several of OpenSSL's internal
structures were already destroyed when libcharon_deinit() was eventually
called via our own atexit()-handler.

The observed behavior was that the daemon couldn't be terminated properly
anymore for some test scenarios (only three TNC scenarios were affected
actually).  When the daemon tried to send the DELETE for the established
IKE_SA during its termination it got stuck in OpenSSL's RNG_WEAK
implementation (used to allocate random padding), which apparently tries
to acquire an rwlock that was already destroyed.  The main thread then
just busy-waited indefinitely on the lock, i.e. until systemd killed
it eventually after a rather long timeout.

We'll probably have to apply similar changes to other apps/scripts that
load plugins and currently use atexit() to clean up.  Although some
scripts (e.g. dh_speed or hash_burn) are not affected because they
register the deinitialization after loading the plugins.
2018-11-21 14:31:49 +01:00
Afschin Hormozdiary 2e49bbcc49 ikev1: Ensure DPD_ACK is sent in time
If a lot of QUICK_MODE tasks are queued and the other side
sends a DPD request, there is a good chance for timeouts.

Observed this in cases where other side is quite slow in responding
QUICK_MODE requests (e.g. Cisco ASA v8.x) and about 100 CHILD_SAs
are to be spawned.

Closes strongswan/strongswan#115.
2018-11-20 10:24:48 +01:00
Andreas Steffen caa4f37110 pt-tls-client: Fixed man page 2018-11-20 09:53:18 +01:00
Tobias Brunner 01f50bdddc conftest: Sanity check for proposal number modifier 2018-11-12 17:36:22 +01:00
Tobias Brunner f92174dcd1 botan: Initialize p and q before calling calculate_pq() 2018-11-12 17:36:22 +01:00
Tobias Brunner de80946f6a Remove useless break statements 2018-11-12 17:36:22 +01:00
Andreas Steffen ff3f09af45 Version bump to 5.7.2dr3 2018-11-12 16:24:53 +01:00
Andreas Steffen b5747192bd testing: Added botan/net2net-pkcs12 scenario 2018-11-12 13:51:01 +01:00
Andreas Steffen 440e6a03c1 testing: Migrated openssl-ikev2/net2net-pkcs12 scenario to swanctl 2018-11-12 13:46:16 +01:00
Andreas Steffen 836e870912 testing: Removed openssl-ikev2/rw-eap-tls-only scenario 2018-11-12 12:41:11 +01:00
Andreas Steffen 280cf56411 testing: Removed openssl-ikev2/net2net-pgp-v3 scenario 2018-11-12 12:35:37 +01:00
Andreas Steffen e259ff3979 testing: migrated openssl-ikev2/critical-extension to swanctl 2018-11-12 11:50:05 +01:00
Andreas Steffen 97493cbe17 testing: Migrated openssl/rw-cert scenario to swanctl 2018-11-09 21:45:12 +01:00
Andreas Steffen 6617341390 testing: Migrated openssl-ikev2/ecdsa-pkcs8 scenario to swanctl 2018-11-09 16:38:33 +01:00
Andreas Steffen 6ea531d926 testing: Migrated openssl brainpool scenarios to swanctl 2018-11-09 15:00:26 +01:00
Andreas Steffen 1cab8ed5f8 testing: Migrated openssl alg-ecp-low scenarios to swanctl 2018-11-09 12:42:14 +01:00
Andreas Steffen 21735750df testing: Migrated openssl alg-ecp-high scenarios 2018-11-09 11:52:59 +01:00
Andreas Steffen a4c085978c testing: Migrated openssl alg-camellia scenarios to swanctl 2018-11-09 10:02:26 +01:00
Andreas Steffen 873a6ab0ef testing: Removed openssl alg-aes-gcm and alg-blowfish scenarios 2018-11-08 21:28:19 +01:00
Andreas Steffen fcaa081825 testing: Removed openssl suite B scenarios 2018-11-08 21:23:10 +01:00
Andreas Steffen 99b66151fd testing: Moved openssl ecdsa-certs scenarios to swanctl 2018-11-08 21:16:32 +01:00
Tobias Brunner 8eea28063d leak-detective: Use hashtable to cache ignored/whitelisted backtraces
Checking for whitelisted functions in every backtrace is not very
efficient.  And because OpenSSL 1.1 does no proper cleanup anymore until
the process is terminated there are now a lot more "leaks" to ignore.
For instance, in the openssl-ikev2/rw-cert scenario, just starting and
stopping the daemon (test vectors are checked) now causes 3594 whitelisted
leaks compared to the 849 before.  This prolonged the shutdown of the
daemon on each guest in every scenario, amounting to multiple seconds of
additional runtime for every affected scenario.  But even with this
patch there is still some overhead, compared to running the scenarios on
jessie.
2018-11-06 12:27:16 +01:00
Tobias Brunner 0f7055b22c leak-detective: Whitelist additional OpenSSL functions used by libcurl 2018-11-06 12:27:01 +01:00
Tobias Brunner b959532f68 scripts: Include botan in dh_speed.sh and pubkey_speed.sh
Also, using sudo is not necessary in dh_speed.sh.
2018-10-31 15:50:36 +01:00
Tobias Brunner 8b4c2a1d8e openssl: Fix some const issues with OpenSSL 1.1.0 2018-10-31 15:50:36 +01:00
Tobias Brunner fd3947d9e5 openssl: Don't use functions deprecated with OpenSSL 1.1.0 2018-10-31 15:50:36 +01:00
Andreas Steffen 0e80eb235d Version bump to 5.7.2dr2 2018-10-31 14:22:03 +01:00
Andreas Steffen 9be6dee6a4 botan: SHA-3 support 2018-10-30 16:06:15 +01:00
Tobias Brunner ae271810dc Use Botan 2.8.0 for tests 2018-10-30 15:08:31 +01:00
Tobias Brunner a29f70e4fb testing: Use AES-GCM for SSH connections
RC4, which was previously used for performance reasons, is not supported
anymore with newer versions of SSH (stretch still supports it, but it
requires explicit configuration on the guests when they act as clients
too - the version in Ubuntu 18.04 apparently doesn't support it anymore
at all).

AES-GCM should actually be faster (at least for larger amounts of data and
in particular with hardware acceleration).
2018-10-30 15:06:57 +01:00
Tobias Brunner 67fd36e884 testing: Avoid unnecessary rebuilds of components built from Git repos
Installing apparently changes the timestamp on the repo dir triggering make
to checkout and build the whole thing again.
2018-10-30 15:06:47 +01:00
Tobias Brunner 3a4372c1eb testing: Disable predictable network interface names assigned by systemd/udev 2018-10-30 15:06:33 +01:00
Tobias Brunner 3fbeeef908 testing: Remove unused custom OIDs from openssl.cnf files
ClientAuthentication is known in OpenSSL 1.1 and the redefinition, therefore,
causes an error.  These two OIDs are not used anyway in these config
files.
2018-10-30 15:03:34 +01:00
Andreas Steffen e660f4579b testing: Fixed evaluation in swanctl/rw-cert-pss scenario 2018-10-27 08:47:57 +02:00
Andreas Steffen f5565683b9 Version bump to 5.7.2dr1 2018-10-26 18:47:48 +02:00
Andreas Steffen 534ab34df6 testing: Added botan/net2net-ed25519 scenario 2018-10-26 18:46:59 +02:00
Tobias Brunner d1acfeec7b NEWS: Add some recent changes 2018-10-26 15:27:15 +02:00
Tobias Brunner ce381883a1 dhcp: Ignore DHCP OFFER messages without assigned address
FreeRADIUS seems to respond that way if it can't allocate an address to
the client.
2018-10-26 11:26:50 +02:00
Tobias Brunner 6e9cfe9751 vici: Properly handle absence of peer ID on mediation connections
Fixes #2794.
2018-10-26 11:25:31 +02:00
Tobias Brunner 46bea1add9 task-manager-v2: Reject requests for incomplete IKE_SAs as initiator
Based on a patch by Thomas Egerer.
2018-10-26 11:22:08 +02:00
Tobias Brunner a61b1a6ee4 mysql: Don't release the connection if transactions are still using it
Fixes #2779.
2018-10-26 11:18:43 +02:00
Tobias Brunner 6c641377c3 Merge branch 'botan-algos'
This adds wrappers for additional algorithms (Ed25519, ChaCha20/Poly1305,
AES-CCM) to the botan plugin and fixes some potential compile issues.
2018-10-26 11:11:04 +02:00
Tobias Brunner 147363c169 botan: Fix build without specific asymmetric crypto 2018-10-26 11:06:45 +02:00
Tobias Brunner 37ae912271 botan: Fix build without AES and its modes 2018-10-26 11:06:45 +02:00
Tobias Brunner 3f960e38a1 botan: Add support for AES-CCM 2018-10-26 11:06:45 +02:00
Tobias Brunner b1ab9782e2 test-vectors: Add another ChaCha20/Poly1305 test vector from RFC 7539 2018-10-26 11:06:45 +02:00
Tobias Brunner cb7b83017d botan: Add support for ChaCha20/Poly1305 AEAD algorithm 2018-10-26 11:06:45 +02:00
Tobias Brunner 4bcc4bacd4 botan: Add support for Ed25519 keys 2018-10-26 11:06:45 +02:00
Tobias Brunner 5cd24d26e2 botan: Add helper function for signature verification 2018-10-26 11:06:45 +02:00
Tobias Brunner 8d8e7a9c8b Merge branch 'ssh-eddsa'
This adds support for Ed25519/Ed448 SSH keys and their signatures via
agent plugin.
2018-10-26 11:04:37 +02:00
Tobias Brunner 8f23e64ee5 agent: Support signatures with Ed25519/Ed448 keys 2018-10-26 11:01:10 +02:00
Tobias Brunner 87dd08b139 sshkey: Support encoding Ed25519/Ed448 SSH public keys 2018-10-26 11:01:10 +02:00
Tobias Brunner 7de0729357 sshkey: Add support for parsing Ed25519/Ed448 SSH keys 2018-10-26 11:01:10 +02:00
Tobias Brunner 20f74adbae curve25519: Support loading Ed25519 public keys from simple blobs 2018-10-26 11:01:10 +02:00
Tobias Brunner b982473a86 charon-cmd: Print plugin list before parsing arguments
Helps debugging e.g. failures to load certs/keys.
2018-10-26 11:01:10 +02:00
Tobias Brunner 64adacc3c6 Merge commit 'key-sig-schemes'
This adds the ability to return supported signature schemes (and
parameters) from a private key.

This is useful for keys on a TPM 2.0 as these can be used only with a
particular scheme (the hash algorithm and for RSA even the padding scheme
is fixed).  For RSA with PSS padding there is an additional complication
because different TPMs use different salt lengths, which we have to know
beforehand to correctly produce e.g. a certificate request (the signature
covers the algorithm identifier that describes the signature scheme).

It turned out that the new method is also useful for the agent plugin.
Newer ssh/gpg-agents support SHA-256 and SHA-512 for RSA signatures, but
not SHA-384, which we can now convey to the pubkey authenticator.
Unfortunately, older agents ignore the flags that request a SHA2 signature
and just return one with SHA-1, in such scenarios IKEv2 signature
authentication has to be disabled.
2018-10-26 10:59:38 +02:00
Tobias Brunner 153eb8199a agent: Enumerate only the supported signature schemes for RSA keys
SHA-384 is not supported but is selected by signature_schemes_for_key()
for keys between 3072 and 7680 bits.

Since this is only called for IKEv2 signature authentication we don't
even provide SHA-1 anymore.  We always provide both schemes, though,
which is what pubkey-authenticator does too for RSA.

Older agents apparently just ignore the flags and always return a SHA-1
signature.  If that's the case, charon.signature_authentication has to
be disabled.
2018-10-26 09:55:08 +02:00
Tobias Brunner 5e03675a19 agent: Add support for RSA signatures with SHA256 and SHA512 2018-10-26 09:55:07 +02:00
Andreas Steffen 1b510c0467 pubkey-authenticator: Append RSAPSS salt length to debug output 2018-10-26 09:55:07 +02:00
Tobias Brunner 7b46089ea7 travis: Build tmp2-tss from sources 2018-10-26 09:55:07 +02:00
Andreas Steffen 3150bd2b81 libtpmtss: Generalize AIK keys to signature keys 2018-10-26 09:55:07 +02:00
Andreas Steffen 526c5abd0f tpm: Check FIPS-140-2 and FIPS-186-4 compliance 2018-10-26 09:55:07 +02:00
Tobias Brunner b158404c5f tpm: Return signature schemes supported by the key if TSS supports it 2018-10-26 09:03:27 +02:00
Tobias Brunner 7ca3b3daee libtpmtss: Add enumeration of supported signature schemes to TSS2 implementations 2018-10-26 09:03:27 +02:00
Tobias Brunner 532cd488e3 libtpmtss: TSS can optionally return signature schemes supported by a key 2018-10-26 09:03:26 +02:00
Tobias Brunner ecfe67550d signature-params: Provide option for maximum RSA/PSS salt length
However, the length now has to be resolved early, so we don't operate on
the negative constant values e.g. when generating the encoding.
2018-10-26 09:03:26 +02:00
Tobias Brunner dd4bd21c5a pki: Query private key for supported signature schemes 2018-10-26 09:03:26 +02:00
Tobias Brunner b88f2b3815 pubkey-authenticator: Query private key for supported signature schemes 2018-10-26 09:03:09 +02:00
Tobias Brunner 1c4738325d private-key: Add optional method that returns supported signature schemes 2018-10-25 17:21:32 +02:00
Tobias Brunner 9b5b55b026 Merge branch 'openssl-keyid'
Closes strongswan/strongswan#116.
2018-10-24 10:07:49 +02:00
ambiso 6b3dfe9c38 openssl: Remove extra semicolon 2018-10-24 09:49:25 +02:00
ambiso b9e45b5b4a openssl: Remove arbitrary keyid length check 2018-10-24 09:49:18 +02:00
ambiso b148517c6b openssl: Fix invalid keyid length check
Check was designed for base64 conversion, however a hex conversion is
being performed, which requires more memory.
2018-10-24 09:48:56 +02:00
Andreas Steffen d99e73548e libtpmtss: Fixed inclusion of tcti-tabrmd.h header file 2018-10-19 10:46:08 +02:00
Tobias Brunner f18945dfea libvici: Wrap header in extern "C" to include it from C++
Fixes #2795.
2018-10-18 15:14:23 +02:00
Tobias Brunner 537764ea55 android: New release after fixing DNS leak and some bugs 2018-10-17 12:08:47 +02:00
Tobias Brunner 5442e8a161 android: Force the two line button to be focusable
On newer Android versions (8+) this does not seem to be necessary (adding
the onClick handler also sets "clickable" and that in turn seems to make
it focusable), however, for older releases it is (tested with 7.1.1
keyboard navigation just skips over the button).  This was seen on a
Fire TV stick.
2018-10-17 11:56:30 +02:00
Tobias Brunner 84ee9577e1 android: Avoid DNS leak due to blocking TUN device without DNS servers
It looks like Android 9 incorrectly continues to use the regular DNS
servers after the blocking TUN device is replaced with the actual
interface.  Setting DNS servers prevents that (since all traffic is
blocked, which ones doesn't really matter but local/loopback addresses
are rejected).
Interestingly, if the VPN server later does not assign any DNS servers, there
is no fallback to the non-VPN DNS servers for some reason (that's definitely
not as documented).  This could potentially be a problem as we don't
offer an option to configure DNS servers in the VPN profile.

Neither issue is seen on older Android versions (only tested on 7.1.1).
2018-10-17 11:56:30 +02:00
Tobias Brunner e89cfe4854 android: Update Gradle plugin 2018-10-17 11:56:30 +02:00
Tobias Brunner 9fb00bf89f android: Make sure we actually have a tile when updating it
Not sure when this happens exactly, in particular because the reported
stack traces look like this

java.lang.NullPointerException:
  at org.strongswan.android.ui.VpnTileService.updateTile (VpnTileService.java:220)
  at org.strongswan.android.ui.VpnTileService.onStartListening (VpnTileService.java:97)
  at android.service.quicksettings.TileService$H.handleMessage (TileService.java:407)

which violates the API documentation for getQsTile(), which states:

  This tile is only valid for updates between onStartListening() and
  onStopListening().

But apparently that's not always the case. There have been two reports
of such a crash, both on Android 8.0 and on Xiaomi Mi 5/6 devices, so
maybe it's a bug in that particular image.
2018-10-17 11:56:30 +02:00
Tobias Brunner 4bd4750131 android: Fix profile selection/edit when the device is rotated
The previous code lost track of the selected profile IDs, but the
widgets maintained their state (i.e. the list item was still selected and the
edit button still enabled).  Clicking the edit button then caused a crash when
trying to get the first item in the set.
2018-10-17 11:56:30 +02:00
Thomas Egerer a160f100fb ikev1: Log traffic selectors for missing child configs
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-10-17 11:55:16 +02:00
Thomas Egerer 8c732b8e21 task-manager-v1: Clear retransmit alert on request retransmit
The task manager for IKEv1 issues a retransmit send alert in the
retransmit_packet() function. The corresponding retransmit cleared alert
however is only issued for exchanges we initiated after processing the
response in process_response().

For quick mode exchanges we may retransmit the second packet if the peer
(the initiator) does not send the third message in a timely manner. In
this case the retransmit send alert may never be cleared.

With this patch the retransmit cleared alert is issued for packets that
were retransmitted also when we are the responding party when we receive
the outstanding response.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-10-17 11:55:16 +02:00
Andreas Steffen 2d3e20a839 sec-updater.sh: Support of Debian 9.0 and Ubuntu 18.04 2018-10-07 10:14:20 +02:00
Tobias Brunner d4068a1dd8 travis: Don't build botan twice if installing dependencies is retried 2018-10-02 16:14:20 +02:00
Tobias Brunner 6e55856830 fuzzing: Add -lm to LDFLAGS if the coverage sanitizer is used
libFuzzer apparently uses math functions (e.g. ceilf) for that sanitizer.
2018-10-02 10:58:40 +02:00
Tobias Brunner 4a33dcfefc travis: Only build sonarcloud target if the token is available
That's not the case for pull requests that don't have access to
encrypted tokens/environment variables.
2018-10-02 09:38:00 +02:00
Matt Selsky b98db90763 swanctl: Fix typos in usage for swanctl rekey/terminate commands
Closes strongswan/strongswan#113.
2018-10-02 09:30:03 +02:00
Andreas Steffen 04ef28b4df Version bump to 5.7.1 2018-10-01 17:46:17 +02:00
Tobias Brunner 291c1acd4b NEWS: Add info about CVE-2018-17540 2018-10-01 10:26:08 +02:00
Tobias Brunner 129ab919a8 gmp: Fix buffer overflow with very small RSA keys
Because `keylen` is unsigned the subtraction results in an integer
underflow if the key length is < 11 bytes.

This is only a problem when verifying signatures with a public key (for
private keys the plugin enforces a minimum modulus length) and to do so
we usually only use trusted keys.  However, the x509 plugin actually
calls issued_by() on a parsed certificate to check if it is self-signed,
which is the reason this issue was found by OSS-Fuzz in the first place.
So, unfortunately, this can be triggered by sending an invalid client
cert to a peer.

Fixes: 5955db5b12 ("gmp: Don't parse PKCS1 v1.5 RSA signatures to verify them")
Fixes: CVE-2018-17540
2018-09-26 10:10:48 +02:00
Tobias Brunner 8932d6070f travis: Don't build tags separately
Travis treats tags just like branches (which sonarcloud does too) and the
tagged commit is built anyway.
2018-09-24 14:22:42 +02:00
Andreas Steffen 2a327d438c Version bump to 5.7.0 2018-09-24 11:10:12 +02:00
Tobias Brunner 86c188515e NEWS: Add info about CVE-2018-16151/52 2018-09-21 18:51:58 +02:00
Tobias Brunner 5955db5b12 gmp: Don't parse PKCS1 v1.5 RSA signatures to verify them
Instead we generate the expected signature encoding and compare it to the
decrypted value.

Due to the lenient nature of the previous parsing code (minimum padding
length was not enforced, the algorithmIdentifier/OID parser accepts arbitrary
data after OIDs and in the parameters field etc.) it was susceptible to
Daniel Bleichenbacher's low-exponent attack (from 2006!), which allowed
forging signatures for keys that use low public exponents (i.e. e=3).

Since the public exponent is usually set to 0x10001 (65537) since quite a
while, the flaws in the previous code should not have had that much of a
practical impact in recent years.

Fixes: CVE-2018-16151, CVE-2018-16152
2018-09-21 18:51:58 +02:00
Tobias Brunner 64d88efac5 travis: Run long-running tests first to reduce overall build time
Moving the manual matrix inclusions further up would be even better but
that doesn't seem possible.
2018-09-21 11:03:47 +02:00
Tobias Brunner 231c087e3c android: Disable capabilities in the android app
capset/capget are not in the NDK headers anymore, but we didn't use them
in the app anyway.
2018-09-21 11:01:26 +02:00
Tobias Brunner 7a6426082a android: Fix implementation of change_state() method in Android IMC
The signature was changed with 731e043c8e ("libimcv: Reset of IMC state for
new measurement cycle").
2018-09-21 10:55:34 +02:00
Andreas Steffen 1dd382b888 Version bump to 5.7.0rc2 2018-09-18 16:03:23 +02:00
Tobias Brunner b01327b5e1 swanctl: Document PPKs 2018-09-18 10:12:45 +02:00
Tobias Brunner 784d96e031 Fixed some typos, courtesy of codespell 2018-09-17 18:51:44 +02:00
Tobias Brunner 432e2a72b2 settings: Clarify that a key/value-pair can only occur once 2018-09-17 18:51:43 +02:00
Tobias Brunner d601058a26 settings-test: Remove unused variable in printf() call 2018-09-17 18:51:43 +02:00
Tobias Brunner c07dde4b7d vici: Fix syntax error in Ruby bindings
I guess nobody uses these.

Fixes: 2c7cfe7630 ("vici:  flush-certs command flushes certificate cache")
2018-09-17 18:51:43 +02:00
Tobias Brunner f1889ca34a imv-attestation: Don't use comma to separate statements 2018-09-17 18:51:43 +02:00
Tobias Brunner f0d34f32a7 imv-agent: Don't use comma to separate statements 2018-09-17 18:51:43 +02:00
Tobias Brunner 52b6506a23 xauth-pam: Don't use comma to separate statements 2018-09-17 18:51:42 +02:00
Tobias Brunner 2c41fb6349 tnc-pdp: Don't use comma to separate statements 2018-09-17 18:51:42 +02:00
Tobias Brunner bea10205b0 receiver: Don't use commas to separate statements
Maybe was in the INIT statement at some point.
2018-09-17 18:51:42 +02:00
Tobias Brunner 3552bba63a manager: Restore direct return if database URI is not defined
There was an exit anyway because storage_create() returns NULL if the
database can't be created.
2018-09-17 18:51:42 +02:00
Tobias Brunner 1295558ab3 imv-os-agent: Remove useless assignment
`eval` will never be TNC_IMV_EVALUATION_RESULT_DONT_KNOW so we can
remove the if statement too.
2018-09-17 18:51:42 +02:00
Tobias Brunner ddc797686f pts: Remove commented call of inexistent function 2018-09-17 18:51:42 +02:00
Tobias Brunner 0b8d00adaf counters: Fix exit status in error case 2018-09-17 18:51:42 +02:00
Tobias Brunner 66aca84eba signcrl: Remove useless assignment 2018-09-17 18:51:41 +02:00
Tobias Brunner 020045f416 asn1: Remove useless assignment 2018-09-17 18:51:41 +02:00
Tobias Brunner 3ea33d15a2 mode-config: Remove useless assignment 2018-09-17 18:51:41 +02:00
Tobias Brunner c503eec92e keymat_v1: Remove useless assignment 2018-09-17 18:51:41 +02:00
Tobias Brunner 0af96ad5e7 kernel-netlink: Check return value of both halfs when installing default route in main table 2018-09-17 18:51:41 +02:00
Tobias Brunner d51a28bd5c botan: Fix leak if hasher initialization fails 2018-09-17 18:51:41 +02:00
Tobias Brunner dc09570a12 botan: Share code to generate RSA EMSA PSS signature identifier strings 2018-09-17 18:51:40 +02:00
Tobias Brunner 2788529827 botan: Remove unnecessary nested blocks and simplify keyid allocation 2018-09-17 16:41:19 +02:00
Tobias Brunner 7855ad4c9e daemon: Remove redundant assignment to time_format 2018-09-17 16:41:18 +02:00
Andreas Steffen 11b4a87050 Version bump to 5.7.0rc1 2018-09-16 09:30:18 +02:00
Andreas Steffen 9a4b47ef96 testing: Extended Botan scenarios 2018-09-16 09:30:18 +02:00
Tobias Brunner d2a1834d01 NEWS: Added some news for 5.7.0 2018-09-12 18:41:53 +02:00
Tobias Brunner bbe72f97f9 travis: Silence `git checkout` for Botan 2018-09-12 17:18:15 +02:00
Tobias Brunner c46a94e0cc Merge branch 'botan-plugin'
Adds a wrapper plugin for the Botan crypto library.

Closes strongswan/strongswan#109.
2018-09-12 16:25:07 +02:00
Tobias Brunner 1bbb736edc travis: Use a fix revision for Botan and speed up subsequent builds via ccache 2018-09-12 16:25:00 +02:00
Tobias Brunner 24af02b00d travis: Use amalgamation build for Botan and build outside our source tree
This merges all source files into botan_all.cpp, which reduces the build
time by almost 50%. Building outside the strongSwan tree avoids analyzing
Botan with sonarqube.
2018-09-12 16:25:00 +02:00
Tobias Brunner a80069e7bf gcrypt: Make generic DH constructor static 2018-09-12 16:25:00 +02:00
Tobias Brunner e5d5277467 travis: Build botan plugin also in the tests that build everything 2018-09-12 16:25:00 +02:00
Tobias Brunner 9c6bcb21f0 travis: Only add the sonarcloud addon for that build 2018-09-12 16:25:00 +02:00
Andreas Steffen 72a6831e7c testing: Added botan/rw-cert scenario 2018-09-12 16:25:00 +02:00
Tobias Brunner a5c682e87d testing: Enable Botan and the plugin
ldconfig is required, otherwise the library won't be found by
strongSwan in the same session.

Should later be changed to 2.8.0 or a newer stable release.
2018-09-12 16:25:00 +02:00
Tobias Brunner b4062c4bb7 botan: Add support for X25519 2018-09-12 16:25:00 +02:00
Tobias Brunner 40b3bf6ba7 botan: Simplify DH/ECDH key derivation 2018-09-12 16:25:00 +02:00
Tobias Brunner 125222dca7 test-vectors: Add the actual test vector from RFC 8031 for x25519
The existing test vector is from RFC 8037.
2018-09-12 16:25:00 +02:00
Tobias Brunner e5e500c07e ike-init: Fix leak if KE payload creation fails 2018-09-12 16:25:00 +02:00
Tobias Brunner 472efd3809 leak-detective: Add an option to ignore frees of unknown memory blocks
This also changes how unknown/corrupted memory is handled in the free()
and realloc() hooks in general.

Incorporates changes provided by Thomas Egerer who ran into a similar
issue.
2018-09-12 16:25:00 +02:00
Tobias Brunner 9ee23d5efa travis: Add Botan build
We build Botan directly from the master branch until 2.8.0 is released.
2018-09-12 16:25:00 +02:00
Tobias Brunner c064a5288e leak-detective: Whitelist some Botan functions
Due to the mangled C++ function names it's tricky to be more specific.  The
"leaked" allocations are from a static hashtable containing EC groups.

There is another leak caused by the locking allocator singleton
(triggered by the first function that uses it, usually initialization of
 a cipher, but could be a hasher in other test runners), but we can avoid
that with a Botan config option.
2018-09-12 16:25:00 +02:00
Tobias Brunner 304d4ca57a botan: Adhere to configured DH exponent length 2018-09-12 16:25:00 +02:00
Tobias Brunner bd267c863f botan: Encode private keys as PKCS#8
Since we can now parse that encoding directly we can simplify the private
key export and stick to PKCS#8.
2018-09-12 16:25:00 +02:00
Tobias Brunner 607f10dca4 botan: Load public/private keys generically
Simplifies public key loading and this way unencrypted PKCS#8-encoded
keys can be loaded directly without pkcs8 plugin (code for encrypted
keys could probably later be added, if necessary).

It also simplifies the implementation of private_key_t::get_public_key()
a lot.
2018-09-12 16:25:00 +02:00
Tobias Brunner 72491b7843 botan: Encode curve OID and public key in EC private key
Without OID we can't generate an algorithmIdentifier when loading the
key again. And older versions of OpenSSL insist on a public key when
e.g. converting a key to PKCS#8.

Simply unwrapping the ECPrivateKey structure avoids log messages when
parsing other keys in the KEY_ANY case.
2018-09-12 16:25:00 +02:00
Tobias Brunner ba7e74291e pkcs1: Accept EC private keys without public key but make sure of an OID 2018-09-12 16:25:00 +02:00
Tobias Brunner de2a24310c botan: Fixes, code style changes plus some refactorings
Some changes rely on newly added FFI functions in Botan's master
branch.
2018-09-12 16:25:00 +02:00
René Korthaus 13f113f7a9 botan: Add MD5 support to Botan hasher
Support MD5 in the Botan plugin if supported by Botan.
MD5 is required for RADIUS and obviously EAP-MD5,
and also for non-PKCS#8 encoded, encrypted private keys.
2018-09-12 16:25:00 +02:00
René Korthaus 04ecaff6a9 unit-tests: Remove 768 bits RSA gen test
Botan only allows RSA generating keys >= 1,024 bits, which makes
the RSA test suite fail. It is questionable whether it makes
sense to test 768 bit RSA keys anymore. They are too weak
from today's perspective anyway.
2018-09-12 16:25:00 +02:00
René Korthaus af26cc4d85 botan: Add Botan plugin to libstrongswan 2018-09-12 16:25:00 +02:00
Tobias Brunner 66c4735f99 dumm: Remove the Dynamic UML Mesh Modeler framework
This has been pretty much defunct for several years (requires a
specially patched UML-enabled guest kernel).
2018-09-12 15:53:55 +02:00
Tobias Brunner 948c42ab2e android: Properly set log file path 2018-09-12 11:44:57 +02:00
Tobias Brunner bd61236b4a conf: Document new filelog configuration 2018-09-12 11:42:38 +02:00
Tobias Brunner f6b4ba2a65 library: Return FALSE from library_init() if loaded settings are invalid
This way daemons won't start with config files that contain errors.
2018-09-11 18:30:18 +02:00
Tobias Brunner 71dca60c31 settings: Don't allow dots in section/key names anymore
This requires config changes if filelog is used with a path that
contains dots. This path must now be defined in the `path` setting of an
arbitrarily named subsection of `filelog`.  Without that change the
whole strongswan.conf file will fail to load, which some users might
not notice immediately.
2018-09-11 18:30:18 +02:00
Tobias Brunner 85afe81e1f ike-auth: Remove unnecessary case statement 2018-09-11 18:18:50 +02:00
Tobias Brunner a0c302f878 vici: Remove unreachable code
If list is TRUE any type but VICI_LIST_END and VICI_LIST_ITEM (i.e.
including VICI_END) is already handled in the first block in this
function.
2018-09-11 18:18:50 +02:00
Tobias Brunner 954e75effa vici: Lease enumerator is always defined
mem_pool_t always returns an enumerator.
2018-09-11 18:18:50 +02:00
Tobias Brunner 55fb268b51 stroke: Lease enumerator is always defined
This function is only called for existing pools (under the protection of
a read lock).
2018-09-11 18:18:50 +02:00
Tobias Brunner 648709b392 smp: Remove unreachable initializer
Execution in this block will start with any of the case statements,
never with the initialization.
2018-09-11 18:18:49 +02:00
Tobias Brunner 23d756e4f0 eap-sim-pcsc: Fix leak in error case 2018-09-11 18:18:49 +02:00
Tobias Brunner e2d8833f2b travis: Add sonarcloud build 2018-09-11 18:18:43 +02:00
Tobias Brunner f5481496d6 travis: Automatically retry install steps
There occasionally are network issues when fetching from Ubuntu/PPA
repos.  Let's see if this is a possible fix.
2018-09-11 18:17:28 +02:00
Tobias Brunner 80e8845d36 swanctl: Allow passing a custom config file for each --load* command
Mainly for debugging, but could also be used to e.g. use a separate file
for connections and secrets.
2018-09-11 18:14:45 +02:00
Tobias Brunner 7257ba3b44 Merge branch 'ikev2-ppk'
Adds support for Postquantum Preshared Keys for IKEv2.

Fixes #2710.
2018-09-10 18:05:12 +02:00
Tobias Brunner d1c5e6816d testing: Add some PPK scenarios 2018-09-10 18:04:23 +02:00
Tobias Brunner 755985867e swanctl: Report the use of a PPK in --list-sas
If we later decide the PPK_ID would be helpful, printing this on a
separate line would probably make sense.
2018-09-10 18:03:30 +02:00
Tobias Brunner c4d2fdd915 vici: Return PPK state of an IKE_SA 2018-09-10 18:03:27 +02:00
Tobias Brunner e4d85011e4 ikev2: Mark IKE_SAs that used PPK during authentication 2018-09-10 18:03:18 +02:00
Tobias Brunner 6627706786 eap-authenticator: Add support for authentication with PPK 2018-09-10 18:03:03 +02:00
Tobias Brunner 18f8249415 pubkey-authenticator: Add support for authentication with PPK 2018-09-10 18:03:03 +02:00
Tobias Brunner 46bdeaf359 psk-authenticator: Add support for authentication with PPK 2018-09-10 18:03:03 +02:00
Tobias Brunner a9e60c96dc ike-auth: Add basic PPK support
Some of the work will have to be done in the authenticators.
2018-09-10 18:03:02 +02:00
Tobias Brunner 94f9f421bc ike-auth: Replace `== NULL` with `!` 2018-09-10 18:03:02 +02:00
Tobias Brunner 7150fa7065 authenticator: Add optional method to set PPK 2018-09-10 18:03:02 +02:00
Tobias Brunner 600b106852 ike-init: Send USE_PPK notify as appropriate 2018-09-10 18:03:02 +02:00
Tobias Brunner 1fb46f7119 swanctl: Report PPK configuration in --list-conns 2018-09-10 18:03:02 +02:00
Tobias Brunner 7f94528061 vici: Make PPK related options configurable 2018-09-10 18:03:02 +02:00
Tobias Brunner a2ff8b654d peer-cfg: Add properties for PPK ID and whether PPK is required 2018-09-10 18:03:01 +02:00
Tobias Brunner 83dcc1f4cf ike-sa: Add flag for PPK extension 2018-09-10 18:03:01 +02:00
Tobias Brunner 3fbc95cf54 keymat_v2: Add support for PPKs 2018-09-10 18:03:01 +02:00
Tobias Brunner 3703dff2aa swanctl: Add support for PPKs 2018-09-10 18:03:01 +02:00
Tobias Brunner 1ec9382880 vici: Add support for PPKs 2018-09-10 18:03:01 +02:00
Tobias Brunner bac3ca2324 shared-key: Add a new type for Postquantum Preshared Keys
Using a separate type allows us to easily check if we have any PPKs
available at all.
2018-09-10 18:03:01 +02:00
Tobias Brunner 0f423dda28 ikev2: Add notify types for Postquantum Preshared Keys 2018-09-10 18:03:00 +02:00
Tobias Brunner 5dff6de8eb unit-tests: Add tests for peer_cfg_t::replace_child_cfgs() 2018-09-10 17:45:23 +02:00
Tobias Brunner 40ed812442 peer-cfg: Replace equal child configs with newly added ones
Otherwise, renamed child configs would still be known to the daemon
under their old name.

Fixes #2746.
2018-09-10 17:45:07 +02:00
Andreas Steffen 375dfb9076 crypto: References to RFCs 8410 and 8420 2018-09-04 07:24:20 +02:00
Tobias Brunner 53f8ac3d6a Normalize whitespace in boilerplate files
Now all consistently use 2 or 4 (HACKING) spaces for indentation.
2018-09-03 14:18:20 +02:00
Tobias Brunner aad9021fd3 README: Fix indentation 2018-09-03 14:14:18 +02:00
Martin Willi 39bc437771 init: Reload configurations/credentials as well during systemctl reload 2018-08-31 16:57:48 +02:00
Tobias Brunner 8505c28289 swanctl: Add --reauth option to --rekey command 2018-08-31 12:39:46 +02:00
Tobias Brunner a20527438a vici: Add option to reauthenticae instead of rekey an IKEv2 SA 2018-08-31 12:39:46 +02:00
Tobias Brunner 720a8bedaa Merge branch 'xfrm-set-mark'
This adds the ability to configure marks the in- and/or outbound SA
should apply to packets after processing on Linux.  Configuring such a mark
for outbound SAs requires at least a 4.14 kernel.  The ability to set a mask
and configuring a mark/mask for inbound SAs will be added with the upcoming
4.19 kernel.
2018-08-31 12:32:31 +02:00
Martin Willi 902dc29f7a child-sa: Use SA matching mark as SA set mark if the latter is %same
For inbound processing, it can be rather useful to apply the mark to the
packet in the SA, so the associated policy with that mark implicitly matches.
When using %unique as match mark, we don't know the mark beforehand, so
we most likely want to set the mark we match against.
2018-08-31 12:26:40 +02:00
Martin Willi ebd2d3877e ipsec-types: Restrict the use of %unique and other keywords when parsing marks
%unique (and the upcoming %same key) are usable in specific contexts only.
To restrict the user from using it in other places where it does not get the
expected results, reject such keywords unless explicitly allowed.
2018-08-31 12:26:40 +02:00
Martin Willi b9aacf9adc vici: Document kernel requirements for set_mark_in/set_mark_out options 2018-08-31 12:26:40 +02:00
Tobias Brunner 60f7896923 vici: Make in-/outbound marks the SA should set configurable 2018-08-31 12:26:40 +02:00
Tobias Brunner f59450fde6 child-sa: Configure in-/outbound mark the SA should set 2018-08-31 12:26:40 +02:00
Tobias Brunner fa4d4012ae child-cfg: Add properties for in-/outbound mark the SA should set 2018-08-31 12:24:30 +02:00
Tobias Brunner 9cee688f78 kernel-netlink: Add support for setting mark/mask an SA should apply to processed traffic 2018-08-31 12:24:30 +02:00
Tobias Brunner c5b94b2483 kernel-netlink: Use larger buffer for event messages 2018-08-31 12:15:12 +02:00
Tobias Brunner 9de3140dbf ikev1: Increase DPD sequence number only after receiving a response
We don't retransmit DPD requests like we do requests for proper exchanges,
so increasing the number with each sent DPD could result in the peer's state
getting out of sync if DPDs are lost.  Because according to RFC 3706, DPDs
with an unexpected sequence number SHOULD be rejected (it does mention the
possibility of maintaining a window of acceptable numbers, but we currently
don't implement that).  We partially ignore such messages (i.e. we don't
update the expected sequence number and the inbound message stats, so we
might send a DPD when none is required).  However, we always send a response,
so a peer won't really notice this (it also ensures a reply for "retransmits"
caused by this change, i.e. multiple DPDs with the same number - hopefully,
other implementations behave similarly when receiving such messages).

Fixes #2714.
2018-08-31 11:31:35 +02:00
Tobias Brunner 5c38a5ea83 Remove ITA references 2018-08-31 11:11:12 +02:00
Tobias Brunner 85a6fe2306 ikev1: Signal IKE_SA connection failure via bus
This is mainly for HA where a passive SA was already created when the
IKE keys were derived.  If e.g. an authentication error occurs later that
SA wouldn't get cleaned up.
2018-08-31 11:05:39 +02:00
Tobias Brunner 4899a4c025 aggressive-mode: Trigger alerts for authentication failures 2018-08-31 11:02:43 +02:00
Tobias Brunner f32402f58e main-mode: Local identity is always defined 2018-08-31 11:02:43 +02:00
Tobias Brunner 78b3c9e2df main-mode: Also trigger a PEER_AUTH_FAILED alert if authorize() fails 2018-08-31 11:02:43 +02:00
Thomas Egerer 095db2ed91 main-mode: Signal local/peer auth failure via bus
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-08-31 11:02:43 +02:00
Thomas Egerer 32c190634c custom-logger: Add optional reload method
The reload of the configuration of the loggers so far only included
the log levels. In order to support the reload of all other options,
a reload function may be implemented.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-08-29 15:55:33 +02:00
Tobias Brunner c163a53a3a ike-sa-manager: Log message when scheduling delete for reauthenticated IKE_SA 2018-08-29 15:46:37 +02:00
Tobias Brunner d98df236a9 Merge branch 'ip-header-fields'
Adds new options that allow configuring how/whether certain fields in
the IP headers are copied during IPsec processing. Currently only allows
configuration on Linux.

Closes strongswan/strongswan#104.
2018-08-29 11:50:13 +02:00
Tobias Brunner c993eaf9d1 kernel: Add option to control DS field behavior 2018-08-29 11:36:04 +02:00
Tobias Brunner dc8b015d78 kernel: Add options to control DF and ECN header bits/fields via XFRM
The options control whether the DF and ECN header bits/fields are copied
from the unencrypted packets to the encrypted packets in tunnel mode (DF only
for IPv4), and for ECN whether the same is done for inbound packets.

Note: This implementation only works with Linux/Netlink/XFRM.

Based on a patch by Markus Sattler.
2018-08-29 11:36:04 +02:00
Tobias Brunner de4c3d2e76 vici: Add error handling to message parsing in Perl bindings 2018-08-29 11:32:21 +02:00
Afschin Hormozdiary d6aa6537e7 vici: Improve message parsing performance in Perl bindings
During a test with ~12000 established SAs it was noted that vici
related operations hung.
The operations took over 16 minutes to finish. The time was spent in
the vici message parser, which was assigning the message over and over
again, to get rid of the already parsed portions.

First fixed by cutting the consumed parts off without copying the message.
Runtime for ~12000 SAs is now around 20 seconds.

Further optimization brought the runtime down to roughly 1-2 seconds
by using an fd to read through the message variable.

Closes strongswan/strongswan#103.
2018-08-29 11:31:38 +02:00
Thomas Egerer 5100a3ed7d kernel-netlink: Align concatenated Netlink responses
The code to support parallel Netlink queries (commit 3c7193f) made use
of nlmsg_len member from struct nlmsghdr to allocate and copy the
responses. Since NLMSG_NEXT is later used to parse these responses, they
must be aligned, or the results are undefined.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-08-23 16:34:25 +02:00
Tobias Brunner 2ff4983adc libimcv: Fix Android.mk 2018-08-10 10:10:00 +02:00
Vishal Rana 41fed536e8 libtpmtss: Fixed Android.mk
Closes strongswan/strongswan#111

Signed-off-by: Vishal Rana <vr@labstack.com>
2018-08-10 10:09:43 +02:00
Tom Schlenkhoff 46f482ca54 README: Fix typos
Closes strongswan/strongswan#110.
2018-08-06 16:57:04 +02:00
Tobias Brunner 6ccfeeb1d8 travis: Fix vici Python tests when using Clang
For some reason the clang binary that's installed in an uncommon
directory could not be found anymore when installing packages via pip for
the last couple of builds. While the directory is obviously contained in PATH,
using `sudo -E` didn't help. So we now install the Python packages in the
user's home directory to avoid having to use sudo.
2018-08-06 15:59:09 +02:00
Andreas Steffen a019c95b72 Version bump to 5.7.0dr8 2018-08-02 07:30:05 +02:00
Andreas Steffen 840971e253 Merge branch 'swima-subscriptions' 2018-08-02 07:28:52 +02:00
Andreas Steffen 6a59e1fa9e tnccs-20: Defer handshake retry when sending SRETRY batch
Set a retry_handshake flag on a TNC server when sending a SRETRY
batch and do the retry only after receiving the next CDATA batch
from the TNC client.
2018-08-01 15:44:49 +02:00
Andreas Steffen 731e043c8e libimcv: Reset of IMC state for new measurement cycle 2018-08-01 15:44:49 +02:00
Andreas Steffen 25973c0350 libimcv: Reset of IMV state for new measurement cycle 2018-08-01 15:44:49 +02:00
Andreas Steffen 37c12f98b0 imv-swima: Support subscriptions 2018-07-30 12:06:34 +02:00
Andreas Steffen f649a13cc6 imc-swima: Support subscriptions 2018-07-29 10:37:36 +02:00
Andreas Steffen ff9bac6ab8 libimcv: Missing comma in pa_tnc_error_code_names 2018-07-24 22:49:45 +02:00
Andreas Steffen 041efa6ed3 Version bump to 5.7.0dr6 2018-07-21 09:30:53 +02:00
Andreas Steffen b9d6b3c3e2 libtpmss: Configure TCTI device options 2018-07-20 19:19:24 +02:00
Andreas Steffen 9a7a962348 Version bump to 5.7.0dr5 2018-07-19 14:57:18 +02:00
Andreas Steffen 5fbb8b6a4a libimcv: Added Debian 8.11 and Ubunut 18.04 to IMV database 2018-07-19 14:11:44 +02:00
Andreas Steffen fd21c40b6c libtpmtss: Support of RSAPSS signature scheme 2018-07-19 12:40:42 +02:00
Andreas Steffen e74e920bbc libtpmtss: Support for TSS2 v2 libraries 2018-07-19 12:40:42 +02:00
Tobias Brunner 75214fabd8 testing: Optionally build/install strongSwan only on a specific guest
This may be used to test different strongSwan versions against each
other.
2018-07-11 18:38:09 +02:00
Tobias Brunner a4617539a2 conf: Fix bench_time documentation 2018-07-09 18:10:07 +02:00
Tobias Brunner 9403320fca message: Report the size of the complete reassembled IKE message
This way we see the same size on both ends, namely that of the complete
IKE message as if it was sent in a single packet (excluding UDP/IP headers).
2018-07-09 17:49:07 +02:00
Tobias Brunner 62721936b1 encrypted-payload: Change how the length for reassembled messages is calculated
If we have an AEAD transform we add the overhead as if the data would have
been transported in a single encrypted payload.
2018-07-09 17:25:02 +02:00
Tobias Brunner cc1f01e009 encrypted-payload: Add getter for the used AEAD transform 2018-07-09 17:15:07 +02:00
Tobias Brunner 47ec761674 testing: Fix checks after changing fragmentation log messages 2018-07-09 17:15:07 +02:00
SC Lee 3a41febb1c charon-nm: Parse any type of private key in need_secrets
Previously, when the user supplied an ECDSA key for public key authentication,
the user was always asked to provide a password, even if the key was not
encrypted.

Related: 954f73ea6e ("charon-nm: Parse any type of private key not only RSA")
Closes strongswan/strongswan#108.
2018-07-09 12:21:43 +02:00
Tobias Brunner c798b94a43 kernel-pfkey: Add support for native ChaCha20/Poly1305 on macOS 2018-07-06 10:25:56 +02:00
Ruben Tytgat e2b8c7e6ed kernel-pfkey: Enable macOS native AES_GCM_ICV16 support
macOS supports AES_GCM_ICV16 natively using PF_KEYv2.

This change enables AES_GCM if the corresponding definition is detected
in the headers.

With this change it is no longer necessary to use the libipsec module to
use AES_GCM on macOS.

Closes strongswan/strongswan#107.
2018-07-06 10:25:55 +02:00
Tobias Brunner df411bfa30 testing: The dhcp plugin uses the DHCP client port again by default
This reverts parts of commit becf027cd9.

Fixes: 707b70725a ("dhcp: Only use DHCP server port if explicitly configured")
2018-07-05 18:14:54 +02:00
Tobias Brunner 4802a7477f android: New release after fixing EAP-PEAP issue and Autofill crash 2018-07-04 20:02:23 +02:00
Tobias Brunner ba9255b358 Revert "android: Enable the eap-ttls and eap-peap plugins"
This reverts commit 064c97afae.

We have to make this optional and more configurable.  It seems some
commercial VPN providers use self-signed certificates for their AAA
servers.
2018-07-04 19:36:50 +02:00
Tobias Brunner b2363b3678 android: Move hint from TextInputEditText to TextInputLayout
This avoids a NullPointerException on Android 8 related to the optional
Autofill functionality.  The bug has been fixed in Android 8.1 [1] but there
is no fix for Android 8.

[1] https://issuetracker.google.com/issues/67675432
2018-07-04 11:52:32 +02:00
Tobias Brunner 485d202adc android: Don't enforce the server address as AAA identity for EAP-PEAP/TTLS
This is similar to EAP-TLS.  We could probably make this configurable
later.
2018-07-04 11:52:23 +02:00
Tobias Brunner 07237f94e2 android: New release after fixing cancelling connecting on older systems 2018-07-03 15:44:36 +02:00
Tobias Brunner 4e905b96dd android: Poll dropper TUN device for data on older Android systems
It seems that even the NIO version of read() is uninterruptible on
platforms < Android 7 (24).
2018-07-03 15:35:29 +02:00
Tobias Brunner 6ca381be05 Merge branch 'android-updates'
Lots of new features, e.g. Quick Settings tile, Always-on VPN, error
recovery, and lots of improvements under the hood.
2018-07-03 12:15:52 +02:00
Tobias Brunner abb4a4c825 android: New version after adding lots of new features 2018-07-03 11:38:46 +02:00
Tobias Brunner 9e05f219fd android: Use ListView for log messages
This is hopefully a bit more efficient for large log files than the previous
single TextView.  The ListView widget also provides an auto-scroll mechanism.
2018-07-03 11:31:44 +02:00
Tobias Brunner 3f71118b08 android: Simplify error handling in VPN state fragment
Always reset the error state when disconnecting via state service. This
way the error state is also cleared when the connection is terminated
directly via control activity.
2018-07-03 11:31:44 +02:00
Tobias Brunner 00a9ff4085 android: Remove MIME type filter when importing trusted certificates
This way we should see files even if the MIME type has not been set
correctly while downloading it.
2018-07-03 11:31:44 +02:00
Tobias Brunner 27cf3e666e android: Show date/thread prefix in log view if we have enough space
This is the case for tablets or even phones in landscape orientation.
600dp is the breaking point for small tablets according to Google's
docs.
2018-07-03 11:31:44 +02:00
Tobias Brunner 19c95c9bc4 android: Change log message when initializing the native code and add a divider
We don't really start a daemon and the divider should make it easier to
identify retries.
2018-07-03 11:31:44 +02:00
Tobias Brunner ef0f0cc839 android: Don't use infinite keying tries on Android 5+
This way we get some feedback about the issue in the GUI (otherwise it
would just switch to connecting state) and also some delays between retries.
2018-07-03 11:31:43 +02:00
Tobias Brunner a2b3122865 android: Allow explicit termination of a profile without confirmation 2018-07-03 11:31:43 +02:00
Tobias Brunner baf2f47413 android: Handle restarts of the control Activity better
For instance, rotating a device will restart it and this previously
could have started the wrong profile or shown the system's VPN
confirmation dialog twice.
2018-07-03 11:31:43 +02:00
Tobias Brunner 4db3bf0cb0 android: Properly handle pressing home when VPN confirmation dialog is shown
As documented, onActivityResult() is called right before onResume() when
the activity is reactivated.  However, if the system's VPN confirmation
dialog is shown and the home button is pressed, the activity is stopped
and not just paused, so its state is saved.  And onActivityResult() is
actually also called before onStart().  This means that no fragment
transactions may be committed (i.e. no dialog may be shown) when the
activity is later restarted (e.g. because there is another attempt to
connect the VPN) until onStart() has been called.  So if we'd try to show
the error dialog in onActivityResult() after returning to the launcher
it would result in an IllegalStateException.

However, showing the dialog for the previous confirmation dialog is not
ideal anyway, so we just ignore that result.
2018-07-03 11:31:43 +02:00
Tobias Brunner b1b626a1e3 android: Crudely catch exception if no file browser is available
Seen on Android TV in the emulator.
2018-07-03 11:31:43 +02:00
Tobias Brunner 064c97afae android: Enable the eap-ttls and eap-peap plugins 2018-07-03 11:31:43 +02:00
Tobias Brunner 6f9b96acb4 android: Pass UUID to VPN service to initiate profiles 2018-07-03 11:31:42 +02:00
Tobias Brunner 163f752022 android: Remove Suite B ESP proposals and reorder some algorithms 2018-07-03 11:31:42 +02:00
Tobias Brunner 058fe95339 android: Make RSA/PSS flag configurable in the GUI 2018-07-03 11:31:42 +02:00
Tobias Brunner 079094df18 android: Import RSA/PSS flag 2018-07-03 11:31:42 +02:00
Tobias Brunner 205ec47ddb android: Add flag to enable RSA/PSS 2018-07-03 11:31:42 +02:00
Tobias Brunner ad2d20e5f0 android: Make fetching OCSP/CRL interruptible
This allows cancelling connecting if e.g. the OCSP server is not
reachable. Previously this caused some delay in disconnecting state but
even worse it cause an ANR if the user tried reconnecting during that
time as the main thread would get struck in setNextProfile() (we could
probably find a better solution there too in the future).
2018-07-03 11:31:41 +02:00
Tobias Brunner 8a09350f9f android: Make CRL/OCSP/strict flags configurable in the GUI 2018-07-03 11:31:41 +02:00
Tobias Brunner e1e6096b31 android: Import CRL/OCSP/strict flags 2018-07-03 11:31:41 +02:00
Tobias Brunner 81bace09a4 android: Fix import of certificate request flag 2018-07-03 11:31:40 +02:00
Tobias Brunner a706058118 android: Add flags to control CRL/OCSP fetching and strict revocation 2018-07-03 11:31:40 +02:00
Tobias Brunner 0e2a6c46e9 revocation: Support en-/disabling CRL/OCSP at runtime 2018-07-03 11:31:40 +02:00
Tobias Brunner 3eda52f039 android: Use activity when reconnecting without (or a possibly wrong) password 2018-07-03 11:31:40 +02:00
Tobias Brunner 5bdb800abf android: Use startForegroundService() to start VpnService
This gives us some time to call startForeground() so we don't get
terminated.
2018-07-03 11:31:40 +02:00
Tobias Brunner fe1f143277 android: Install a blocking TUN device until the VPN is established
It's reinstalled when reconnecting (or during error recovery) and
eventually uninstalled after disconnecting.

Only on Android 5+, otherwise we'd block our fetcher (and Android 4.4 is
stupid in regards to overlapping TUN devices anyway).

Note that Android 8's blocking feature blocks everything that passes by
the VPN, so this only works when tunneling everything (i.e. neither subnets,
nor apps can be excluded from the VPN if that feature is enabled).
2018-07-03 11:31:39 +02:00
Tobias Brunner 99cc2d82d4 android: Exclude our own app from the VPN
Otherwise, a blocking VPN interface would prevent our fetcher from working
as we currently rely on an interface that doesn't allow access to the
underlying socket/FD, which would be required to call VpnService.protect().
2018-07-03 11:31:39 +02:00
Tobias Brunner fb3772ec95 android: Log retries to the same log file
It's cleared when a new connection is started or there is a manual
retry.
2018-07-03 11:31:39 +02:00
Tobias Brunner 1350ee1ec7 android: Use capped exponential backoff for automatic retries 2018-07-03 11:31:39 +02:00
Tobias Brunner 2ec6ad71d3 android: Show countdown and retry button in notification 2018-07-03 11:31:39 +02:00
Tobias Brunner 0d9dd4b150 android: Avoid IllegalStateException in state fragments
This happened if the state service got connected while such a fragment was
not visible (anymore or at all).
2018-07-03 11:31:38 +02:00
Tobias Brunner bc52868173 android: Don't hide the notification if we are connecting to a profile
In particular, if we are reconnecting after an error.
2018-07-03 11:31:38 +02:00
Tobias Brunner 68afdd3464 android: Add an automatic reconnect on errors
This way the connection will be attempted to be kept up even on "fatal"
errors like authentication failures.
2018-07-03 11:31:38 +02:00
Tobias Brunner 89a88d7c56 ike-sa-manager: Fix races when changing initiator SPI of an IKE_SA
Removing and readding the entry to a potentially different row/segment,
while driving out waiting and new threads, could prevent threads from
acquiring the SA even if they were waiting to check it out by unique
ID (which doesn't change), or if they were just trying to enumerate it.
With this change the row and segment doesn't change anymore and waiting
threads may acquire the SA. However, those looking for an IKE_SA by SPIs
might get one back that has a different SPI (but that's probably not
something that happens very often this early).

This was noticed because we check out SAs by unique ID in the Android
app to terminate them after failed retransmits if we are not reestablishing
the SA (otherwise we continue), and this sometimes failed.

Fixes: eaedcf8c00 ("ike-sa-manager: Add method to change the initiator SPI of an IKE_SA")
2018-07-03 11:31:38 +02:00
Tobias Brunner f23b107857 android: Show a retry button in the error banner
The button to view the log is now below the status info.  And since the
IMC results are just below that we don't need a special handling for
that anymore.
2018-07-03 11:31:38 +02:00
Tobias Brunner 063230c27b android: Add function to quickly reconnect the current profile 2018-07-03 11:31:37 +02:00
Tobias Brunner a5f565646a android: Use Java 8 features 2018-07-03 11:31:37 +02:00
Tobias Brunner ab5dbbc4ab android: Show an error if client certificate is unavailable
This can happen on systems (e.g. Android 7.x) where Always-on VPNs are
triggered right after booting before the KeyChain is unlocked by the user.
Retrieving the certificate chain or private key then fails with
"KeyChainException: IllegalStateException: keystore is LOCKED" until the
user unlocks the screen once.

The built-in client actually also fails in this situation (e.g. with XAuth
RSA), it tries three times then stops and shows an error notification.
2018-07-03 11:31:37 +02:00
Tobias Brunner f0b3e303c4 android: Show an error if a profile without a password is initiated
This could happen if an incomplete profile is used with Always-on VPN.
2018-07-03 11:31:37 +02:00
Tobias Brunner e145a5e66d android: Use modern shortcuts on Android 8+ 2018-07-03 11:31:37 +02:00
Tobias Brunner 5b6a0a3f9e android: Add an adaptive launcher icon
Using <inset> in a mipmap folder apparently is not fully valid, at least
Android Studio complains about it (it seems to work fine, though).
2018-07-03 11:31:36 +02:00
Tobias Brunner a7d679ff1b android: Show the actual error description in the notification 2018-07-03 11:31:36 +02:00
Tobias Brunner c353734f47 android: Change format for error strings
Place the dot in the main message not the descriptions of the individual
errors.
2018-07-03 11:31:36 +02:00
Tobias Brunner 4dbe7ffa3e android: Collapse Quick Settings drawer if password entry is required 2018-07-03 11:31:36 +02:00
Tobias Brunner 56f599560c android: Initiate configured default profile when triggered as Always-on VPN
With Android 8.1 this isn't triggered after a reboot until the device
has been unlocked once (solving the issue with the key store) and traffic
may optionally be blocked by the user until the VPN is established.

There are still some issues (e.g. password prompts and fatal errors), and we
might need some workaround for older Android releases.
2018-07-03 11:31:36 +02:00
Tobias Brunner d56f1bf832 android: Just reconnect if the tile is clicked even if there was an error
A long press click on the tile (or a click on the notification) will open
the main activity if more information about the error are necessary.
2018-07-03 11:31:35 +02:00
Tobias Brunner be89310784 android: Allow reconnecting without confirmation in case of an error 2018-07-03 11:31:35 +02:00
Tobias Brunner 6987ddb313 android: Show connection errors as banner, not as modal dialog 2018-07-03 11:31:35 +02:00
Tobias Brunner 64b7a6d622 android: Add Quick Settings tile to toggle VPN state
Only if there is no currently active (or previously active) profile does
this currently operate on the configured (or stored most recently used)
profile.  This way it's possible to use a different connection and
quickly disable and re-enable it again.  When unlocked the profile name
is shown, when locked a generic text is used (this detection doesn't seem
to work 100% reliably).  To disconnect, the user is forced to unlock the
device, connecting is possible without, if the credentials are available
and no fatal error occurs (it even works with the system credential store,
at least on Android 8.1).

Note that the tile is not available right after a reboot.  It seems that
the system has to be unlocked once to activate third-party tiles (will
be interesting to see how this works together with Always-on VPN).
2018-07-03 11:31:35 +02:00
Tobias Brunner 08c79d5112 android: Store the ID of the most recently used profile as preference 2018-07-03 11:31:35 +02:00
Tobias Brunner acdac14818 android: Add settings activity and default profile selection
The default profile can then be used for a Quick Settings tile or the
Always-on VPN feature.
2018-07-03 11:31:34 +02:00
Tobias Brunner 6e73a939a9 android: Reset error state after user confirmed it
This allows other listeners to change their display.
2018-07-03 11:31:34 +02:00
Tobias Brunner 52aaffdeb4 android: Use specific icon when connecting to the VPN 2018-07-03 11:31:34 +02:00
Tobias Brunner 70d6a0cf33 android: Use a handler to show/remove notification from main UI thread
This avoids races that were previously seen (e.g. when disconnecting
while connecting, which sometimes showed a "Disconnecting..."
notification).
2018-07-03 11:31:34 +02:00
Tobias Brunner 58d139dad3 android: Use separate activity to control VPN connections
This way we don't have to open the main window, but only show a dialog
if necessary (or nothing in many cases).
2018-07-03 11:31:34 +02:00
Tobias Brunner 1d336cc2ae android: Migrate onAttach() from deprecated version 2018-07-03 11:31:33 +02:00
Tobias Brunner 4671f023c3 android: Make certificate import activity properly transparent 2018-07-03 11:31:33 +02:00
Tobias Brunner d390d97da4 android: Remove deprecated progress indicator in MainActivity
Support for this was already removed with API level 21. On modern
devices loading CA certs should be quick enough anyway.
2018-07-03 11:31:33 +02:00
Tobias Brunner ed9d5a314c android: Replace deprecated ProgressDialog during profile import 2018-07-03 11:31:33 +02:00
Tobias Brunner 6ca0b46c20 android: Add notification channel for API level 26+
Unfortunately, setLockscreenVisibility() doesn't seem to have any
effect. So the full notification is shown unless the user manually
configures the notification settings.
2018-07-03 11:31:33 +02:00
Tobias Brunner 56dec924ec android: Set compile-/targetSdkVersion to 26
This allows us to add tiles to Quick Settings and enabling the Always-on
VPN feature in the VPN settings (both require API level 24, but 26 will
be required as targetSdkVersion later this year).
2018-07-03 11:31:33 +02:00
Tobias Brunner 71f4a20aa1 android: Show profile ID at bottom of advanced settings
Can be selected and copied to the clipboard to use in automation
software that doesn't support the shortcut.
2018-07-03 11:31:32 +02:00
Tobias Brunner 93033728a9 android: Accept a profile's UUID when initiating 2018-07-03 11:31:32 +02:00
Tobias Brunner 581f4326d5 android: Add additional Intent filter for import Activity with MIME type mask
Chrome creates such an Intent when opening downloaded files (not when
directly opening them), a MIME type is set, but apparently not ours.
2018-07-03 11:31:32 +02:00
Tobias Brunner 93489acc0d android: UUID is now mandatory
Unless there are profiles created with old versions of the app (< 1.8.0)
that were never updated since, all profiles should already have a UUID
assigned.  If not, we do that now with a DB migration.
2018-07-03 11:31:32 +02:00
Tobias Brunner 0917caa195 android: Show an error dialog if we can't get permission for VPNs
This is either because a third-party VPN app has the always-on feature
enabled, or because the user denied the permission in the system's confirmation
dialog.

If the always-on feature is enabled for a connection of the built-in VPN
client we get an IllegalStateException, for which we show an updated and
clearer error message.
2018-07-03 11:31:32 +02:00
Tobias Brunner 08601c58e9 android: Suppress self-assign warnings with clang
These are triggered by the little endian functions in byteorder.h.
2018-07-03 11:31:31 +02:00
Tobias Brunner 2afdb92dd0 atomics: Use type of destination in CAS implementation
The type of the value was incorrect (void**) if NULL was passed to cas_ptr()
as expected value, which caused a compiler warning with Clang because
__atomic_compare_exchange_n() expects the types of the first two arguments
to be the same.
2018-07-03 11:31:31 +02:00
Tobias Brunner 942599b623 atomics: Define HAVE_GCC_ATOMIC_OPERATIONS when building with clang
We should probably check for stdatomic.h and use the c11 functions if
available.
2018-07-03 11:31:31 +02:00
Tobias Brunner 929badfefd android: Build native libraries for all non-deprecated ABIs
armeabi has been superseded by armeabi-v7a and the MIPS ABIs were removed
with the latest NDK (r17), after being marked deprecated for a while.
By not specifying APP_ABI we build for all non-deprecated ABIs.
2018-07-03 11:31:31 +02:00
Tobias Brunner 4bb0a589ff android: Update Gradle plugin and wrapper 2018-07-03 11:31:31 +02:00
Tobias Brunner b68a0adace ike: Include length of reassembled IKE message in log message
Also simplify wording a bit when fragmenting.
2018-07-02 12:19:00 +02:00
Tobias Brunner 707b70725a dhcp: Only use DHCP server port if explicitly configured
If a DHCP server is running on the same host it isn't necessary to
bind the server port and might even cause conflicts.
2018-07-02 11:39:22 +02:00
Tobias Brunner 50c4c1bb40 kernel-pfkey: Avoid updating policies if nothing significant changed
The FreeBSD kernel doesn't update policies atomically, causing
unnecessary traffic loss during simple rekeyings.

Fixes #2677.
2018-07-02 10:17:04 +02:00
Tobias Brunner daa0a0cc1b settings: Fix compilation with newer versions of Clang
Depending on the actual va_list definition it's not valid to compare it
directly or assign NULL.
2018-06-29 11:47:26 +02:00
Tobias Brunner fecafaaca3 Merge branch 'ike-proposal-switch'
This allows switching the originally selected IKE config (based on the
IPs and IKE version) to a different one if no matching proposal is found.

This way we don't rely that much on the order of configs anymore and it's
possible to configure separate configs for clients that require weak
algorithms.
2018-06-28 18:47:15 +02:00
Tobias Brunner 1ecac75f37 testing: Fix IKE proposal in swanctl/net2net-gw scenario
Also simplify config by using references.
2018-06-28 18:46:42 +02:00
Tobias Brunner 187a01cc9f backend-manager: Change how IKE/peer config matches are logged
Instead of logging the search parameters for IKE configs (which were already
before starting the lookup) we log the configured settings.

The peer config lookup is also changed slightly by doing the IKE config
match first and skipping some checks if that or the local peer identity
doesn't match.
2018-06-28 18:46:42 +02:00
Tobias Brunner 2ad1df9571 Replace 'inacceptable' with the more common 'unacceptable' 2018-06-28 18:46:42 +02:00
Tobias Brunner 84cdfbc9bc child-cfg: Allow suppressing log messages when selecting traffic selectors
Although being already logged on level 2, these messages are usually just
confusing if they pop up randomly in the log when e.g. querying the configs
or installing traps.  So after this the log messages will only be logged when
actually proposing or selecting traffic selectors during IKE.
2018-06-28 18:46:42 +02:00
Tobias Brunner 054ee5e7c0 ike-init: Switch to an alternative config if proposals don't match
This way we don't rely on the order of equally matching configs as
heavily anymore (which is actually tricky in vici) and this also doesn't
require repeating weak algorithms in all configs that might potentially be
selected if there are some clients that require them.

There is currently no ordering, so an explicitly configured exactly matching
proposal isn't a better match than e.g. the default proposal that also
contains the proposed algorithms.
2018-06-28 18:46:42 +02:00
Tobias Brunner da288a07aa ike-auth: Consider negotiated IKE proposal when selecting peer configs
In some scenarios we might find multiple usable peer configs with different
IKE proposals.  This is a problem if we use a config with non-matching
proposals that later causes IKE rekeying to fail.  It might even be a problem
already when creating the CHILD_SA if the proposals of IKE and CHILD_SA
are consistent.
2018-06-28 18:46:41 +02:00
Tobias Brunner 29e7fe63c3 ike-cfg: Add method to check if config contains matching proposal
This way we can check whether the config should be considered or not if
we have a selected proposal.
2018-06-28 18:46:41 +02:00
Tobias Brunner f72aa13a29 proposal: Add method to check if two proposals match
Similar to select() but does not return a proposal and does not log
anything.
2018-06-28 18:46:41 +02:00
Tobias Brunner 90f5fe1ca9 child-cfg: Log the selected proposal on level 1 2018-06-28 16:53:35 +02:00
Tobias Brunner 4d338b9acf ike-cfg: Log the selected proposal on level 1 2018-06-28 16:53:35 +02:00
Tobias Brunner aa4f0c44ee backend-manager: Add enumerator over all matching IKE configs 2018-06-28 16:53:35 +02:00
Tobias Brunner 82e237c04e backend-manager: Simplify sorting peer configs 2018-06-28 16:53:35 +02:00
Tobias Brunner 80c9ae4521 testing: Add wrapper for systemctl to collect leaks from charon-systemd
Similar to the wrapper around `service` added with 71d59af58a, this
sets the variable only when running the automated tests.
2018-06-28 16:45:54 +02:00
Tobias Brunner 3d021f5b06 Merge branch 'settings-references'
This adds the ability to reference existing sections to the settings parser.
Mainly for swanctl.conf, where this could simplify complex configs a lot
as redundant information has only to be specified once and may then be
included in other sections (there is an example in the man page and
there are some in the unit tests).

Also added is a new setting in filelog sections to specify the path of
the log file (in case it contains characters that are not allowed in section
names). We should encourage people to configure their log files that way
which might allow use to prohibit dots in section names in the future.
2018-06-27 14:34:57 +02:00
Tobias Brunner b9745618cd daemon: Allow configuration of logfile path as value
Some characters are not allowed in section names, this way they can
still be used in paths of log files.
2018-06-27 14:19:35 +02:00
Tobias Brunner 61c3870bef conf: Document reference syntax 2018-06-27 14:19:35 +02:00
Tobias Brunner 089d5f9765 settings: Properly lock when extending sections or adding fallbacks
There was a potential chance for a race condition if the ensured section
was purged for some reason before using it later.

This also changes the behavior for NULL/empty strings via load_string*
with merge == FALSE, which now purges the config/section.
2018-06-27 14:19:35 +02:00
Tobias Brunner ca3c7b7ea6 settings-test: Add option to use the frontend to display the settings
This resolves references and redefined values. It currently doesn't work
properly if section names contain dots.
2018-06-27 14:19:35 +02:00
Tobias Brunner 35ca6a7b2f settings: Add reference feature
Similar to the `also` keyword in ipsec.conf, the new syntax allows adding
one or more references to other sections, which means all the settings and
subsections defined there are inherited (values may be overridden, even
with an empty value to clear it).

It's important to note that all subsections are inherited, so if this is
used to reference a connection in swanctl.conf all auth rounds and
children are inherited.  There is currently no syntax to limit the
inclusion level or clear inherited sections (but as mentioned, settings
in those inherited sections may be overridden).

Another property is that inherited settings or sections always follow
explicitly defined entries in the current section when they are enumerated.
This is relevant if the order is important (e.g. for auth rounds if `round`
is not specified).

References are evaluated dynamically at runtime, so referring to
sections later in the config file or included via other files is no
problem.

The colon used as separator to reference other sections may be used in
section names by writing :: (e.g. for Windows log file paths).

This is based on a patch originally written in 2016.
2018-06-27 14:19:35 +02:00
Tobias Brunner 0ca0fa71c0 charon-systemd: Register journal logger as custom logger
This way we get early log messages during plugin loading (including
integrity check results).

Instead of the fallback we could also remove the `customlog` namespace,
which was added to avoid conflicts with other settings/sections.
2018-06-26 15:24:42 +02:00
Tobias Brunner 2c02b02589 linked-list: Order of insert_before/remove_at calls doesn't matter anymore
This was quite confusing previously:  While calling insert_before()
and then remove_at() properly replaced the current item, calling them the
other way around inserted the new item before the previous item because
remove_at() changed the enumerator's position to the previous item.

The behavior in corner cases (calling the methods before or after
enumeration) is also changed slightly.
2018-06-26 15:11:02 +02:00
Tobias Brunner 91640baf6d vici: Maintain connection order when replacing one 2018-06-26 15:10:40 +02:00
Tobias Brunner 57447015db eap-radius: Document station_id_with_port option 2018-06-25 10:42:17 +02:00
Andreas Steffen 5b91e8c03c Version bump to 5.7.0dr4 2018-06-22 11:21:02 +02:00
Andreas Steffen ef4a63524f vici: list cert_policy parameter 2018-06-22 10:39:40 +02:00
Andreas Steffen 424de401b4 testing: Added swanctl/rw-ed25519-certpol scenario 2018-06-22 10:39:40 +02:00
Tobias Brunner 3a05566d0e ike-mobike: Always use this task for DPDs even if not behind a NAT
This allows switching to probing mode if the client is on a public IP
and this is the active task and connectivity gets restored.  We only add
NAT-D payloads if we are currently behind a NAT (to detect changed NAT
mappings), a MOBIKE update that might follow will add them in case we
move behind a NAT.
2018-06-22 09:20:30 +02:00
Tobias Brunner 35e49ffd2f unit-tests: Add mock implementation of kernel_net_t
This is required for DPDs via ike-mobike task to work (it does a source
address lookup).
2018-06-22 09:20:30 +02:00
Andreas Steffen daf8ed210a vici: Fixed crash when parsing cert_policy parameter 2018-06-22 08:52:09 +02:00
Andreas Steffen 782344e5e5 libimcv: Prevent integer overflow in time conversion 2018-06-18 11:04:53 +02:00
Andreas Steffen 711e0bdbe4 Version bumpt to 5.7.0dr3 2018-06-14 17:07:59 +02:00
Andreas Steffen 97688e8567 libtpmtss: Query maximum TPM data transmission size 2018-06-14 15:47:27 +02:00
Tobias Brunner 5cfd7311d0 testing: Print command output if test fails
This is quite helpful to debug why a pattern didn't match.

As it could produce quite a lot of output if something is not found in a
log file, the complete output is only printed in verbose mode, otherwise,
`head` is used to print the first 10 lines of output.

We only get stdout from SSH, so the stderr redirection is only really
for errors ssh itself produces.
2018-06-14 09:29:26 +02:00
Andreas Steffen 60719e39bf testing: Fixed evaltest of tnc/tnccs-20-pdp-pt-tls scenario 2018-06-13 17:57:10 +02:00
Andreas Steffen 78584d7efc Version bump to 5.7.0dr2 2018-06-13 17:07:58 +02:00
Andreas Steffen 295493f46f testing: Renewed ECDSA certificates 2018-06-13 17:07:25 +02:00
Andreas Steffen 96b1f0b79d Merge branch 'swima-reserved' 2018-06-12 21:49:54 +02:00
Andreas Steffen 2a26566ed3 libimcv: Implementation of RFC 8412 SWIMA 2018-06-12 21:47:40 +02:00
Andreas Steffen 27ec213d0b libimcv: Added reserved field in SWIMA Inventory encoding 2018-06-12 21:47:40 +02:00
Andreas Steffen 75181f4836 fuzz: Added PB-TNC fuzzer 2018-06-12 21:47:40 +02:00
Andreas Steffen cd6e45817e libimcv: Fixed processing of PTS Request File Metadata 2018-06-12 21:47:39 +02:00
Andreas Steffen 0a3c89a053 libimcv: Removed whitespace 2018-06-12 21:47:39 +02:00
Andreas Steffen 66b9287cd5 libimcv: Fixed processing of PTS Simple Component Evidence 2018-06-12 21:47:39 +02:00
Andreas Steffen e1833a90ba bio_reader: Fix read_uint24 2018-06-12 21:47:39 +02:00
Andreas Steffen 508b308768 fuzz: Added PA-TNC fuzzer 2018-06-12 21:47:39 +02:00
Andreas Steffen ce4b8f65d6 testing: Removed TCG SWID IMC/IMV scenarios 2018-06-12 21:47:39 +02:00
Andreas Steffen a31f9b7691 libimcv: Removed TCG SWID IMC/IMV support 2018-06-12 21:47:39 +02:00
Andreas Steffen eccd2b6e09 libimcv: SWIMA SW locator must be file URI 2018-06-12 17:53:06 +02:00
Andreas Steffen 0b445a5c54 libimcv: Updated IANA numbers assigned to SWIMA 2018-06-12 17:53:06 +02:00
Micah Morton 4f1d2f2b09 Allow charon to change group on files before dropping caps
Allow charon to start as a non-root user without CAP_CHOWN and still be
able to change the group on files that need to be accessed by charon
after capabilities have been dropped. This requires the user charon starts
as to have access to socket/pidfile directory as well as belong to the
group that charon will run as after dropping capabilities.

Closes strongswan/strongswan#105.
2018-06-12 10:25:30 +02:00
Markus Sattler 1331010aa4 starter: Reset action before handling it
Stater will lose update/reload commands when there is a second signal
coming in when the previous is still processed. This can happen more
easily with big configurations.

Closes strongswan/strongswan#101.
2018-06-05 10:13:22 +02:00
Andreas Steffen 3a8a9c7029 Version bump to 5.7.0dr1 2018-05-30 23:02:57 +02:00
Andreas Steffen 6d087b33de libstrongswan: xmppaddr prefix designates an xmppAddr otherName ID type 2018-05-30 17:25:28 +02:00
Andreas Steffen b2ab0995c1 Version bump to 5.6.3 2018-05-28 15:38:58 +02:00
Tobias Brunner 64f7fd92c0 NEWS: Add info about CVE-2018-10811 2018-05-24 15:52:06 +02:00
Tobias Brunner 6d8a57342b ikev2: Initialize variable in case set_key() or allocate_bytes() fails
In case the PRF's set_key() or allocate_bytes() method failed, skeyseed
was not initialized and the chunk_clear() call later caused a crash.

This could have happened with OpenSSL in FIPS mode when MD5 was
negotiated (and test vectors were not checked, in which case the PRF
couldn't be instantiated as the test vectors would have failed).
MD5 is not included in the default proposal anymore since 5.6.1, so
with recent versions this could only happen with configs that are not
valid in FIPS mode anyway.

Fixes: CVE-2018-10811
2018-05-24 15:45:08 +02:00
Tobias Brunner 0d0c8f7d3e NEWS: Some minor updates 2018-05-24 12:18:18 +02:00
Tobias Brunner 2c7a4b0704 swanctl: Document new HW offload options/behavior 2018-05-24 10:49:19 +02:00
Andreas Steffen 88205674e5 Version bump to 5.6.3rc1 2018-05-23 22:36:39 +02:00
Tobias Brunner 7f14fefff4 NEWS: Added some news for 5.6.3 2018-05-23 20:25:50 +02:00
Tobias Brunner 887885f33b sw-collector: Proper cleanup if DB query fails in check operation 2018-05-23 20:25:50 +02:00
Tobias Brunner d837d0b339 kernel-netlink: Use strncpy to copy interface name when configuring HW offload 2018-05-23 20:25:49 +02:00
Tobias Brunner 89bd016ef4 Fixed some typos, courtesy of codespell 2018-05-23 16:33:02 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner 740133b12d settings: Parse assigned values in a different context
This allows us to accept characters like = or { without having to use
quoted strings.  And we can also properly warn about unexpected quoted
strings.
2018-05-23 12:01:50 +02:00
Tobias Brunner f8c20fb1c2 settings: Support CRLF in settings parser 2018-05-23 12:01:45 +02:00
Andreas Steffen 26b45beda9 Version bump to 5.6.3dr2 2018-05-22 21:58:32 +02:00
Tobias Brunner e6d17d5613 man: Remove keylife/rekeymargin from ipsec.conf man page
We continue to parse them but remove the documentation because mixing the two
sets of keywords in the same config might result in unexpected behavior.

References #2663.
2018-05-22 14:18:17 +02:00
Tobias Brunner b5461c63d9 Merge branch 'ikesa-force-destroy'
Adds new options to force the local destruction of an IKE_SA (after
trying to send a DELETE first).  This might be useful in situations where
it's known the other end is not reachable or already deleted the IKE_SA so
there is no point in retransmitting the DELETE and waiting for a response.
2018-05-22 10:13:59 +02:00
Tobias Brunner c057cd26fa swanctl: Add option to force IKE_SA termination 2018-05-22 10:06:07 +02:00
Tobias Brunner 0bcfed1aa2 vici: Optionally terminate IKE_SA immediately 2018-05-22 10:06:07 +02:00
Tobias Brunner 7b72909774 controller: Add option to force destruction of an IKE_SA
It's optionally possible to wait for a timeout to destroy the SA.
2018-05-22 10:06:07 +02:00
Tobias Brunner a79d510354 ike-sa: Add option to force the destruction of an IKE_SA after initiating a delete 2018-05-22 10:06:07 +02:00
Martin Willi c58434aeff proposal: Add a compat alg for ChaCha20Poly1305 with explicit key length
The keylength fix for ChaCha20Poly1305 (5a7b0be2) removes the keylength
attribute from the AEAD transform. This breaks compatibility between
versions with the patch and those without. The ChaCha20Poly1305 AEAD
won't match in proposals between such versions, and if no other algorithm
is available, negotiating SAs fails.

As a migration strategy, this patch introduces a new string identifier for a
ChaCha20Poly1305 proposal keyword which uses the explicit keylength, exactly
as it was used before the mentioned patch. Administrators that care about
the use of that AEAD with old clients can temporarily add this keyword to
the list of proposals, until all clients have been upgraded.

The used approach is the least invasive, as it just adds an additional
keyword that can't do any harm if not explicitly configured. Nontheless
allows it the administrator to smoothly keep ChaCha20Poly1305 working,
even if upgrading all peers simultaneously is not an option. It requires
manual configuration edits, though, but we assume that ChaCha20Poly1305
is not that widely used, and not as the only transform in proposals.

Removing the compat keyword in a future version is an option; it might
be helpful for other implementations, though, that falsely use an
explicit key length in ChaCha20Poly1305 AEAD transforms.
2018-05-22 10:05:22 +02:00
Tobias Brunner 10b8acb554 kernel-netlink: Change how routes are un-/installed
We now check if there are other routes tracked for the same destination
and replace the installed route instead of just removing it.  Same during
installation, where we previously didn't replace existing routes due to
NLM_F_EXCL.  Routes with virtual IPs as source address are preferred over
routes without.

This should allow using trap policies with virtual IPs on Linux.

Fixes #85, #2162.
2018-05-22 10:04:24 +02:00
Tobias Brunner 3f003e5e21 Merge branch 'cert-chain-fixes'
This fixes several issues that came up via BSI's Certification Path
Validation Test Tool (CPT):

 1) In compliance with RFC 4945, section 5.1.3.2, we now enforce that a
    certificate used for IKE authentication either does not contain a keyUsage
    extension (like the ones produced by pki --issue) or that they include
    digitalSignature or nonRepudiation.

 2) CRLs that are not yet valid are now rejected as that could be a
    problem in scenarios where expired certificates are removed from CRLs and
    the clock on the host doing the revocation check is trailing behind that
    of the host issuing CRLs.

 3) Results other than revocation (e.g. a skipped check because the CRL
    couldn't be fetched) are now stored also for intermediate CA certificates
    and not only for end-entity certificates, so a strict CRL policy can be
    enforced in such cases.
2018-05-22 09:52:08 +02:00
Tobias Brunner 9746c308ff testing: Add ikev2/multi-level-ca-skipped scenario 2018-05-22 09:50:47 +02:00
Tobias Brunner 0cf3549675 revocation: Fix memory leak if fetching CRL/OCSP fails
We might get a 404 error page back.
2018-05-22 09:50:47 +02:00
Tobias Brunner cae43b890a revocation: Set defaults if CRL/OCSP checking is disabled in config 2018-05-22 09:50:47 +02:00
Tobias Brunner b00d3adbd1 revocation: Also store validation results for intermediate CA certificates
If the certificate is revoked, we immediately returned and the chain was
invalid, however, if we couldn't fetch the CRL that result was not stored
for intermediate CAs and we weren't able to enforce a strict CRL policy
later.
2018-05-22 09:50:47 +02:00
Tobias Brunner 13f76a241c revocation: Ignore CRLs that are not yet valid
Using such CRLs can be a problem if the clock on the host doing the
revocation check is trailing behind that of the host issuing CRLs in
scenarios where expired certificates are removed from CRLs.  As revoked
certificates that expired will then not be part of new CRLs a host with
trailing clock might still accept such a certificate if it is still
valid according to its system clock but is not contained anymore in the
not yet valid CRL.
2018-05-22 09:50:47 +02:00
Tobias Brunner 9c6b102ee0 openssl: Fail CRL validity check if thisUpdate is in the future 2018-05-22 09:50:47 +02:00
Tobias Brunner a0902d1ae0 x509: Fail CRL validity check if thisUpdate is in the future 2018-05-22 09:50:47 +02:00
Tobias Brunner 6143f926ef ike: Reject certificates that are not compliant with RFC 4945 2018-05-22 09:50:47 +02:00
Tobias Brunner 504e12326d openssl: Set IKE compliance flag depending on keyUsage 2018-05-22 09:50:47 +02:00
Tobias Brunner 920366e688 x509: Set IKE compliance flag depending on keyUsage 2018-05-22 09:50:47 +02:00
Tobias Brunner 9fcf4fdda1 x509: Add flag that marks compliance with RFC 4945
According to RFC 4945, section 5.1.3.2, a certificate for IKE must
either not contain the keyUsage extension, or, if it does, have at least
one of the digitalSignature or nonReputiation bits set.
2018-05-22 09:50:47 +02:00
Tobias Brunner 598096e7a2 Merge branch 'dhcp-fixes'
Fixes some issues in the dhcp plugin like avoiding ICMP port unreachables
when setting a specific server address, or increasing the maximum size for
options e.g. for DNs in the client identifier option. The latter is also
only sent now if identity_lease is enabled (for most DHCP servers it
serves the same function as a unique MAC address does).
2018-05-22 09:44:51 +02:00
Tobias Brunner 7b660944b6 dhcp: Only send client identifier if identity_lease is enabled
The client identifier serves as unique identifier just like a unique MAC
address would, so even with identity_leases disabled some DHCP servers
might assign unique leases per identity.
2018-05-18 18:04:01 +02:00
Tobias Brunner 0e5b94d038 dhcp: Increase maximum size of client identification option
This increases the chances that subject DNs that might have been cut
off with the arbitrary previous limit of 64 bytes might now be sent
successfully.

The REQUEST message has the most static overhead in terms of other
options (17 bytes) as compared to DISCOVER (5) and RELEASE (7).
Added to that are 3 bytes for the DHCP message type, which means we have
288 bytes left for the two options based on the client identity (host
name and client identification).  Since both contain the same value, a
FQDN identity, which causes a host name option to get added, may be
142 bytes long, other identities like subject DNs may be 255 bytes
long (the maximum for a DHCP option).
2018-05-18 18:04:01 +02:00
Tobias Brunner 30e886fe3b dhcp: Increase buffer size for options in DHCP messages
According to RFC 2131, the minimum size of the 'options' field is 312
bytes, including the 4 byte magic cookie.  There also does not seem to
be any restriction regarding the message length, previously the length
was rounded to a multiple of 64 bytes.  The latter might have been
because in BOOTP the options field (or rather vendor-specific area as it
was called back then) had a fixed length of 64 bytes (so max(optlen+4, 64)
might actually have been what was intended), but for DHCP the field is
explicitly variable length, so I don't think it's necessary to pad it.
2018-05-18 18:04:01 +02:00
Tobias Brunner 13edecdc20 dhcp: Reduce receive buffer size on send socket
Since we won't read from the socket reducing the receive buffer saves
some memory and it should also minimize the impact on other processes that
bind the same port (Linux distributes packets to the sockets round-robin).
2018-05-18 18:04:01 +02:00
Tobias Brunner becf027cd9 dhcp: Bind server port when a specific server address is specified
DHCP servers will respond to port 67 if giaddr is non-zero, which we set
if we are not broadcasting.  While such messages are received fine via
RAW socket the kernel will respond with an ICMP port unreachable if no
socket is bound to that port.  Instead of opening a dummy socket on port
67 just to avoid the ICMPs we can also just operate with a single
socket, bind it to port 67 and send our requests from that port.

Since SO_REUSEADDR behaves on Linux like SO_REUSEPORT does on other
systems we can bind that port even if a DHCP server is running on the
same host as the daemon (this might have to be adapted to make this work
on other systems, but due to the raw socket the plugin is not that portable
anyway).
2018-05-18 18:04:01 +02:00
Tobias Brunner e8b5c7b94e dhcp: Fix destination port check in packet filter
The previous code compared the port in the packet to the client port and, if
successful, checked it also against the server port, which, therefore, never
matched, but due to incorrect offsets did skip the BPF_JA.  If the client port
didn't match the code also skipped to the instruction after the BPF_JA.
However, the latter was incorrect also and processing would have continued at
the next instruction anyway.  Basically, DHCP packets to any port were accepted.

What's not fixed with this is that the kernel returns an ICMP Port
unreachable for packets sent to the server port (67) because we don't
have a socket bound to it.

Fixes: f0212e8837 ("Accept DHCP replies on bootps port, as we act as a relay agent if server address configured")
2018-05-18 18:04:01 +02:00
Matt Selsky 646a492538 dhcp: Fix typos in comments 2018-05-18 18:04:01 +02:00
Tobias Brunner 3594663166 eap-aka-3gpp: Add test vectors from 3GPP TS 35.207 14.0.0 2018-05-18 17:37:39 +02:00
Tobias Brunner 8dfc40fa20 appveyor: Also build on Windows Server 2016 2018-05-18 17:31:48 +02:00
Tobias Brunner 943f3929f4 pki: --verify command optionally takes directories for CAs and CRLs 2018-05-18 17:29:00 +02:00
Tobias Brunner 667e74d60a bliss: Fix compilation with non-GNU C libraries
Not even the glibc man page mentions that type.

Fixes #2638.
2018-05-14 15:51:42 +02:00
Micah Morton b9fcc61991 Allow strongSwan to be spawned as non-root user
This patch allows for giving strongSwan only the runtime capabilities it
needs, rather than full root privileges.

Adds preprocessor directives which allow strongSwan to be configured to
 1) start up as a non-root user
 2) avoid modprobe()'ing IPsec kernel modules into the kernel, which
    would normally require root or CAP_SYS_MODULE

Additionally, some small mods to charon/libstrongswan ensure that charon
fully supports starting as a non-root user.

Tested with strongSwan 5.5.3.
2018-05-14 15:50:01 +02:00
Tobias Brunner 0d2e18a189 nm: Update NEWS 2018-05-07 12:13:23 +02:00
Tobias Brunner 6e5c00b7c7 nm: Don't hardcode install path for .name file 2018-05-07 12:09:32 +02:00
Tobias Brunner 9c4e4b5e8e nm: Don't rely on NetworkManager.pc for paths when building without libnm-glib
Also make the paths configurable, in case the defaults don't work out on
a certain platform.
2018-05-07 12:09:32 +02:00
Andreas Steffen 43a1839cbc libimcv: Added inactive field to device database table 2018-04-27 12:42:29 +02:00
Andreas Steffen 234ec9225d sw-collector: Added --check option 2018-04-27 11:42:34 +02:00
Tobias Brunner 8929c700ef ikev1: Ignore roam events for IKEv1
We don't have MOBIKE and the fallback to reauthentication does also not
make much sense as that doesn't affect the CHILD_SAs for IKEv1.  So
instead of complicating the code we just ignore roam events for IKEv1
for now.

Closes strongswan/strongswan#100.
2018-04-27 11:13:17 +02:00
Tobias Brunner 4af1fd59dd thread: Properly clean up meta data of thread if pthread_create() fails 2018-04-19 18:22:15 +02:00
Andreas Steffen 69ee158e2a Version bump to 5.6.3dr1 2018-04-19 16:34:06 +02:00
Andreas Steffen 51d5b35f51 testing: Fixed ikev2/alg-chacha20poly1305 scenario 2018-04-19 16:33:04 +02:00
Tobias Brunner a747ad738c ike: Ignore rekeyed and deleted CHILD_SAs when reestablishing IKE_SAs 2018-04-12 16:32:47 +02:00
Tobias Brunner a1620c16ec ike: Remove special handling for routed CHILD_SAs during reauth/reestablish
These are managed in the trap manager, no trap policies will ever be
attached to an IKE_SA (might have been the case in very early releases).
2018-04-12 16:30:28 +02:00
Tobias Brunner 485952ff83 controller: Remove special handling for routed CHILD_SAs when terminating
In very early versions routed CHILD_SAs were attached to IKE_SAs, since
that's not the case anymore (they are handled via trap manager), we can
remove this special handling.
2018-04-12 16:30:28 +02:00
Tobias Brunner 5a7b0be294 proposal: Don't specify key length for ChaCha20/Poly1305
This algorithm uses a fixed-length key and we MUST NOT send a key length
attribute when proposing such algorithms.

While we could accept transforms with key length this would only work as
responder, as original initiator it wouldn't because we won't know if a
peer requires the key length.  And as exchange initiator (e.g. for
rekeyings), while being original responder, we'd have to go to great
lengths to store the condition and modify the sent proposal to patch in
the key length.  This doesn't seem worth it for only a partial fix.
This means, however, that ChaCha20/Poly1305 can't be used with previous
releases (5.3.3 an newer) that don't contain this fix.

Fixes #2614.

Fixes: 3232c0e64e ("Merge branch 'chapoly'")
2018-04-12 16:07:13 +02:00
Tobias Brunner b2163409cc ikev2: Reuse marks and reqid of CHILD_SAs during MBB reauthentication
Since these are installed overlapping (like during a rekeying) we have to use
the same (unique) marks (and possibly reqid) that were used previously,
otherwise, the policy installation will fail.

Fixes #2610.
2018-04-12 15:50:04 +02:00
Tobias Brunner 21553276a3 revocation: Make sure issuer of fetched CRL matches that of the certificate
Unless there is a cRLIssuer listed in the CDP, the CRL should be issued
by the same issuer as the checked certificate.

Fixes #2608.
2018-04-12 15:45:24 +02:00
Tobias Brunner 85bfab621d ike: Float to port 4500 if either port is 500
If the responder is behind a NAT that remaps the response from the
statically forwarded port 500 to a new external port (as Azure seems to be
doing) we should still switch to port 4500 if we used port 500 so far as
it would not have been possible to send any messages to it if it wasn't
really port 500 (we only add a non-ESP marker if neither port is 500).
2018-04-12 15:25:21 +02:00
Tobias Brunner ce0a770c74 Merge branch 'ikev1-down-reauth'
This triggers child_updown() if IKEv1 reauthentication fails due to
retransmits. The SA is also tried to be reestablished.

Fixes #2573.
2018-04-12 15:19:49 +02:00
Tobias Brunner 40ec7f998a _updown: Remove printf calls for identities
This was apparently for compatibility with pluto, which escaped some
characters as octal values.
2018-04-12 15:17:24 +02:00
Tobias Brunner eb82210620 ikev1: Trigger down events for CHILD_SAs if reauthentication failed due to retransmits 2018-04-12 15:17:24 +02:00
Tobias Brunner ebc6defa05 ikev1: Reestablish SAs if reauthentication failed due to retransmits 2018-04-12 15:17:24 +02:00
Tobias Brunner a36d8097ed traffic-selector: Always print protocol if either protocol or port is set
This helps to distinguish between port and protocol if only one of them
is set.  If no protocol is set it's printed as 0, if the traffic
selector covers any port (0-65535) the slash that separates the two values
and the port is omitted.
2018-04-11 12:31:31 +02:00
Tobias Brunner 73382f516e Merge branch 'child-deleted'
This adds a new state for CHILD_SAs that we deleted but still keep
around to process delayed packets (IKEv2 only).  This allows us to treat
them specially in some cases (e.g. to avoid triggering child_updown()
events as we already did that when we deleted such SAs).

Closes strongswan/strongswan#93.
2018-04-09 17:15:24 +02:00
Tobias Brunner 3a3136ef33 bus: Don't trigger child_updown for deleted CHILD_SAs
These were rekeyed but have not been destroyed yet.
2018-04-09 17:13:41 +02:00
Tobias Brunner 16898026a5 child-sa: Add new state to track deleted but not yet destroyed CHILD_SAs
This allows us to easily identify SAs we keep around after a rekeying to
process delayed packets.
2018-04-09 17:13:41 +02:00
Afschin Hormozdiary e873544080 ikev1: Unify child_updown calls when having duplicate QMs
If a Quick mode is initiated for a CHILD_SA that is already installed
we can identify this situation and rekey the already installed CHILD_SA.

Otherwise we end up with several CHILD_SAs in state INSTALLED which
means multiple calls of child_updown are done. Unfortunately,
the deduplication code later does not call child_updown() (so up and down
were not even).

Closes strongswan/strongswan#95.
2018-04-09 15:06:48 +02:00
Andreas Steffen 55cce124bf libtpmtss: Properly initialize tabrmd tcti_context 2018-04-09 11:07:20 +02:00
Matt Selsky c8f45e4573 testing: Fix typo in sysctl.conf file
Closes strongswan/strongswan#97.
2018-04-03 09:55:05 +02:00
robinleander 826b4232d3 pkcs11: Use unused return value of C_GetMechanismList
Closes strongswan/strongswan#96.
2018-03-29 17:18:27 +02:00
Tobias Brunner e811659323 kernel-pfkey: Add option to install routes via internal interface
On FreeBSD, enabling this selects the correct source IP when sending
packets from the gateway itself.
2018-03-21 10:37:49 +01:00
Tobias Brunner a4727a01a3 Merge branch 'hw-offload-auto'
This lets IPsec SA installation explicitly fail if HW offload is enabled
but either the kernel or the device don't support it.  And it adds a new
configuration mode 'auto', which enables HW offload, if supported, but
does not fail the installation otherwise.
2018-03-21 10:36:18 +01:00
Adi Nissim 8ced1570ab child-cfg: Make HW offload auto mode configurable
Until now the configuration available to user for HW offload were:
hw_offload = no
hw_offload = yes

With this commit users will be able to configure auto mode using:
hw_offload = auto

Signed-off-by: Adi Nissim <adin@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
2018-03-21 10:32:02 +01:00
Tobias Brunner ee26f7156f kernel-netlink: Cleanup and fix some HW offload code issues
Besides some style issues there were some incorrect allocations
for ethtool requests.
2018-03-21 10:29:57 +01:00
Adi Nissim 338cc5812e kernel-netlink: Add new automatic hw_offload mode
Until now there were 2 hw_offload modes: no/yes
* hw_offload = no  : Configure the SA without HW offload.
* hw_offload = yes : Configure the SA with HW offload.
                     In this case, if the device does not support
                     offloading, SA creation will fail.

This commit introduces a new mode: hw_offload = auto
----------------------------------------------------
If the device and kernel support HW offload, configure
the SA with HW offload, but do not fail SA creation otherwise.

Signed-off-by: Adi Nissim <adin@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
2018-03-21 10:28:44 +01:00
Adi Nissim aad9bd3613 ipsec-types: Create new enum hw_offload_t
Add the new enum in order to add HW offload auto mode.

Signed-off-by: Adi Nissim <adin@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
2018-03-21 10:27:38 +01:00
Martin Willi 3b29590b70 starter: Ignore an existing PID file if it references ourself 2018-03-21 10:25:49 +01:00
Martin Willi 83187f3883 charon-tkm: Ignore an existing PID file if it references ourself 2018-03-21 10:25:49 +01:00
Martin Willi 9655a3ffbc charon: Ignore an existing PID file if it references ourself
If a daemon PID file references the process that does the check, it is safe
to ignore it; no running process can have the same PID. While this is rather
unlikely to get restarted with the same PID under normal conditions, it is
quite common when running inside PID namespaced containers: If a container
gets stopped and restarted with a PID file remaining, it is very likely that
the PID namespace assigns the same PID to our service, as they are assigned
sequentially starting from 1.
2018-03-21 10:25:49 +01:00
Tobias Brunner a7005e435b diffie-hellman: Remove unused exponent length initialization in get_params()
This isn't used anymore since 46184b07c1 ("diffie-hellman: Explicitly
initialize DH exponent sizes during initialization").
2018-03-21 10:21:32 +01:00
Tobias Brunner 8b6f615741 diffie-hellman: Don't set exponent length for DH groups with prime order subgroups
According to RFC 5114 the exponent length for these groups should always equal
the size of their prime order subgroup.
This was handled correctly before the initialization was done during
library initialization.

Fixes: 46184b07c1 ("diffie-hellman: Explicitly initialize DH exponent sizes during initialization")
2018-03-21 10:21:32 +01:00
Tobias Brunner ee019ab321 proposal: Make sure non-AEAD IKE proposals contain integrity algorithms 2018-03-21 10:15:18 +01:00
Tobias Brunner 42a6b187f7 proposal: Compress arrays after removing transforms 2018-03-21 10:15:18 +01:00
Tobias Brunner a48f3d8939 ikev2: Use correct type to check for selected signature scheme
The previous code was obviously incorrect and caused strange side effects
depending on the compiler and its optimization flags (infinite looping seen
with GCC 4.8.4, segfault when destroying the private key in build() seen
with clang 4.0.0 on FreeBSD).

Fixes #2579.
2018-03-21 10:12:59 +01:00
Tobias Brunner 70d99d67d6 vici: Make sure to read all requested data from socket in Perl binding
Closes strongswan/strongswan#91.
2018-03-21 10:10:35 +01:00
Tobias Brunner d3b9db688a libimcv: Add Debian 8.10 to IMV database
References #2582.
2018-03-20 09:20:17 +01:00
Tobias Brunner 0acd1ab4d0 stroke: Ensure a minimum message length 2018-03-19 18:06:00 +01:00
Matus Fabian 04ede658c8 libipsec: Fix ip_packet_create_from_data() version field in IPv6 header
Closes strongswan/strongswan#92.

Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-03-19 11:01:10 +01:00
Tobias Brunner dc2dfedda9 testing: Use HA patch compatible with 4.15.6+ 2018-03-08 10:07:33 +01:00
Tobias Brunner 39e860ea34 testing: Use a HA patch that's actually compatible with 4.15 kernels 2018-03-07 17:16:54 +01:00
Tobias Brunner 0f785f6be8 testing: Revert typo fix in FreeRADIUS patch
Fixes: 2db6d5b8b3 ("Fixed some typos, courtesy of codespell")
Fixes #2582.
2018-03-07 16:39:37 +01:00
Tobias Brunner 53827a5fde load-tester: Start numbering IDs from 1 again
ref_get() increments the number before returning it.

Fixes: 2cbaa63295 ("load-tester: Fix race condition issuing same identity")
2018-03-07 15:41:56 +01:00
Tobias Brunner f71cccec6f Merge branch 'pbkdf2-sha2'
Adds support for common SHA-2 based PRFs in PKCS#5/PBKDF2 as used by
OpenSSL 1.1 when generating PKCS#8-encoded private keys.

Fixes #2574.
2018-03-07 15:24:56 +01:00
Tobias Brunner 954f73ea6e charon-nm: Parse any type of private key not only RSA 2018-03-07 15:23:03 +01:00
Tobias Brunner 5808467ed1 pkcs5: Parse PRF algorithms if given in PBKDF2-params as defined in RFC 8018
We can't use ASN1_DEF, which would technically be more correct, as the
ASN.1 parser currently can't handle that.  For algorithm identifiers we
often use ASN1_EOC as type (with ASN1_RAW), however, that doesn't work with
ASN1_DEF because the element is assumed missing if the type doesn't match.
On the other hand, we can't set the type to ASN1_SEQUENCE because then the
parser skips the following rule if the element is missing (it does so for
all constructed types, but I guess is mainly intended for context tags),
which in this case overruns the parser rules array.
2018-03-07 15:23:03 +01:00
Tobias Brunner e5c5792ff8 prf: Add helper function to convert OIDs to algorithm identifiers 2018-03-07 15:23:03 +01:00
Tobias Brunner ba16a95454 asn1: Add OIDs for HMAC-based PRFs as defined in RFC 8018 2018-03-07 15:23:03 +01:00
Tobias Brunner b53eb857bf Merge branch 'unknown-transform-types'
This changes how unknown transform types are handled in proposals.  In
particular we make sure not to accept a proposal if it contains unknown
transform types (they were just ignored previously, which could have
resulted in an invalid selected proposal).

Fixes #2557.
2018-03-07 14:25:48 +01:00
Tobias Brunner 6b8749ab18 proposal: Compare algorithms of all transform types for equality 2018-03-05 12:25:19 +01:00
Tobias Brunner 76c7c951e1 proposal: Make sure to consider all transform types when selecting proposals
This way there will be a mismatch if one of the proposals contains
transform types not contained in the other (the fix list of transform
types used previously resulted in a match if unknown transform types
were contained in one of the proposals).  Merging the sets of types
makes comparing proposals with optional transform types easier (e.g.
DH for ESP with MODP_NONE).
2018-03-05 12:23:59 +01:00
Tobias Brunner 5eb094df11 proposal: Print all algorithms even those with currently unknown transform types 2018-03-05 12:05:36 +01:00
Tobias Brunner cc55461c8d proposal: Keep track of contained transform types 2018-03-05 12:05:36 +01:00
Tobias Brunner ec1ebb2377 transform: Move internal identifiers out of private range
Avoid any conflicts if implementations use transform types in the
private range.
Also removed the unused UNKNOWN_TRANSFORM_TYPE identifier.
2018-03-05 12:05:36 +01:00
Tobias Brunner 0d06cbd66e unit-tests: Ignore binaries of renamed test runners
Fixes: 9cc61baaf5 ("unit-tests: Rename targets for libstrongswan and kernel-netlink")
2018-03-02 17:11:27 +01:00
Tobias Brunner cdfa0ba4d1 libimcv: Fix typo in PTS hash algorithm mapping for 512-bit SHA-3
Fixes: 40f2589abf ("gmp: Support of SHA-3 RSA signatures")
2018-03-02 08:30:13 +01:00
Tobias Brunner 2f5d6be5a0 kernel-netlink: Ignore local routes in any table
Such routes seem to show up in tables other than local with recent kernels.

Fixes #2555.
2018-02-28 15:32:41 +01:00
Tobias Brunner 9189aec666 kernel-netlink: Ignore routes with next hop during local subnet enumeration
These are not locally attached and we do the same already in kernel-pfroute.

Fixes #2554.
2018-02-28 15:32:30 +01:00
Tobias Brunner d9400f44d8 kernel-netlink: Simplify rt_entry_t initialization 2018-02-28 15:32:25 +01:00
Tobias Brunner 958a0545e5 nm: Version bump to 1.4.4 2018-02-28 15:30:42 +01:00
Tobias Brunner 07f6cfe910 nm: Update German translation 2018-02-28 15:29:39 +01:00
Tobias Brunner 5bb197d880 nm: Fix tooltips for proposal text fields
There is no ! syntax as the default proposal is only used if no custom
proposal is configured.
2018-02-28 15:22:41 +01:00
Tobias Brunner 479af1ed76 Merge branch 'incorrect-inval-ke'
This improves the behavior during CREATE_CHILD_SA exchanges if the peer
sends an INVALID_KE_PAYLOAD with a DH group we didn't request or continues
to return the same notify even if we use the requested group.

Fixes #2536.
2018-02-23 09:33:48 +01:00
Tobias Brunner 574f74d232 child-rekey: Don't destroy IKE_SA if initiating CHILD_SA rekeying failed
This could happen if the peer e.g. selects an invalid DH group or
responds multiple time with an INVALID_KE_PAYLAOD notify.
2018-02-23 09:25:46 +01:00
Tobias Brunner 4f1bf89ed9 child-create: Fail if we already retried with a requested DH group
With faulty peers that always return the same unusable DH group in
INVALID_KE_PAYLOADs we'd otherwise get stuck in a loop.
2018-02-23 09:25:46 +01:00
Tobias Brunner 7754c714c1 child-create: Make sure we actually propose the requested DH group
If we receive an INVALID_KE_PAYLOAD notify we should not just retry
with the requested DH group without checking first if we actually propose
the group (or any at all).
2018-02-23 09:25:46 +01:00
Tobias Brunner ecbcfbdaa1 child-create: Make sure the returned KE payload uses the proposed DH group 2018-02-23 09:25:46 +01:00
Tobias Brunner 529ffc2fe3 child-sa: Don't update outbound policies if they are not installed
After a rekeying we keep the inbound SA and policies installed for a
while, but the outbound SA and policies are already removed.  Attempting
to update them could get the refcount in the kernel interface out of sync
as the additional policy won't be removed when the CHILD_SA object is
eventually destroyed.
2018-02-22 11:38:43 +01:00
Tobias Brunner ca79bd54ff child-sa: Don't try to update outbound SA if it is not installed anymore 2018-02-22 11:38:38 +01:00
Tobias Brunner 6df2938fd2 Merge branch 'trap-manager-uninstall'
This changes how trap policies are deleted in order to avoid conflicts if a
trap policy with changed peer config is concurrently removed and reinstalled
under a different name (the reqid will be the same, so the wrong policy
could have been deleted by the old code).
2018-02-22 11:36:53 +01:00
Tobias Brunner a541cf05c1 trap-manager: Remove unused find_reqid() method
It might actually have returned an incorrect result if there were child
configs for different peer configs sharing the same name.
2018-02-22 11:31:05 +01:00
Tobias Brunner c9998e5fea child-sa: No need to find reqid of existing trap policy
When initiating a trap policy we explicitly pass the reqid along.  I guess
the lookup was useful to get the same reqid if a trapped CHILD_SA is manually
initiated.  However, we now get the same reqid anyway if there is no
narrowing.  And if the traffic selectors do get narrowed the reqid will be
different but that shouldn't be a problem as that doesn't cause an issue with
any temporary SAs in the kernel (this is why we pass the reqid to the
triggered CHILD_SA, otherwise, no new acquire would get triggered for
traffic that doesn't match the wider trap policy).
2018-02-22 11:31:05 +01:00
Tobias Brunner 24fa1bb02a trap-manager: Remove reqid parameter from install() and change return type
Reqids for the same traffic selectors are now stable so we don't have to
pass reqids of previously installed CHILD_SAs.  Likewise, we don't need
to know the reqid of the newly installed trap policy as we now uninstall
by name.
2018-02-22 11:31:05 +01:00
Tobias Brunner f42dd430d8 trap-manager: Compare peer config name during installation 2018-02-22 11:31:05 +01:00
Tobias Brunner ca213e1907 trap-manager: Uninstall trap policies by name and not reqid
If a trap policy is concurrently uninstalled and reinstalled under a
different name the reqid will be the same so the wrong trap might be
removed.
2018-02-22 11:31:05 +01:00
Tobias Brunner 6f569263a0 vici: Remove external enumeration to uninstall shunt policies 2018-02-22 11:31:05 +01:00
Tobias Brunner 9d69d8a399 stroke: Remove external enumeration to unroute shunt policies 2018-02-22 11:31:05 +01:00
Tobias Brunner 57ea3f73bb shunt-manager: Remove first match if no namespace given during uninstall
Also makes namespace mandatory.
2018-02-22 11:31:05 +01:00
Tobias Brunner c1c63a400e appveyor: Allow events to trigger early in threading unit tests
The timed wait functions tested in the threading unit tests often but
randomly trigger a bit early on AppVeyor Windows containers.  We allow this
if it is not earlier than 5ms.
2018-02-22 09:19:14 +01:00
Tobias Brunner ee8c25516a charon-nm: Fix building list of DNS/MDNS servers with libnm
g_variant_builder_add() creates a new GVariant using g_variant_new() and
then adds it to the builder.  Passing a GVariant probably adds the
pointer to the array, not the value.  I think an alternative fix would
be to use "@u" as type string for the g_variant_builder_add() call, then
the already allocated GVariant is adopted.

Fixes: 9a71b7219c ("charon-nm: Port to libnm")
2018-02-22 09:05:48 +01:00
Tobias Brunner 9ba01ce380 x509: Fix leak if a CRL contains multiple authorityKeyIdentifiers 2018-02-21 11:13:42 +01:00
Tobias Brunner bd6e4bbe68 fuzzing: Add fuzzer for CRL parsing 2018-02-20 17:54:08 +01:00
Tobias Brunner 29b983309f nm: Version bump to 1.4.3 2018-02-19 14:45:15 +01:00
Andreas Steffen 68c00bc839 Version bump to 5.6.2 2018-02-19 12:59:37 +01:00
Tobias Brunner b640afdb2e NEWS: Add info about CVE-2018-6459 2018-02-19 10:37:43 +01:00
Tobias Brunner 40da179f28 signature-params: Properly handle MGF1 algorithm identifier without parameters
Credit to OSS-Fuzz.

Fixes: CVE-2018-6459
2018-02-19 10:29:32 +01:00
Andreas Steffen 0bb4d2179d Version bump to 5.6.2rc1 2018-02-16 13:37:00 +01:00
Andreas Steffen 22157b8163 testing: Enable counters and save-keys plugins 2018-02-16 13:36:44 +01:00
Tobias Brunner c65bec5137 NEWS: Added some news for 5.6.2 2018-02-16 11:06:40 +01:00
Tobias Brunner fb545dd34d vici: Also return close action 2018-02-16 09:55:22 +01:00
Tobias Brunner bac71410f3 save-keys: Add warning message to log if keys are being saved 2018-02-15 23:03:29 +01:00
Tobias Brunner 1da1ba01c4 save-keys: Add options to enable saving IKE and/or ESP keys 2018-02-15 23:03:29 +01:00
Codrut Cristian Grosu 88e151d10d save-keys: Store derived CHILD_SA keys in Wireshark format 2018-02-15 23:03:29 +01:00
Codrut Cristian Grosu 4be7db5f60 save-keys: Store derived IKE_SA keys in Wireshark format
The path has to be set first, otherwise, nothing is done.
2018-02-15 23:03:29 +01:00
Codrut Cristian Grosu 345cd4684c save-keys: Add save-keys plugin
This plugin will export IKE_SA and CHILD_SA secret keys in the format used
by Wireshark.

It has to be loaded explicitly.
2018-02-15 23:03:29 +01:00
Andreas Steffen 4eaf08c35b vici: list-conn reports DPD settings and swanctl displays them 2018-02-15 16:28:06 +01:00
Tobias Brunner ac140220c4 proposal: Add modp6144 to the default proposal
We always had modp4096 and modp8192 included, not sure why this wasn't.
2018-02-14 14:54:32 +01:00
Tobias Brunner ce048c30ff ha: Double receive buffer size for HA messages and make it configurable
With IKEv1 we transmit both public DH factors (used to derive the initial
IV) besides the shared secret.  So these messages could get significantly
larger than 1024 bytes, depending on the DH group (modp2048 just about
fits into it).  The new default of 2048 bytes should be fine up to modp4096
and for larger groups the buffer size may be increased (an error is
logged should this happen).
2018-02-14 14:52:18 +01:00
Tobias Brunner 26e033cfe3 Revert "travis: Use Clang 4.0 instead of 3.9 due to va_start() warnings"
The Trusty image used by Travis was updated in December and now has Clang
5.0.0 installed.  So this workaround is not necessary anymore.

This reverts commit f4bd467641.
2018-02-13 16:25:46 +01:00
Tobias Brunner 2db6d5b8b3 Fixed some typos, courtesy of codespell 2018-02-13 12:19:54 +01:00
Tobias Brunner 60c750181f Merge branch 'readme-errata'
Closes strongswan/strongswan#89.
2018-02-12 11:16:49 +01:00
Liu Qun (liuqun) 9587c1bfa6 README: Fix paths to private keys
Since version 5.5.1, different keys can be put together in
/etc/swanctl/private.
See:
* tobiasbrunner@7caba2eb5524be6b51943bcc3d2cb0e4c5ecc09a
  swanctl: Add 'private' directory/section to load any type of private key

Signed-off-by:  Liu Qun (liuqun) <qunliu@zyhx-group.com>
2018-02-12 11:16:22 +01:00
刘群 92001d1e62 README: Fix typo in pki --req example
Fix up one typo mistake in the example of "Generating a Host or User End
Entity Certificate"

Signed-off-by:  Liu Qun (liuqun) <qunliu@zyhx-group.com>
2018-02-12 11:12:36 +01:00
Tobias Brunner d58a84e0f7 Merge branch 'mobike-nat'
These changes improve MOBIKE task queuing. In particular we don't
want to ignore the response to an update (with NAT-D payloads) if only
an address list update or DPD is queued as that could prevent use from
updating the UDP encapsulation in the kernel.

A new optional roam trigger is added to the kernel-netlink plugin based
on routing rule changes.  This only works properly, though, if the kernel
based route lookup is used as the kernel-netlink plugin does currently
not consider routing rules for its own route lookup.

Another change prevents acquires during address updates if we have to
update IPsec SAs by deleting and readding them.  Because the outbound policy
is still installed an acquire and temporary SA might get triggered in
the short time no IPsec SA is installed, which could subsequently prevent the
reinstallation of the SA.  To this end we install drop policies before
updating the policies and SAs.  These also replace the fallback drop policies
we previously used to prevent plaintext leaks during policy updates (which
reduces the overhead in cases where addresses never or rarely change as
additional policies will only have to be tracked during address updates).

Fixes #2518.
2018-02-09 16:13:19 +01:00
Tobias Brunner 044b0f048b ike-mobike: Don't trigger update for NAT mapping change detected during an address update
This is really only needed for other exchanges like DPDs not when we
just updated the addresses. The NAT-D payloads are only used here to
detect whether UDP encapsulation has to be enabled/disabled.
2018-02-09 15:53:30 +01:00
Tobias Brunner 35ef1b032d child-sa: Install drop policies while updating IPsec SAs and policies
If we have to remove and reinstall SAs for address updates (as with the
Linux kernel) there is a short time where there is no SA installed.  If
we keep the policies installed they (or any traps) might cause acquires
and temporary kernel states that could prevent the updated SA from
getting installed again.

This replaces the previous workaround to avoid plaintext traffic leaks
during policy updates, which used low-priority drop policies.
2018-02-09 15:53:30 +01:00
Tobias Brunner 4664992f7d kernel-netlink: Optionally trigger roam events on routing rule changes
This can be useful if routing rules (instead of e.g. route metrics) are used
to switch from one to another interface (i.e. from one to another
routing table).  Since we currently don't evaluate routing rules when
doing the route lookup this is only useful if the kernel-based route
lookup is used.

Resolves strongswan/strongswan#88.
2018-02-09 15:51:28 +01:00
Tobias Brunner 80ae474863 ike-sa: Remove unused counter for pending MOBIKE updates 2018-02-09 11:21:02 +01:00
Tobias Brunner 9f0497818c ike-mobike: Only ignore MOBIKE responses if an actual update is queued
The counter does not tell us what task is actually queued, so we might
ignore the response to an update (with NAT-D payloads) if only an address
update is queued.
2018-02-09 11:21:02 +01:00
Tobias Brunner 2d27c350f8 ikev2: Update currently queued MOBIKE task
Instead of destroying the new task and keeping the existing one we
update any already queued task, so we don't loose any work (e.g. if a
DPD task is active and address update is queued and we'd actually like
to queue a roam task).
2018-02-09 11:21:02 +01:00
Tobias Brunner 43bbe07036 ike-mobike: Don't reset address update flag if set previously
If we update a queued job we don't want to reset previously set task
properties.
2018-02-09 11:21:02 +01:00
Tobias Brunner f90561155b ike: Add log message if host moves out of NAT 2018-02-09 11:21:02 +01:00
Tobias Brunner ad14f2084e testing: Add ikev2/mobike-virtual-ip-nat scenario
This tests moving from a public IP behind a NAT and back (with proper
changes of the UDP encapsulation).
2018-02-09 11:21:02 +01:00
Tobias Brunner 626e8a31d0 ikev1: Properly handle fragmented Quick Mode messages 2018-02-09 10:46:00 +01:00
Tobias Brunner 73cbce6013 libradius: Pad received MSK to at least 64 bytes
According to RFC 3748 MSKs must be at least 64 bytes, however, that's
not the case for the MSK derived via EAP-MSCHAPv2.  The two key parts
received are only 16 bytes each (derived according to RFC 3079,
section 3.3), so we end up with an MSK of only 32 bytes. The eap-mschapv2
plugin, on the other hand, pads these two parts with 32 zeros.

Interestingly, this is not a problem in many cases as the SHA1/2 based
PRFs used later use a block size that's >= 64 bytes, so the shorter MSK
is just padded with zeros then.  However, with AES-XCBC-PRF-128, for
instance, which uses a block size of 16 bytes, the different MSKs are an
issue as XCBC is applied to both to shorten them, with different results.
This eventually causes the authentication to fail if the client uses a
zero-padded MSK produced by the eap-mschapv2 plugin and the server the 32
byte MSK received via RADIUS.
2018-02-09 10:44:52 +01:00
Tobias Brunner e698bdea24 man: Fix documentation of pubkey constraints
Hash algorithms have to be repeated for multiple key types.

References #2514.
2018-02-09 10:42:13 +01:00
Tobias Brunner bb58dfb9b5 Merge branch 'dh-group-rekey'
These changes improve rekeying after the peer initially selected a
different DH group than we proposed.  Instead of using the configured DH
group again, and causing another INVALID_KE_PAYLOAD notify, we now reuse
the previously negotiated group.  We also send the selected DH group
first in the proposals (and move proposals that don't contain the group
to the back) so that implementations that select the proposal first and
without consulting the KE payload (e.g. strongSwan when preferring the
client's proposals) will see the preferred group first.

Fixes #2526.
2018-02-09 10:34:52 +01:00
Tobias Brunner 5a259ade4e child-create: Promote selected DH group, demote proposals that don't contain it 2018-02-09 10:20:05 +01:00
Tobias Brunner ff79020cd2 ike-init: Promote selected DH group and demote proposals that don't contain it 2018-02-09 10:20:05 +01:00
Tobias Brunner d9c9b7b832 proposal: Add method to move a given DH group to the front
This way a responder (like strongSwan) selecting a proposal first and
then checking if the KE payload matches sees the peer's preferred group
first.
2018-02-09 10:20:05 +01:00
Tobias Brunner 97ad041e6e unit-tests: Make sure we reuse the DH group during CHILD_SA rekeying 2018-02-09 10:20:05 +01:00
Tobias Brunner 576d9b907c ike-init: Make DH group reuse optional to test INVALID_KE_PAYLOAD handling
This is currently not an issue for CHILD_SA rekeying tests as these only
check rekeyings of the CHILD_SA created with the IKE_SA, i.e. there is
no previous DH group to reuse.
2018-02-09 10:20:05 +01:00
Tobias Brunner 27b0bd91d4 child-rekey: Use previously negotiated DH group when rekeying CHILD_SAs
For the CHILD_SA created with the IKE_SA the group won't be set in the
proposal, so we will use the first one configure just as if the SA was
created new with a CREATE_CHILD_SA exchange.  I guess we could
theoretically try to use the DH group negotiated for IKE but then this
would get a lot more complicated as we'd have to check if that group is
actually contained in any of the CHILD_SA's configured proposals.
2018-02-09 10:20:05 +01:00
Tobias Brunner f8e53003aa child-create: Add an option to set the DH group to be used 2018-02-09 10:20:05 +01:00
Tobias Brunner 727615ee05 ike-init: Reuse the DH group of the previous IKE_SA when rekeying 2018-02-09 10:20:05 +01:00
Tobias Brunner 18242f62c2 ike-init: Move creation of DH instance after INVALID_KE_PAYLOAD to build_i()
This way we get proper error handling if the DH group the peer requested
is not actually supported for some reason (otherwise we'd just retry to
initiate with the configured group and get back another notify).
2018-02-09 10:20:05 +01:00
Tobias Brunner d058fd3c32 child-cfg: Strip DH groups from both compared proposals
This fixes two issues, one is a bug if a DH group is configured for the
local ESP proposals and charon.prefer_configured_proposals is disabled.
This would cause the DH groups to get stripped not from the configured but
from the supplied proposal, which usually already has them stripped.  So
the proposals wouldn't match.  We'd have to always strip them from the local
proposal.  Since there are apparently implementations that, incorrectly, don't
remove the DH groups in the IKE_AUTH exchange (e.g. WatchGuard XTM25
appliances) we just strip them from both proposals.  It's a bit more lenient
that way and we don't have to complicate the code to only clone and strip the
local proposal, which would depend on a flag.

References #2503.
2018-02-09 10:18:59 +01:00
Tobias Brunner 007a2701bb ike: Don't handle roam events if no IKE config is available
IKE_SAs newly created via HA_IKE_ADD message don't have any IKE or peer
config assigned yet (this happens later with an HA_IKE_UPDATE message).
And because the state is initially set to IKE_CONNECTING the roam() method
does not immediately return, as it later would for passive HA SAs. This
might cause the check for explicitly configured local addresses to crash
the daemon with a segmentation fault.

Fixes #2500.
2018-02-09 10:10:07 +01:00
Adrian-Ken Rueegsegger fcff3808b4 charon-tkm: Update to latest Anet version 2018-02-08 17:01:38 +01:00
Tobias Brunner c6a402d4fa android: New release after changing cert sending policy 2018-02-08 12:26:11 +01:00
Tobias Brunner 6bafa2d346 android: Always send the client certificate
In scenarios where the server accepts client certificates from dozens or
even hundreds of CAs it might be necessary to omit certificate request
payloads from the IKE_SA_INIT response to avoid fragmentation.

As it is rarely the case in road-warrior scenarios that the server
already has the client certificate installed it should not be a problem
to always send it.
2018-02-08 12:15:36 +01:00
Tobias Brunner c7263577b3 auth-cfg: Classify key strengths as multi value rules
If that's not the case only the last value added would be considered
not all the keys of a trust chain.

Fixes #2515.
2018-02-08 10:15:53 +01:00
Tobias Brunner 268a1bfa34 charon-nm: Remove unused variable 2018-02-05 15:11:03 +01:00
Andreas Steffen 476200ecc6 Version bump to 5.6.2dr4 2018-02-03 11:05:21 +01:00
Tobias Brunner 4492c9c670 testing: Ignore IP-in-IP SAs created with IPComp SAs that remain in the kernel
The kernel creates such SAs to handle uncompressed small packets.  They
are implicitly created and deleted with IPComp SAs.  The problem is that
when we delete an IPComp SA only that state is deleted and removed from
the SA lists immediately, the IP-in-IP state is not removed until the IPComp
state is eventually destroyed.  This could take a while if there are still
references to it around.  So the IP-in-IP states will keep getting reported
by ip xfrm state until that happens (we also can't flush or explicitly delete
such kernel-created states).

In kernels before 4.14 this wasn't really a problem but since
ec30d78c14a8 ("xfrm: add xdst pcpu cache") the kernel seems to keep the
references to the last used SAs around a lot longer.

Also, usually a test scenario following an IPComp scenario will create
and use new SAs and thus the cached SAs will disappear before the kernel
state is checked again.  However, if a following scenario uses different
hosts the states might remain, which caused some unrelated scenarios to
fail before adding this fix.
2018-02-01 17:10:19 +01:00
Andreas Steffen 3c5b010f5b testing: Added Linux 4.14 and 4.15 config files 2018-01-31 21:32:45 +01:00
Tobias Brunner 4a84fb07ca gmp: Fix compatibility with older libgmp releases
Older releases don't have mpz_powm_sec() and mpz_inits() yet.

Fixes #2505.
2018-01-31 10:53:55 +01:00
Tobias Brunner 432358cf49 revocation: Skip any zero bytes when comparing serials in CRLs
Depending on the plugins that eventually parse the certificate and CRL,
serials with MSB set (i.e. negative numbers that have a zero byte prefixed
when encoded as ASN.1 INTEGER) might have (x509 plugin) or not have
(openssl plugin) a zero byte prefix when returned by get_serial() or
enumerated from the CRL.  Strip them before doing the comparison or
revocation checking might fail if not both credentials are parsed by the
same plugin (which should be rare and only happen if parsing of either
cert or CRL fails with one of the plugins and there is a fallback to the
implementation provided by the other plugin).

Fixes #2509.
2018-01-31 10:50:41 +01:00
Reinhard Pfau a8e940ade2 eap: Reset errno before calling strtoul() to parse EAP type
Reset errno to 0 before calling strtoul() since it sets errno only on
error cases. So the following test fails even on correct conversions if
errno had a value != 0.

Fixes #2506.
2018-01-23 10:09:14 +01:00
Andreas Steffen 3232cf68b9 libtpmtss: Return after failure 2018-01-09 16:12:40 +01:00
Tobias Brunner d8eb1049d7 travis: Disable NM build until we run on a newer image that provides libnm
Ubuntu 16.04 (xenial) might soon be available but it's not yet supported
officially.
2017-12-22 16:13:09 +01:00
Tobias Brunner 419ae9a20a ikev1: Default remote identity to %any for PSK lookup if not configured
Otherwise, the remote identity is ignored when matching owner identities
of PSKs and this way matching PSKs that explicitly have %any assigned is
improved.

Fixes #2497.
2017-12-22 10:37:32 +01:00
Tobias Brunner a9f3016ef3 stroke: Don't ignore %any as owner of shared secrets
If users want to associate secrets with any identity, let 'em. This is
also possible with vici and might help if e.g. the remote identity is
actually %any as that would match a PSK with local IP and %any better
than one with local and different remote IP.

Fixes #2497.
2017-12-22 10:33:27 +01:00
Tobias Brunner 3c36c95539 kernel-netlink: Fix compilation on old kernels not defining IFA_F_NODAD
Fixes #2490.
2017-12-22 10:28:05 +01:00
Tobias Brunner 0701236337 Merge branch 'testing-route-based'
This adds several route-based VPN scenarios (using VTI or GRE interfaces).

It also fixes several swanctl --list-sas checks in other scenarios.

Closes strongswan/strongswan#84.
2017-12-22 10:25:16 +01:00
Tobias Brunner 351a08e1ff testing: Fix swanctl --list-sas checks in some scenarios
::YES was missing (or written as ::YES]) rendering those checks void.
Turns out some of them actually were wrong.
2017-12-22 10:22:47 +01:00
Tobias Brunner b3a793541d testing: Add route-based/net2net-gre scenario 2017-12-22 10:22:47 +01:00
Tobias Brunner f007bc9ff4 testing: Enable GRE support in 4.13 config
Also enables IPv6 support for VTI devices.
2017-12-22 10:22:47 +01:00
Robin McCorkell e71593d91c testing: Add route-based/net2net-vti scenario 2017-12-22 10:22:47 +01:00
Robin McCorkell ff7129ee6a testing: Added route-based/rw-shared-vti-ip6-in-ip4 scenario 2017-12-22 10:22:47 +01:00
Robin McCorkell a35416af1c testing: Added route-based/rw-shared-vti scenario 2017-12-22 10:22:47 +01:00
Robin McCorkell 95deada184 testing: Enable VTI module in kernel config 2017-12-22 10:22:47 +01:00
Robin McCorkell 82b91e113a testing: Override user environment PATH in chroot
chroot will capture the user environment's PATH variable, which may be
wrong (e.g. not include /bin:/sbin, as it is on Arch). We should set a
known-working PATH variable in the chroot.
2017-12-22 10:22:47 +01:00
Tobias Brunner 381f6d982c kernel-pfkey: Fix extended replay configuration on FreeBSD 11.1
Fixes: 88a8fba1c7 ("kernel-pfkey: Support anti-replay windows > 2k")
Fixes #2501.
2017-12-22 10:19:49 +01:00
Tobias Brunner 6d98bb926e swanctl: Allow dots in authority/shared secret/pool names
Use argument evaluation provided by settings_t instead of using strings
to enumerate key/values.

If section names contain dots the latter causes the names to get split
and interpreted as non-existing sections and subsections.

This currently doesn't work for connections and their subsections due to
the recursion.
2017-12-22 10:11:21 +01:00
Tobias Brunner a7f613ca2e vici: Document NTLM secrets in README.md
Fixes #2481.
2017-12-22 10:09:26 +01:00
Tobias Brunner 859d645c44 vici: Accept XAUTH as shared key type too
Fixes #2481.
2017-12-22 10:09:22 +01:00
Lubomir Rintel 9a71b7219c charon-nm: Port to libnm
libnm-glib is deprecated for several years and reaching the end of its
life. Let's switch to the more up-to-date library.

Closes strongswan/strongswan#85.
2017-12-22 10:05:10 +01:00
Tobias Brunner fd9edf7f31 travis: Disable warning that causes a false positive in Xcode 8.3+
Xcode 8.3, to which there recently was a switch, spits out a warning for
the potentially unaligned access to ip6_plen in ip-packet.c, which we
explicitly read via untoh16() hence the access to that pointer is not
actually unaligned.  It seems the compiler is not able to determine that
there is no unaligned access even though the function is defined in the
header and marked inline.
2017-12-20 16:08:21 +01:00
Andreas Steffen 344e1b6060 Version bump to 5.6.2dr3 2017-12-13 08:54:54 +01:00
Andreas Steffen 0fb293fc91 tpm_extendpcr: Extend digests into a TPM PCR 2017-12-13 07:10:28 +01:00
Andreas Steffen 5d3eb57cfd Version bump to 5.6.2dr2 2017-12-10 21:42:02 +01:00
Andreas Steffen ee402a22a3 asn1: Added tlsfeature OID 2017-12-10 19:56:14 +01:00
Andreas Steffen 3e7a19bfa9 pki: Extend pki --print with --keyid parameter 2017-12-10 19:31:10 +01:00
Andreas Steffen acfd590ab6 imc-os: Derive device ID from private key bound to smartcard or TPM 2017-12-10 11:51:50 +01:00
Eyal Birger 2389168388 ipsec-types: Don't mask the mark value if it is one of the 'unique' values
Support for mark=%unique/%unique-dir is implemented by using designated
magic mark values.

Use of masks is orthogonal to the 'unique' feature, as it is useful to be
able to designate portions of the packet mark for other purposes, while
still using different marks for different connections.

When these magic values are masked, their magic meaning is lost.

Perform masking only on explicit mark values.

Closes strongswan/strongswan#87.
2017-12-07 09:36:53 +01:00
Lubomir Rintel ee22e8080f nm: Allow disabling libnm-glib
The distros are eventually going to drop it, allow omitting it.

Closes strongswan/strongswan#86.
2017-12-06 11:13:03 +01:00
Andreas Steffen 4f60b72a81 Version bump to 5.6.2dr1 2017-12-05 22:23:43 +01:00
Andreas Steffen 71cf3d709a pt-tls-client: Load certificates via handle from smartcard or TPM 2017-12-05 21:31:31 +01:00
Andreas Steffen e850d000b8 libtpmtss: Load X.509 certificates from TPM 2.0 NV RAM 2017-12-05 21:31:31 +01:00
Andreas Steffen fb1cf320a2 libtpmtss: Extend TPM 2.0 capability info 2017-12-05 21:31:31 +01:00
Tobias Brunner 0729be1bfe Merge branch 'android-proposals'
Makes IKE and ESP proposals configurable.
2017-11-28 16:23:41 +01:00
Tobias Brunner 4a79434b11 android: Remove modp1024 from the ESP proposals 2017-11-28 16:19:08 +01:00
Tobias Brunner 8517a0edb4 testing: Explicitly deliver all test results as text/plain 2017-11-28 16:17:50 +01:00
Andreas Steffen 203a86ecb8 Version bump to 5.6.1 2017-11-17 22:42:28 +01:00
Andreas Steffen f60b08ba0d testing: Added swanctl/rw-cert-pss scenario 2017-11-17 22:42:07 +01:00
Tobias Brunner 5a6f687bdf android: New release after adding configurable proposals 2017-11-17 18:11:43 +01:00
Tobias Brunner b03713add4 android: Validate proposal strings when importing profiles 2017-11-17 18:11:43 +01:00
Tobias Brunner 9f962f6c19 android: Validate proposal strings in the GUI 2017-11-17 18:11:43 +01:00
Tobias Brunner 836a943804 android: Add utility JNI function to validate proposal strings 2017-11-17 18:11:39 +01:00
Tobias Brunner 2307bffe56 proposal: Move proposal_t from libcharon to libstrongswan
This allows us to use it without having to initialize libcharon, which
was required for the logging (we probably could have included debug.h
instead of daemon.h to workaround that but this seems more correct).
2017-11-17 18:09:54 +01:00
Tobias Brunner 92c1b52487 android: Load JNI libraries in Application class
This way they are also loaded when we don't use CharonVpnService.
2017-11-17 18:05:35 +01:00
Tobias Brunner 2d1f65feb3 android: Make IKE/ESP proposals configurable in the GUI 2017-11-17 18:05:35 +01:00
Tobias Brunner 6403ad5457 android: Import IKE/ESP proposals
We currently don't validate them here, only when used later will they
get parsed (which includes some checks).
2017-11-17 14:31:06 +01:00
Tobias Brunner a7c43544dd android: Use optional custom proposals for IKE and ESP
If the proposal is invalid we fall back to the defaults.
2017-11-17 14:31:06 +01:00
Tobias Brunner 24c22a3fa8 android: Add properties for IKE and ESP proposals 2017-11-17 14:31:06 +01:00
Tobias Brunner 8b6c23342c android: Free settings string passed via JNI 2017-11-17 14:31:06 +01:00
Tobias Brunner caee751d13 NEWS: Added some news for 5.6.1 2017-11-17 10:00:29 +01:00
Tobias Brunner f7a73fe0f7 hashers: Change names of SHA2 hash algorithms
Keep the lower case names as they are as we use them internally (parsing
and e.g. in OpenSSL as identifier).
2017-11-17 09:32:47 +01:00
Tobias Brunner 36ae037b81 ikev2: Add hash algorithm used for RSASSA-PSS signature to log message 2017-11-17 09:30:53 +01:00
Tobias Brunner dfd5f090fb hasher: Add uppercase short names for hash algorithms 2017-11-17 09:30:53 +01:00
Tobias Brunner ce4aebe00a testing: Configure logging via syslog in strongswan.conf
Globally configure logging in strongswan.conf.testing and replace all
charondebug statements with strongswan.conf settings.
2017-11-15 17:24:04 +01:00
Tobias Brunner d24d26c4bc testing: Disable logging via journal in charon-systemd
This avoids duplicate log messages as we already log via syslog to get
daemon.log.
2017-11-15 17:12:09 +01:00
Tobias Brunner be214cb17e testing: Globally define logging via syslog for charon-systemd
We could make the same change for charon (actually setting it for charon
in strongswan.conf.testing would work for charon-systemd too), however,
there are dozens of test cases that currently set charondebug in
ipsec.conf.
2017-11-15 17:09:55 +01:00
Tobias Brunner 7a659c0f99 x509: Initialize signature params when parsing attribute certificates 2017-11-15 14:41:56 +01:00
Tobias Brunner 26d18f4efb sw-collector: Unmap history file on failure to instantiate extractor 2017-11-15 14:40:10 +01:00
Tobias Brunner 42353849cb charon: Explicitly check return value of fileno()
This is mainly for Coverity because fchown() can't take a negative
value, which the -1 check implies is possible.
2017-11-15 14:37:43 +01:00
Tobias Brunner be79839ea7 pkcs8: Add explicit comment for RSASSA-PSS fall-through 2017-11-15 14:33:05 +01:00
Tobias Brunner 7f1d944bc9 The pacman tool got replaced by the sec-updater tool 2017-11-15 12:18:17 +01:00
Tobias Brunner 851e51d1cf sec-updater: Fix typo in documentation 2017-11-15 12:10:33 +01:00
Tobias Brunner 527b3f0ca5 Fixed some typos, courtesy of codespell 2017-11-15 10:21:13 +01:00
Tobias Brunner c87b16d256 swanctl: Add check for conflicting short options 2017-11-13 10:09:41 +01:00
Tobias Brunner f0c7cbd1d7 swanctl: Properly register --counters commmand
Use C instead of c, which is already used for --load-conns.
2017-11-13 09:45:14 +01:00
Andreas Steffen 859cb93d28 testing: Do not remove all swanctl subdirectories 2017-11-11 19:23:01 +01:00
Andreas Steffen b20bf062e8 Version bump to 5.6.1rc1 2017-11-11 18:25:17 +01:00
Andreas Steffen 74f8ad7fd9 Merge branch 'swanctl-testing' 2017-11-11 16:42:38 +01:00
Andreas Steffen 7df35af7cc libimcv: Updated imv database 2017-11-11 16:41:16 +01:00
Andreas Steffen 13a3f20f2e testing: Converterd tnc to systemd 2017-11-11 16:41:16 +01:00
Andreas Steffen 323f0b05d7 testing: Converted sql to systemd 2017-11-11 16:41:15 +01:00
Andreas Steffen 70dc5bb8ad testing: Converted swanctl to systemd 2017-11-11 16:41:15 +01:00
Andreas Steffen 65f74cd13d testing: Added legacy ipv6-stroke scenarios 2017-11-11 16:41:15 +01:00
Andreas Steffen 4402013f05 testing: Converted ipv6/rw-ip6-in-ip4-ikev2 to swanctl 2017-11-10 13:54:51 +01:00
Andreas Steffen b3ccfcd05e testing: Converted ipv6/rw-ip6-in-ip4-ikev1 to swanctl 2017-11-10 13:54:50 +01:00
Andreas Steffen da5aa6ae6a testing: Converted ipv6/net2net-ip6-in-ip4-ikev2 to swanctl 2017-11-10 13:54:50 +01:00
Andreas Steffen 12dbca721e testing: Converted ipv6/net2net-ip6-in-ip4-ikev1 to swanctl 2017-11-10 13:54:50 +01:00
Andreas Steffen f0476c4a82 testing: Converted ipv6/rw-rfc3779-ikev2 to swanctl 2017-11-10 13:54:50 +01:00
Andreas Steffen 96d7d9392f testing: Converted ipv6/rw-compress-ikev2 to swanctl 2017-11-10 13:54:50 +01:00
Andreas Steffen 34acd584e5 testing: Converted ipv6/rw-psk-ikev2 to swanctl 2017-11-10 11:49:49 +01:00
Andreas Steffen 0770b37f8f testing: Converted ipv6/rw-psk-ikev1 to swanctl 2017-11-10 11:49:41 +01:00
Andreas Steffen ffe0d82c03 testing: Converted ipv6/rw-ikev2 to swanctl 2017-11-10 11:49:41 +01:00
Andreas Steffen a96238a0d0 testing: Converted ipv6/rw-ikev1 to swanctl 2017-11-10 11:49:41 +01:00
Andreas Steffen 8215681a4a testing: Converted ipv6/net2net-rfc3779-ikev2 to swanctl 2017-11-10 11:49:41 +01:00
Andreas Steffen 04b79bc98c testing: Converted ipv6/net2net-ip4-in-ip6-ikev2 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen fd3f6871c9 testing: Converted ipv6/net2net-ip4-in-ip6-ikev1 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen f57ca13e28 testing: Converted ipv6/transport-ikev2 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen 4ae1f7c0e3 testing: Converted ipv6/transport-ikev1 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen 7812b6e6cf testing: Converted ipv6/net2net-ikev2 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen e94db2b4ad testing: Converted ipv6/net2net-ikev1 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen 47ec3326e7 testing: Converted ipv6/host2host-ikev2 to swanctl 2017-11-10 11:49:40 +01:00
Andreas Steffen 087b027f88 testing: Converted ipv6/host2host-ikev1 to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen 0a6f8644ef testing: Removed libipsec/rw-suite-b 2017-11-10 11:49:39 +01:00
Andreas Steffen 9375c9c9db testing: Converted libipsec/net2net-null to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen 86d1b7a14d testing: Converted libipsec/net2net-cert-ipv6 to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen c3b8778fc9 testing: Converted libipsec/net2net-cert to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen de42a67b79 testing: Converted libipsec/net2net-3des to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen 6922d5e56a testing: Converted libipsec/host2host-cert to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen 3659fda1a5 testing: Converted gcrypt-ikev2 to swanctl 2017-11-10 11:49:39 +01:00
Andreas Steffen b46deb8107 testing: Converted gcrypt-ikev1 to systemd 2017-11-10 11:49:38 +01:00
Andreas Steffen 88a950d915 testing: Converted af-alg to systemd 2017-11-10 11:49:38 +01:00
Andreas Steffen 67a97c18ae testing: Enable systemd 2017-11-10 11:49:38 +01:00
Andreas Steffen 804784cc1c testing: Updated some descriptions 2017-11-10 11:49:38 +01:00
Andreas Steffen 0d63255513 libtpmtss: Added missing argument in hasher_from_signature_scheme() 2017-11-10 11:47:27 +01:00
Tobias Brunner 291b02262d charon-tkm: Unlink PID file after deinit
Same change as for charon in the previous commit.

References #2460.
2017-11-10 10:56:13 +01:00
Tobias Brunner 1b4d97dbb7 charon: Unlink PID file after daemon deinit (i.e. after unloading plugins etc.)
Make sure, though, that we only remove the file if we actually
created it (e.g. not for --help or --version).  And do so before
deinitializing libstrongswan due to leak detective.

Fixes #2460.
2017-11-10 10:55:43 +01:00
Thomas Egerer 9cc61baaf5 unit-tests: Rename targets for libstrongswan and kernel-netlink
libstrongswan and kernel-netlink are the only two components which do
not adhere to the naming scheme used for all other tests. If the tests
are run by an external application this imposes problems due to clashing
names.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2017-11-09 09:11:42 +01:00
Tobias Brunner 1c4b392a5b Merge branch 'rsassa-pss'
This adds support for RSASSA-PSS signatures in IKEv2 digital signature
authentication (RFC 7427), certificates and CRLs etc., and when signing
credentials via pki tool.  For interoperability with older versions, the
default is to use classic PKCS#1 signatures.  To use PSS padding either enable
rsa_pss via strongswan.conf or explicitly use it either via ike:rsa/pss...
auth token or the --rsa-padding option of the pki tool.

References #2427.
2017-11-08 16:53:35 +01:00
Tobias Brunner fde0c763b6 auth-cfg: Add RSA/PSS schemes for pubkey and rsa if enabled in strongswan.conf
Also document the rsa/pss prefix.
2017-11-08 16:48:10 +01:00
Tobias Brunner 27a79326c7 pki: Enable PSS padding if enabled in strongswan.conf 2017-11-08 16:48:10 +01:00
Tobias Brunner d57af8dde0 pki: Optionally generate RSA/PSS signatures 2017-11-08 16:48:10 +01:00
Tobias Brunner 9b828ee85f pki: Indent usage lines properly automatically 2017-11-08 16:48:10 +01:00
Tobias Brunner 364395d2de Treat RSASSA-PSS keys like rsaEncryption RSA keys
In theory we should treat any parameters and the identifier itself as
restriction to only use the key to create signatures accordingly (e.g.
only use RSA with PSS padding or even use specific hash algorithms).
But that's currently tricky as we'd have to store and pass this information
along with our private keys (i.e. use PKCS#8 to store them and change the
builder calls to pass along the identifier and parameters). That would
require quite some work.
2017-11-08 16:48:10 +01:00
Tobias Brunner fb63012e0c openssl: Add support for signature schemes with parameters 2017-11-08 16:48:10 +01:00
Tobias Brunner dc83bc147e pki: Properly forward digest to attribute certificate builder 2017-11-08 16:48:10 +01:00
Tobias Brunner bbfe39f597 x509: Add support for signature schemes with parameters
Also adds support for specifying the hash algorithm for attribute
certificate signatures.
2017-11-08 16:48:10 +01:00
Tobias Brunner 0c23a5693c builder: Add builder option to pass signature scheme and params 2017-11-08 16:48:10 +01:00
Tobias Brunner 3fc66e5743 ikev2: Use helpers to build signature auth data 2017-11-08 16:48:10 +01:00
Tobias Brunner eae80fdedc signature-params: Add helpers to parse/build ASN.1 algorithmIdentifier for signature schemes 2017-11-08 16:48:10 +01:00
Tobias Brunner 6f97c0d50b ikev2: Enumerate RSA/PSS schemes and use them if enabled 2017-11-08 16:48:10 +01:00
Tobias Brunner 24b2ede283 ikev2: Support signing with RSASSA-PSS via RFC 7427 signature auth 2017-11-08 16:48:10 +01:00
Tobias Brunner a4aaef7477 signature-params: Use helper to build MGF1 algorithmIdentifier 2017-11-08 16:48:10 +01:00
Tobias Brunner f89348d035 asn1: Add helper function to create algorithmIdentifier with parameters 2017-11-08 16:48:10 +01:00
Tobias Brunner 5f7be58177 ikev2: Verify RSASSA-PSS signatures via RFC 7427 signature auth 2017-11-08 16:48:10 +01:00
Tobias Brunner 84b1c06d0e keymat_v2: Pass/receive signature schemes as signature_param_t objects 2017-11-08 16:48:10 +01:00
Tobias Brunner 634c6ba8ce auth-cfg: Parse rsa/pss auth tokens 2017-11-08 16:48:10 +01:00
Tobias Brunner 54f8d09261 auth-cfg: Store signature schemes as signature_params_t objects
Due to circular references the hasher_from_signature_scheme() helper
does not take a signature_params_t object.
2017-11-08 16:48:10 +01:00
Tobias Brunner 024b979522 certificate: Return signature scheme and parameters from issued_by() method
This also required some include restructuring (avoid including library.h
in headers) to avoid unresolvable circular dependencies.
2017-11-08 16:48:10 +01:00
Tobias Brunner c2935b03c4 signature-params: Add helper struct for signature scheme and parameters 2017-11-08 16:48:10 +01:00
Tobias Brunner 72b7c0ffd8 android: Add support for creating RSASSA-PSS signatures via JNI 2017-11-08 16:48:10 +01:00
Tobias Brunner 414f255561 unit-tests: Add RSA-PSS signature tests with specific salts 2017-11-08 16:48:10 +01:00
Tobias Brunner 37efb9787b gcrypt: Add support for static salts when signing with RSA-PSS 2017-11-08 16:48:10 +01:00
Tobias Brunner f241a981aa gmp: Add support for static salts when signing with RSA-PSS 2017-11-08 16:48:10 +01:00
Tobias Brunner c380608a89 signature-params: Optionally pass a specific salt value when signing 2017-11-08 16:48:10 +01:00
Tobias Brunner fa7f5e2d0c unit-tests: Warn if we skip RSA tests due to dependencies 2017-11-08 16:48:10 +01:00
Tobias Brunner 4c5dd39aa3 unit-tests: Add ability to issue a warning message for a test case
This way we can warn if we e.g. skipped actually doing something due to
dependencies (otherwise the test case would just appear to have succeeded).
2017-11-08 16:48:10 +01:00
Tobias Brunner 90a3bc5075 mgf1: Add support for SHA-224/384 based MGF1 2017-11-08 16:48:10 +01:00
Tobias Brunner 720a76c229 xof: Add identifiers for MGF1 XOFs based on SHA-224/384 2017-11-08 16:48:10 +01:00
Tobias Brunner 126fd8af09 gmp: Use helper to determine XOF type 2017-11-08 16:48:10 +01:00
Tobias Brunner 883e7fcd65 xof: Add helper to determine MGF1 XOF type from hash algorithm 2017-11-08 16:48:10 +01:00
Tobias Brunner 3ce8b0556a gcrypt: Add support for RSA-PSS signatures
For salt lengths other than 20 this requires 0bd8137e68c2 ("cipher:
Add option to specify salt length for PSS verification."), which was
included in libgcrypt 1.7.0 (for Ubuntu requires 17.04).  As that makes
it pretty much useless for us (SHA-1 is a MUST NOT), we require that version
to even provide the feature.
2017-11-08 16:48:10 +01:00
Tobias Brunner 89c3987baf gcrypt: Register supported RSA signature/verification schemes 2017-11-08 16:48:10 +01:00
Tobias Brunner c9a2b3b784 configure: Enable mgf1 plugin if gmp plugin is enabled 2017-11-08 16:48:10 +01:00
Tobias Brunner 7d6b81648b gmp: Add support for RSASSA-PSS signature verification 2017-11-08 16:48:10 +01:00
Tobias Brunner 154ee7f66a gmp: Add support for RSASSA-PSS signature creation 2017-11-08 16:48:10 +01:00
Tobias Brunner 00d161f2db unit-tests: Add FIPS 186-4 RSASSA-PSS test vectors
Since not all implementations allow setting a specific salt value when
generating signatures (e.g. OpenSSL doesn't), we are often limited to
only using the test vectors with salt length of 0.

We also exclude test vectors with SHA-1, SHA-224 and SHA-384.
2017-11-08 16:48:10 +01:00
Tobias Brunner 89015dff9e unit-tests: Create and verify some RSA PSS signatures 2017-11-08 16:48:10 +01:00
Tobias Brunner 2f95d7195d openssl: Add support for verifying RSASSA-PSS signatures 2017-11-08 16:48:10 +01:00
Tobias Brunner 51dd2fd2db openssl: Add support for creating RSASSA-PSS signatures 2017-11-08 16:48:10 +01:00
Tobias Brunner 5ae3f5cea8 openssl: Add helper to determine EVP_MD from hash_algorithm_t 2017-11-08 16:48:10 +01:00
Tobias Brunner a994407d50 unit-tests: Add FIPS 186-4 RSA test vectors
Excluding SHA-224 and the stuff from FIPS 186-2 (SHA-1, 1024 bit keys).
2017-11-08 16:48:10 +01:00
Tobias Brunner 183a9108fb gcrypt: Determine missing RSA private key parameters
We only need n, e, and d.  The primes p and q and the coefficient
for the Chinese remainder algorithm can be determined from these.
2017-11-08 16:48:10 +01:00
Tobias Brunner bd4df68a7b gmp: Determine missing RSA private key parameters
We only need n, e, and d.  The parameters for the Chinese remainder
algorithm and even p and q can be determined from these.
2017-11-08 16:48:10 +01:00
Tobias Brunner 03eda5a822 openssl: Add functions to determine missing RSA private key parameters
We only need n, e, and d.  The parameters for the Chinese remainder
algorithm and even p and q can be determined from these.
2017-11-08 16:48:10 +01:00
Tobias Brunner a22316520b signature-params: Add functions to parse/build ASN.1 RSASSA-PSS params 2017-11-08 16:48:10 +01:00
Tobias Brunner c2b878cd61 hasher: Add function to determine length of hashes 2017-11-08 16:48:10 +01:00
Tobias Brunner ffd0eeecf0 asn1: Add function to generate an ASN.1 integer from an uint64_t 2017-11-08 16:48:10 +01:00
Tobias Brunner bfe1cb3a94 asn1: Add OID for MGF1 2017-11-08 16:48:10 +01:00
Tobias Brunner d03c5b7994 signature-params: Add struct for RSASSA-PSS parameters 2017-11-08 16:48:10 +01:00
Tobias Brunner de280c2e03 private-key: Add optional parameters argument to sign() method 2017-11-08 16:48:10 +01:00
Tobias Brunner a413571f3b public-key: Add optional parameters argument to verify() method 2017-11-08 16:48:10 +01:00
Tobias Brunner 677072accc public-key: Add RSASSA-PSS signature scheme identifier 2017-11-08 16:48:10 +01:00
Tobias Brunner 69502f5afd asn1: Add OID for RSASSA-PSS 2017-11-08 16:48:10 +01:00
Tobias Brunner 43b59d1323 ikev2: Don't use SHA-1 for RFC 7427 signature authentication
RFC 8247 demoted it to MUST NOT.

References #2427.
2017-11-08 16:47:24 +01:00
Tobias Brunner 76c58498ef proposal: Remove MODP-1024 from default IKE proposal
RFC 8247 demoted it to SHOULD NOT. This might break connections with
Windows clients unless they are configured to use a stronger group or
matching weak proposals are configured explicitly on the server.

References #2427.
2017-11-08 16:47:16 +01:00
Tobias Brunner 10da451fc3 proposal: Remove MD5 from default IKE proposal
RFC 8247 demoted MD5 to MUST NOT.

References #2427.
2017-11-08 16:47:04 +01:00
Tobias Brunner 2294606aa5 proposal: Remove deprecated algorithms from default ESP and AH proposals
This removes algorithms that were deprecated by RFC 8221 (3DES, BF, MD5)
from the default proposals for ESP and AH.

References #8247.
2017-11-08 16:46:51 +01:00
Martin Willi 63ffcfaa49 configure: Fix check for libtpmtss to build it only when needed
Testing for x$tpm always yields true, hence libtpmtss is built even if it
is unneeded. Properly test against xtrue as we do in all other tests.
2017-11-08 16:43:18 +01:00
Tobias Brunner 0a6fbe8f7e pool: Destroy enumerator before deleting existing pool
The MySQL client doesn't like overlapping queries on the same
connection, so we make sure to destroy the enumerator used to check for
an existing pool before deleting it when --replace is used.
2017-11-08 16:40:14 +01:00
Tobias Brunner 88a8fba1c7 kernel-pfkey: Support anti-replay windows > 2k
FreeBSD 11.1 supports a new extension to configure larger anti-replay
windows, now configured as number of packets.

Fixes #2461.
2017-11-08 16:35:38 +01:00
Tobias Brunner 21a500a092 kernel-pfkey: Don't include keys in SADB_UPDATE message to update IPs on FreeBSD
The FreeBSD kernel explicitly rejects messages containing keys for mature SAs.

Fixes #2457.
2017-11-08 16:34:12 +01:00
Tobias Brunner 441d083cfb Merge branch 'vici-counters'
Refactors the IKE event counters feature of the stroke plugin into a separate
plugin, which allows to publish the numbers also via vici/swanctl.
2017-11-08 16:28:49 +01:00
Tobias Brunner 052bccfac4 swanctl: Add --counters command 2017-11-08 16:28:28 +01:00
Tobias Brunner fdf33b0f1c vici: Add 'get|reset-counters' commands 2017-11-08 16:28:28 +01:00
Tobias Brunner 6f74b8748a counters: Move IKE event counter collection from stroke to a separate plugin 2017-11-08 16:28:28 +01:00
Tobias Brunner c81b87ac26 systime-fix: Add timeout option to stop waiting for valid system time
A certificate check is forced once the timeout is reached even if the
system time appears to be invalid.
2017-11-08 16:20:35 +01:00
Tobias Brunner 1fe71a50f1 android: Add log message if failed to retrieve user certificate encoding 2017-11-02 12:19:36 +01:00
Tobias Brunner 7fdad3bb97 testing: Fix output matching of lease time in ipsec pool utility 2017-11-02 11:32:52 +01:00
Tobias Brunner 6ebf852c3f shunt-mananger: Make outbound FWD shunt policies optional 2017-11-02 10:47:53 +01:00
Thomas Egerer 2dad293647 ike: Do not send initial contact only for UNIQUE_NEVER
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2017-11-02 10:17:24 +01:00
Tobias Brunner 6ce7ae24a4 pkcs11: Call C_Finalize() to cancel jobs waiting in C_WaitForSlotEvent()
This is not ideal as the call to C_Finalize() should be the last one via
the PKCS#11 API.  Since the order in which jobs are canceled is undefined
we can't be sure there is no other thread still using the library (it could
even be the canceled job that still handles a previous slot event).
According to PKCS#11 the behavior of C_Finalize() is undefined while other
threads still make calls over the API.

However, canceling the thread, as done previously, could also be problematic
as PKCS#11 libraries could hold locks while in the C_WaitForSlotEvent() call,
which might not get released properly when the thread is just canceled,
and which then might cause later calls to other API functions to block.

Fixes #2437.
2017-11-02 10:15:32 +01:00
Tobias Brunner bf23ca09cb pool: Make pool timeout configurable in other units than hours 2017-11-02 10:04:03 +01:00
Tobias Brunner b93ebb4ea9 utils: Add helper function to parse time spans from strings 2017-11-02 10:04:03 +01:00
Tobias Brunner c782d367c6 asn1: Add additional OIDs seen in certificate DNs 2017-11-02 10:02:26 +01:00
Tobias Brunner 08e2401653 scripts: Add -d option to oid2der to decode DER encoded OIDs 2017-11-02 10:02:26 +01:00
Tobias Brunner 2269444b56 man: Fix documentation of inbound mark behavior in ipsec.conf(5) 2017-11-02 09:59:38 +01:00
Tobias Brunner 2d244f178f vici: Make setting mark on inbound SA configurable 2017-11-02 09:59:38 +01:00
Tobias Brunner ea43f8ffe5 child-cfg: Optionally set mark on inbound SA 2017-11-02 09:59:38 +01:00
Tobias Brunner 655924074b eap-radius: Optionally send Class attributes in RADIUS accounting messages
If enabled, add the RADIUS Class attributes received in Access-Accept messages
to RADIUS accounting messages as suggested by RFC 2865 section 5.25.

Fixes #2451.
2017-11-02 09:57:05 +01:00
Tobias Brunner 26bda4e904 ikev2: Abort make-before-break reauth if we don't find children to recreate
We do something similar in reestablish() for break-before-make reauth.
If we don't abort we'd be sending an IKE_AUTH without any TS payloads.

References #2430.
2017-11-02 09:48:56 +01:00
Tobias Brunner b2266280ef openssl: Also load EC keys from an ENGINE 2017-11-02 09:42:52 +01:00
Andreas Steffen 7f86b0f639 libcharon: Added Cisco FlexVPN Supported VID 2017-10-27 20:14:57 +02:00
Tobias Brunner 7a708b5ccd unit-tests: Fix "using integer constants in boolean context" warning
This warning has been seen in GCC 7.x with -Wall, however, because == has
higher precedence than ?: the code was actually not correct.
2017-10-23 15:13:10 +02:00
Tobias Brunner d889f20ca1 streams: Remove registered systemd stream service
Fixes: 59db98fb94 ("stream: Add basic stream service for systemd sockets")
2017-10-18 09:25:15 +02:00
Tobias Brunner 23e76d250f streams: Named systemd sockets are only supported since systemd v227 2017-10-13 10:17:37 +02:00
Tobias Brunner a97de61e78 starter: Add the correct keywords header file to EXTRA_DIST
The fix for gperf in 0ae19f0ced added the generated header to
EXTRA_DIST but that's already added to the distribution because it is
contained in *_SOURCES, what was not added, though, was the .h.in file.

Also fixes the reference to the header file in the .c rule here and for
stroke in out-of-tree builds.

Fixes: 0ae19f0ced ("configure: Fix gperf length parameter determination")
2017-10-12 09:09:12 +02:00
Tobias Brunner 0d08959a04 watcher: Don't notify watcher if removed FD was not found
This can happen if a stream is used blocking exclusively (the FD is
never registered with watcher, but is removed in the stream's destructor
just in case it ever was - doing this conditionally would require an
additional flag in streams).  There may be no thread reading from
the read end of the notify pipe (e.g. in starter), causing the write
to the notify pipe to block after it's full.  Anyway, doing a relatively
expensive FD update is unnecessary if there were no changes.

Fixes #1453.
2017-10-10 11:13:53 +02:00
aszlig 59db98fb94 stream: Add basic stream service for systemd sockets
This allows systemd socket activation by passing URIs such as systemd://foo
to plugins such as VICI.

For example setting charon.plugins.vici.socket = systemd://vici, a
systemd socket file descriptor with the name "vici" will be picked up.

So these would be the corresponding unit options:

  [Socket]
  FileDescriptorName=vici
  Service=strongswan.service

  ListenStream=/run/charon.vici

The implementation currently is very basic and right now only the first
file descriptor for a particular identifier is picked up if there are
multiple socket units with the same FileDescriptorName.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>

Closes strongswan/strongswan#79.
2017-10-10 11:11:11 +02:00
Tobias Brunner ea613d5d27 starter: Don't define any hard-coded proposal strings
Just rely on the default proposals by charon if nothing is defined. The
hard-coded IKE proposal used curve25519, which depends on an optional
plugin (while enabled by default it might still not be loaded, or, like
on Debian, shipped in an optional package). With charon's default
proposal only loaded algorithms are proposed for IKE avoiding this issue.
2017-10-10 11:04:17 +02:00
Tobias Brunner 4f575d62ed configure: Also check for libcrypto on Windows
With OpenSSL 1.1.0 the library is now named libcrypto too on Windows.
Check for libeay32 first so we don't link against the build environment's
version of OpenSSL instead of the native one that might be available.
2017-10-10 10:17:09 +02:00
Tobias Brunner 78acaba6a1 openssl: Fix call of X509_CRL_get0_signature() with OpenSSL 1.1.0
The order of arguments in X509_CRL_get0_signature() is not the same as that
of X509_get0_signature().

Fixes: 989ba4b6cd ("openssl: Update CRL API to OpenSSL 1.1.0")
2017-10-10 10:09:08 +02:00
Tobias Brunner e1803a208a kernel-netlink: Add strings for newer XFRM attribute types 2017-10-06 16:41:09 +02:00
Tobias Brunner 0ae19f0ced configure: Fix gperf length parameter determination
gperf is not actually a build dependency as the generated files are
shipped in the tarball.  So the type depends on the gperf version on
the host that ran gperf and created the tarball, which might not be
the same as that on the actual build host, and gperf might not even
be installed there, leaving the type undetermined.

Fixes: e0e4322973 ("configure: Detect type of length parameter for gperf generated function")
2017-10-02 17:21:42 +02:00
Andreas Steffen 7dd29ab4ed libimcv: Renamed SW Request to SWIMA Request 2017-09-27 10:01:56 +02:00
Andreas Steffen a9fb529b84 Version bump to 5.6.1dr3 2017-09-26 22:43:38 +02:00
Andreas Steffen be7020dace SWIMA attribute name changes
draft-ietf-sacm-nea-swima-patnc-01 changes some SWIMA attribute
names.
2017-09-26 20:35:39 +02:00
Tobias Brunner 039b85dd43 kernel-pfroute: Delay call to if_indextoname(3) when handling RTM_IFINFO
It seems that there is a race, at least in 10.13, that lets
if_indextoname() fail for the new TUN device. So we delay the call a bit,
which seems to "fix" the issue. It's strange anyway that the previous
delay was only applied when an iface entry was already found.
2017-09-26 09:33:46 +02:00
Tobias Brunner ab7d5e32d3 controller: Consider any IKE_SA destruction as success when terminating 2017-09-25 18:40:55 +02:00
Tobias Brunner e0e4322973 configure: Detect type of length parameter for gperf generated function
Since 3.1 gperf uses size_t for the length parameter instead of an
unsigned int.
2017-09-19 13:24:43 +02:00
Tobias Brunner d4593353c9 utils: Include stdint.h
Recent releases of glibc don't include the full stdint.h header in some
network headers included by utils.h.  So uintptr_t might not be defined.
Since we use fixed width integers, including the latter, all over the place
we make sure the complete file is included.

Fixes #2425.
2017-09-19 13:24:39 +02:00
Tobias Brunner c21fff303a sec-updater: Make sure `success` is initialized 2017-09-18 12:16:54 +02:00
Tobias Brunner e433d512f4 dhcp: Fix warning regarding unaligned pointer value due to packed struct
We don't need to access this as uint32_t so just cast it to a char*.
2017-09-18 12:16:54 +02:00
Tobias Brunner 787cc3a4e5 dhcp: Don't use signed char for DHCP options
The value of DHCP_OPTEND is 255.  When it is assigned this result in a
sign change as the positive int constant is cast to a signed char and -1
results. Clang 4.0 complains about this.
2017-09-18 12:16:54 +02:00
Tobias Brunner d04deff4df imv-agent: Fix get_attribute() call for preferred language 2017-09-18 12:16:54 +02:00
Tobias Brunner 7e7800e0a3 bliss: Fix compile error of unit tests due to uninitialized variable 2017-09-18 12:16:54 +02:00
Tobias Brunner f4bd467641 travis: Use Clang 4.0 instead of 3.9 due to va_start() warnings
This is a follow up on the issue documented in the previous commit.

To build with -Werror and Clang 3.9 we'd have to change all enum arguments
that are used as last argument before ... to e.g. u_int, which affects
quite a lot of places (crypto-factory, MODP_CUSTOM constructors, auth-cfg,
bus, vici-builder, vici-message).  Besides that it doesn't look as nice
it also seems a bit too much hassle just to cater to the whims of a
particular version of one compiler, so we just don't build with that
version on Travis and use 4.0 instead.
2017-09-18 12:16:51 +02:00
Tobias Brunner 7cecc98e8a settings: Fix possible undefined behavior with va_start() and bool
This fixes compilation with -Werror when using Clang 4.0 (but not 3.9)
and possibly prevents undefined behavior.

According to the C standard the following applies to the second
parameter of the va_start() macro (subclause 7.16.1.4, paragraph 4):

  The parameter parmN is the identifier of the rightmost parameter
  in the variable parameter list in the function definition (the
  one just before the ...). If the parameter parmN is declared with
  the register storage class, with a function or array type, or with
  a type that is not compatible with the type that results after
  application of the default argument promotions, the behavior is
  undefined.

Because bool is usually just 1 byte and therefore smaller than int (i.e.
the result of default argument promotion) its use as last argument before
... might result in undefined behavior.  This theoretically can also
apply to enums as a compiler may use a smaller base type than int.

Since Clang 3.9 (currently in use on Travis by default) a warning is
issued about this, however, that version did not yet compare the actual
size of the argument's type, causing warnings where they are not
warranted (basically for all cases where enum types are used for the
last argument).  This was apparently fixed with Clang 4.0, which only
warns about this use of bool with va_start(), which makes sense.
2017-09-18 12:07:26 +02:00
Tobias Brunner 46a62f0126 Define MODP_CUSTOM constructors as variadic functions
They now match the dh_constructor_t signature.  This is a follow up for
the changes merged with b668bf3f9e and should fix use of MODP_CUSTOM on
Apple's ARM64 platform.
2017-09-18 12:07:26 +02:00
Tobias Brunner f871b341d7 libtnccs: Correctly read dlopen_use_rtld_now option
Fixes: 50e4aeb22f ("libtnccs: Optionally use RTLD_NOW to load IMC/IMVs with dlopen()")
2017-09-18 12:07:26 +02:00
Tobias Brunner ddfb5dd44a plugin-loader: Correctly read dlopen_use_rtld_now option
Fixes: 305c4aa82c ("plugin-loader: Optionally use RTLD_NOW with dlopen()")
2017-09-18 12:07:26 +02:00
Tobias Brunner d3e1beaad5 android: New release after adding delta CRL support and some bug fixes 2017-09-18 11:04:46 +02:00
Tobias Brunner 66b7a08884 android: Ignore IllegalArgumentException for multicast addresses
Some Android versions seem to reject routes that use multicast addresses.

Fixes #2420.
2017-09-18 11:00:58 +02:00
Tobias Brunner 86c10a958f openssl: Add support for delta CRLs 2017-09-18 10:54:31 +02:00
Tobias Brunner 4e7b7db62f certificates: Use shared destructor for x509_cdp_t 2017-09-18 10:54:19 +02:00
Tobias Brunner e7276f78aa child-create: Don't consider a DH group mismatch as failure as responder
This causes problems e.g. on Android where we handle the alert (and
reestablish the IKE_SA) even though it usually is no problem if the
peer retries with the requested group.  We don't consider it as a
failure on the initiator either.
2017-09-18 10:51:39 +02:00
Tobias Brunner 6e861947a0 libipsec: Make sure to expire the right SA
If an IPsec SA is actually replaced with a rekeying its entry in the
manager is freed. That means that when the hard expire is triggered a
new entry might be found at the cached pointer location.  So we have
to make sure we trigger the expire only if we found the right SA.

We could use SPI and addresses for the lookup, but this here requires
a bit less memory and is just a small change. Another option would be to
somehow cancel the queued job, but our scheduler doesn't allow that at
the moment.

Fixes #2399.
2017-09-18 10:51:39 +02:00
Tobias Brunner e138003de9 Merge branch 'libipsec-ip-frag'
This fixes "packet too short" errors when parsing fragmented IPv4
packets and correctly determines the protocol in fragmented IPv6 packets.
Protocol headers are only parsed in unfragmented IPv4 and IPv6 packets,
or IPv4 first fragments.

Closes strongswan/strongswan#80.
2017-09-18 10:31:58 +02:00
Tobias Brunner 98e7285394 testing: Add libipsec/net2net-cert-ipv6 scenario 2017-09-18 10:28:54 +02:00
Tobias Brunner bdcaca76c5 ip-packet: Correctly determine protocol in fragmented IPv6 packets
We don't attempt to parse the transport headers for fragments, not even
for the initial fragment (it's not guaranteed they contain the header,
depending on the number and type of extension headers).
2017-09-18 10:28:54 +02:00
Tobias Brunner b3cc46381d ip-packet: Fix "packet too short" error when parsing fragmented IPv4 packets
Only attempt to parse the transport header of an IPv4 packet if it's
not fragmented or the first fragment.
2017-09-18 10:28:54 +02:00
Tobias Brunner 42aa569617 Merge branch 'tkm-cid-ref'
This fixes IKE_SA rekey collision handling and improves error handling
if CHILD_SA setup fails.
2017-09-15 12:17:07 +02:00
Adrian-Ken Rueegsegger fc08e6af8a charon-tkm: Reset ESA on child SA create failure
Since we are also releasing the ESA ID we have to make sure that the ESA
context is reset and in a clean state in order for it to be actually
reusable.
2017-09-15 12:16:57 +02:00
Adrian-Ken Rueegsegger 59e7298ff9 charon-tkm: Check for error when acquiring ESA ID 2017-09-15 12:16:57 +02:00
Adrian-Ken Rueegsegger 8e823bb8b1 charon-tkm: Fix AE context life-cycle handling
Use new reference counting feature of ID manager for AE contexts and
only perform reset if count is zero. Also, do not pass on AE ID as every
IKE SA must decrement AE ID count once it is not used any longer.
2017-09-15 12:16:57 +02:00
Adrian-Ken Rueegsegger c198ddcb3f charon-tkm: Return current refcount when releasing ID 2017-09-15 12:16:57 +02:00
Adrian-Ken Rueegsegger 1b2a8d963a charon-tkm: Add acquire_ref method to ID manager
The function acquires a reference to the given context reference id for
a specific context kind.
2017-09-15 12:16:57 +02:00
Adrian-Ken Rueegsegger fcde9686f6 charon-tkm: Store context ids as int instead of bool
This is in preparation of making context ids refcountable.
2017-09-15 12:16:57 +02:00
Adrian-Ken Rueegsegger d35ebfbce1 charon-tkm: Add missing whitespace log message 2017-09-15 12:16:57 +02:00
Tobias Brunner da479ae2c9 child-delete: Only let SAs expire naturally if they not already did 2017-09-15 12:16:45 +02:00
Andreas Steffen c80cec2d5e Version bump to 5.6.1dr2 2017-09-13 16:56:45 +02:00
Andreas Steffen 8aad7ffb11 sec-updater: Import SWID tags of updated packages
sec-updater downloads the deb package files from security updates from
a given linux repository and uses the swid_generator command to
derive a SWID tag. The SWID tag is then imported into strongTNC
using the manage.py importswid command.
2017-09-09 20:23:19 +02:00
Andreas Steffen 33a729fac2 libimcv: Corrected caption 2017-09-09 13:10:45 +02:00
Andreas Steffen 165d28174d pt-tls-client: Introduced --options as a synonym for --optionsfrom 2017-09-09 10:31:02 +02:00
Andreas Steffen 94bdd463d8 sec-updater: Write to log only if at least one update is found. 2017-09-07 14:54:41 +02:00
Tobias Brunner 311d931aef android: New release after adding OCSP, CRL cache and some other stuff 2017-09-04 11:27:40 +02:00
Tobias Brunner 82088028d8 testing: Reduce log level of SSH client
This should suppress the "Permanently added ... to the list of known
hosts" warnings that occasionally come up for no apparent reason.
2017-09-04 11:16:00 +02:00
Tobias Brunner c353996191 ike: Reset local SPI if retrying to connect in state IKE_CONNECTING
In case we send retransmits for an IKE_SA_INIT where we propose a DH
group the responder will reject we might later receive delayed responses
that either contain INVALID_KE_PAYLOAD notifies with the group we already
use or, if we retransmitted an IKE_SA_INIT with the requested group but
then had to restart again, a KE payload with a group different from the
one we proposed.  So far we didn't change the initiator SPI when
restarting the connection, i.e. these delayed responses were processed
and might have caused fatal errors due to a failed DH negotiation or
because of the internal retry counter in the ike-init task.  Changing
the initiator SPI avoids that as we won't process the delayed responses
anymore that caused this confusion.
2017-09-04 11:16:00 +02:00
Tobias Brunner eaedcf8c00 ike-sa-manager: Add method to change the initiator SPI of an IKE_SA 2017-09-04 11:16:00 +02:00
Tobias Brunner bd371590ab ike-init: Fail if DH group in KE payload does not match proposed group 2017-09-04 11:02:55 +02:00
Tobias Brunner 9c03e8c80b Merge branch 'android-updates'
Caches CRLs in the app directory, adds support for OCSP, adds a button
to reconnect to the "already connected" dialog, only apply/configure app
selection on Android >= 5 (older versions don't support the API), and catches
some random exceptions.
2017-09-04 10:44:08 +02:00
Tobias Brunner 1926efadde android: Add disconnect button to dialog if already connected to profile 2017-09-04 10:41:30 +02:00
Tobias Brunner 037b353d2c android: Load x509 plugin to generate OCSP requests and parse responses
BoringSSL does not support OpenSSL's OCSP API.
2017-09-04 10:41:29 +02:00
Tobias Brunner 829cc56a53 android: Add support to POST data via SimpleFetcher
That's required for OCSP verification.
2017-09-04 10:41:29 +02:00
Tobias Brunner 6e39240a3e android: Add option to clear cached CRLs 2017-09-04 10:41:29 +02:00
Tobias Brunner 0bebbae9e3 android: Cache CRLs in app directory
Fixes #2405.
2017-09-04 10:41:25 +02:00
Tobias Brunner 3fe9a436ee android: Pass absolute path to the app's data directory via JNI 2017-09-04 10:41:25 +02:00
Tobias Brunner 98ab757284 android: Hide app selection in profile editor on Android < 5 2017-09-04 10:41:25 +02:00
Tobias Brunner 0b4f7d646b android: Only apply app filter on Android 5 and newer 2017-09-04 10:41:24 +02:00
Tobias Brunner ac3189f792 android: Catch OutOfMemoryError when importing profiles
Not sure if this is actually caused because e.g. the file is too large
or due to some encoding issue.
2017-09-04 10:41:24 +02:00
Tobias Brunner 1a9261a923 android: Catch NullPointerException when parsing invalid certificates 2017-09-04 10:41:24 +02:00
Tobias Brunner e59b78254a android: Catch NullPointerException when calling VpnService.prepare()
According to the Play Console this occurs occasionally.
2017-09-04 10:41:24 +02:00
Andreas Steffen d43b84dcb4 Version bump to 5.6.1dr1 2017-09-01 13:49:09 +02:00
Andreas Steffen fc373b64a6 imv-os: Updated security update evaluation 2017-09-01 12:42:24 +02:00
Andreas Steffen 7b75c18696 libimcv: Updated database scheme 2017-09-01 11:19:40 +02:00
Andreas Steffen b84817375d sec-updater: Checks for security updates
sec-updater checks for security updates and backports in Debian/
Ubuntu repositories and sets the security flags in the strongTNC
policy database accordingly.
2017-09-01 11:19:40 +02:00
Andreas Steffen 076aac7069 imv-attestation: Fixed file hash measurements
The introduction of file versions broke file hash measurements.
This has been fixed by using a generic product versions having an
empty package name.
2017-09-01 10:51:15 +02:00
Tobias Brunner 66805c7b32 ike-cfg: Fix memory leak when checking for configured address 2017-08-29 16:25:42 +02:00
Andreas Steffen d2a89e9407 sw-collector.8: Some cleanups 2017-08-25 11:28:06 +02:00
Tobias Brunner 062a34e722 kernel-netlink: Set usable state whenever an interface appears
If an interface is renamed we already have an entry (based on the
ifindex) allocated but previously only set the usable state once
based on the original name.

Fixes #2403.
2017-08-23 12:10:39 +02:00
Tobias Brunner b7ad5f777f libimcv: Updated Android.mk after move of swid-gen(-info) 2017-08-21 12:17:02 +02:00
Tobias Brunner 0d11d7b110 coverage: Use absolute path when removing paths with lcov
There is a bug in some versions of lcov that causes it to fail writing
to files via relative paths after it issued warnings (e.g. due to
negative counts in the tracefile).
2017-08-21 11:14:08 +02:00
Tobias Brunner 9cf2920512 traffic-selector: Use single buffer for both address families
The generic field of size 0 in the union that was used previously
triggered index-out-of-bounds errors with the UBSAN sanitizer that's
used on OSS-Fuzz.  Since the two family specific union members don't
really provide any advantage, we can just use a single buffer for both
families to avoid the errors.
2017-08-17 12:34:40 +02:00
Tobias Brunner 936db031c7 testing: Make removal of SWID tags work with different releases
The regid.2004-03.org.strongswan directory might not exist in new images.
2017-08-16 10:51:15 +02:00
Tobias Brunner bf31485e1e fuzzing: Also run input that previously caused crashes 2017-08-15 10:35:20 +02:00
Tobias Brunner 17840fa18e configure: Detect mpz_powm_sec() when built with -Werror 2017-08-15 10:35:20 +02:00
Tobias Brunner 7421884da1 travis: Use the same ASAN_OPTIONS as used by OSS-Fuzz 2017-08-15 10:35:20 +02:00
Tobias Brunner ed13c60c4f plugin-loader: Move indent variables into !USE_FUZZING block
This avoids compile errors on Travis.
2017-08-15 10:35:20 +02:00
Tobias Brunner 1ce2721d90 travis: Run fuzz targets 2017-08-15 10:35:20 +02:00
Tobias Brunner 9f2e74cfbb fuzzing: Run local fuzz targets on given corpora during `make check`
The base directory of the corpora must be set in FUZZING_CORPORA.
2017-08-15 10:35:20 +02:00
Tobias Brunner be1beea7a4 fuzzing: Add driver to run fuzz targets on a given list of files
This is enabled if the path to libFuzzer.a is not specified when running
the configure script.
2017-08-15 10:35:20 +02:00
Adrian-Ken Rueegsegger c15dbfaf08 charon-tkm: Build fix for kernel SAD tests
Commit 7729577... added a flag to the get_esa_id function but the unit
tests were not adjusted.
2017-08-14 18:35:37 +02:00
8796 changed files with 181974 additions and 95353 deletions

View File

@ -1,5 +1,10 @@
clone_depth: 50
image:
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019
environment:
global:
TESTS_REDUCED_KEYLENGTHS: yes
@ -14,12 +19,21 @@ environment:
# bits: 32
install:
- tzutil /s "Central European Standard Time"
- set MSYS_SH=C:\msys%BITS%\usr\bin\sh.exe
- set MSYSTEM=MINGW%BITS%
- set TEST=win%BITS%
- |
set IMG=%APPVEYOR_BUILD_WORKER_IMAGE:~-4%
set OPENSSL=OpenSSL
IF "%IMG%" == "2017" set OPENSSL=OpenSSL-v11
IF "%IMG%" == "2019" set OPENSSL=OpenSSL-v111
set OPENSSL_DIR=/c/%OPENSSL%-%TEST%
C:\%OPENSSL%-%TEST%\bin\openssl.exe version -a
build_script:
- '%MSYS_SH% --login -c ". /etc/profile && cd $APPVEYOR_BUILD_FOLDER && ./scripts/test.sh deps"'
test_script:
- '%MSYS_SH% --login -c ". /etc/profile && touch /$MSYSTEM/etc/strongswan.conf"'
- '%MSYS_SH% --login -c ". /etc/profile && cd $APPVEYOR_BUILD_FOLDER && ./scripts/test.sh"'

13
.cirrus.yml Normal file
View File

@ -0,0 +1,13 @@
freebsd_instance:
image_family: freebsd-12-2
env:
TESTS_REDUCED_KEYLENGTHS: yes
LEAK_DETECTIVE: no
MONOLITHIC: no
TEST: freebsd
OS_NAME: freebsd
task:
install_script: ./scripts/test.sh deps
script: ./scripts/test.sh

54
.editorconfig Normal file
View File

@ -0,0 +1,54 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
# for alignment reasons the last tab may be replaced with < indent_size spaces,
# which we currently can't configure here
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
block_comment_start = /*
block_comment = *
block_comment_end = */
# don't change these files
[{doc/**,src/include/{linux,sys}/**,testing/{hosts,tests}/**,AUTHORS,COPYING}]
charset = unset
indent_style = unset
indent_size = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
# never trim whitespace in patches, everything else should not be changed
[*.patch]
trim_trailing_whitespace = false
charset = unset
indent_style = unset
indent_size = unset
end_of_line = unset
insert_final_newline = unset
[{.*,NEWS,README,INSTALL,*.{gemspec.in,pod,rb,ui}}]
indent_style = space
indent_size = 2
[*.{gpr,adb,ads}]
indent_style = space
indent_size = 3
line_comment = --
[{*.{md,gradle,xml},HACKING}]
indent_style = space
indent_size = 4
[src/libcharon/plugins/vici/README.md]
indent_style = tab
[src/libcharon/plugins/vici/**/*.{rst,PL,pm,py}]
indent_style = space
indent_size = 4

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,35 @@
---
name: "🐛 Bug report"
about: Report a reproducible bug or regression
labels: bug, needs triage
---
<!--
IMPORTANT: Please use the [discussion forum](https://github.com/strongswan/strongswan/discussions)
for questions and configuration problems etc., only report actual bugs here.
Your issue will otherwise be closed immediately.
-->
**System (please complete the following information):**
- OS: [e.g. Ubuntu 20.04]
- Kernel version (if applicable): [e.g. 5.10]
- strongSwan version(s): [e.g. 5.9.2]
- Tested/confirmed with the latest version: [yes/no]
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. ...
2. ...
3. ...
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs/Backtraces**
If applicable, add logs or backtraces to help explain your problem.
**Additional context**
Add any other context about the problem here.

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: "🤔 Question and Help"
url: https://github.com/strongswan/strongswan/discussions
about: This issue tracker is not for support questions. Please refer to the strongSwan community's help and discussion forum

View File

@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
labels: enhancement, needs triage
---
<!--
IMPORTANT: Please consider discussing the requested feature in the
[forum](https://github.com/strongswan/strongswan/discussions) first.
-->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions, workarounds or
features you've considered.
**Additional context**
Add any other context about the feature request here.

16
.github/actions/default/action.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: "Default CI Build Steps"
runs:
using: "composite"
steps:
- name: "Install Dependencies"
run: ./scripts/test.sh deps
shell: bash
- name: "Install Python Dependencies"
run: ./scripts/test.sh pydeps
shell: bash
- name: "Build Dependencies"
run: ./scripts/test.sh build-deps
shell: bash
- name: "Build/Tests"
run: ./scripts/test.sh
shell: bash

54
.github/workflows/android.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Android
on: [push, pull_request]
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 400M
CC: gcc
OS_NAME: linux
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
android:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
env:
TEST: android
# since the NDK is newly installed every time, we have to use this to avoid cache misses
CCACHE_COMPILERCHECK: content
steps:
# even though we don't specify a specific version in our gradle files, the
# build fails without this because some arbitrary NDK version, that's
# weirdly not installed, is requested
- name: Install NDK
run: yes | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install 'ndk;21.0.6113669'
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-android-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-android-${{ github.ref }}:
ccache-android-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- uses: actions/upload-artifact@v2
with:
name: Lint Results
path: src/frontends/android/app/build/reports/lint-results.xml

37
.github/workflows/lgtm.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: lgtm.com
on: [push]
env:
OS_NAME: linux
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
lgtm:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
env:
TEST: lgtm
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# we don't use github/codeql-action because we can't exclude queries there,
# so we continue to use the approach we used on Travis
- env:
LGTM_TOKEN: ${{ secrets.LGTM_TOKEN }}
LGTM_PROJECT: ${{ secrets.LGTM_PROJECT }}
BUILD_NUMBER: ${{ github.run_id }}
COMMIT_ID: ${{ github.sha }}
COMMIT_BASE: ${{ github.event.before }}
uses: ./.github/actions/default

200
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,200 @@
name: Linux
on: [push, pull_request]
env:
# this test case does not actually test anything but tries to access system
# directories that might be inaccessible on build hosts
TESTS_CASES_EXCLUDE: sw_collector
TESTS_REDUCED_KEYLENGTHS: yes
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 200M
OS_NAME: linux
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
latest:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
test: [ all, default, printf-builtin ]
compiler: [ gcc, clang ]
leak-detective: [ no, yes ]
monolithic: [ no, yes ]
exclude:
# leaks will show up whether we build monolithic or not
- leak-detective: yes
monolithic: yes
# monolithic builds don't affect the printf-hook implementation
- test: printf-builtin
monolithic: yes
include:
- test: apidoc
- test: coverage
- test: dist
- test: nm-no-glib
- test: fuzzing
compiler: clang
monolithic: yes
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
MONOLITHIC: ${{ matrix.monolithic || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
# with regards to ccache, monolithic builds don't differ from regular
# builds and, similarly, builds with leak-detective only differ in two
# files (LD itself and library.c); but different tests build different
# dependencies, so different caches are needed
key: ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-
ccache-${{ runner.os }}-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ success() && matrix.test == 'coverage' }}
run: bash <(curl -s https://codecov.io/bash)
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5
crypto-plugins:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
test: [ botan, wolfssl, openssl, gcrypt ]
leak-detective: [ no, yes ]
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-
ccache-${{ runner.os }}-${{ env.CC }}-
ccache-${{ runner.os }}-${{ env.CC }}-all-${{ github.ref }}:${{ github.sha }}
ccache-${{ runner.os }}-${{ env.CC }}-all-${{ github.ref }}:
ccache-${{ runner.os }}-${{ env.CC }}-all-
ccache-${{ runner.os }}-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5
bionic:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-18.04
strategy:
matrix:
test: [ all ]
compiler: [ gcc, clang ]
include:
- test: nm
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
UBUNTU_BIONIC: yes
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-bionic-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-bionic-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
ccache-bionic-${{ env.CC }}-${{ matrix.test }}-
ccache-bionic-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5
xenial:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-16.04
strategy:
matrix:
test: [ all ]
compiler: [ gcc, clang ]
include:
- test: openssl-1.0
- test: openssl-1.0
leak-detective: yes
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
# this is the default with newer versions and fixes builds with clang
CCACHE_CPP2: true
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-xenial-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-xenial-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
ccache-xenial-${{ env.CC }}-${{ matrix.test }}-
ccache-xenial-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5

49
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: macOS
on: [push, pull_request]
env:
TESTS_REDUCED_KEYLENGTHS: yes
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 100M
OS_NAME: macos
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
macos:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: macos-latest
env:
TEST: macos
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/Library/Caches/ccache
key: ccache-${{ runner.os }}-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ github.ref }}:
ccache-${{ runner.os }}-
- run: |
brew install ccache
echo "PATH=$(brew --prefix)/opt/ccache/libexec:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5

65
.github/workflows/sonarcloud.yml vendored Normal file
View File

@ -0,0 +1,65 @@
name: SonarCloud
on: [push]
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 200M
OS_NAME: linux
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
sonarcloud:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
env:
TEST: sonarcloud
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/cache@v2
with:
path: |
~/.ccache
~/.sonar-cache
key: ccache-sonarcloud-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-sonarcloud-${{ github.ref }}:
ccache-sonarcloud-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
# using SonarSource/sonarcloud-github-action is currently not recommended
# for C builds, so we follow the "any CI" instructions
- name: Install sonar-scanner
env:
SONAR_SCANNER_VERSION: 4.4.0.2170
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "SONAR_SCANNER_OPTS=-server" >> $GITHUB_ENV
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "PATH=$HOME/.sonar/build-wrapper-linux-x86:$SONAR_SCANNER_HOME/bin:$PATH" >> $GITHUB_ENV
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_id }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT: ${{ secrets.SONAR_PROJECT }}
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
uses: ./.github/actions/default
- run: ccache -s

56
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: Windows
on: [push, pull_request]
env:
TESTS_REDUCED_KEYLENGTHS: yes
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 200M
# since the compilers are newly installed every time, we have to use this to
# avoid cache misses
CCACHE_COMPILERCHECK: content
MONOLITHIC: yes
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
cross-compile:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
test: [ win64, win32 ]
env:
OS_NAME: linux
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ matrix.test }}-${{ github.ref }}:
ccache-${{ runner.os }}-${{ matrix.test }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5

1
.gitignore vendored
View File

@ -30,6 +30,7 @@ lex.yy.c
plugin_constructors.c
Doxyfile
apidoc/
fuzzing-corpora/
*~
*.orig
*.patch

46
.lgtm.yml Normal file
View File

@ -0,0 +1,46 @@
queries:
- exclude: cpp/fixme-comment
# this rule produces too many false positives due to our custom specifiers and
# the use of void pointers in swanctl
- exclude: cpp/wrong-type-format-argument
extraction:
cpp:
prepare:
packages:
# for tss2
- libssl-dev
- libjson-c-dev
- libcurl4-openssl-dev
after_prepare:
- export DEPS_BUILD_DIR=$LGTM_WORKSPACE/deps
- mkdir -p $DEPS_BUILD_DIR
- export DEPS_PREFIX=$DEPS_BUILD_DIR/usr
- mkdir -p $DEPS_PREFIX
- export PKG_CONFIG_PATH="$DEPS_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
- export LD_LIBRARY_PATH="$DEPS_PREFIX/lib:$LD_LIBRARY_PATH"
- mkdir -p $LGTM_WORKSPACE/bin
# sudo doesn't work on the build hosts
- ln -s /usr/bin/nice $LGTM_WORKSPACE/bin/sudo
# for ldconfig we don't have enough permissions
- ln -s /bin/true $LGTM_WORKSPACE/bin/ldconfig
# likewise for apt-get
- ln -s /bin/echo $LGTM_WORKSPACE/bin/apt-get
- export PATH=$LGTM_WORKSPACE/bin:$PATH
- export TEST=all
- ./scripts/test.sh build-deps
- rm $LGTM_WORKSPACE/bin/*
configure:
command:
# follows the "all" build in test.sh (without custom-compiled stuff)
- ./autogen.sh
- ./configure --enable-all --disable-android-dns --disable-android-log
--disable-kernel-pfroute --disable-keychain
--disable-lock-profiler --disable-padlock --disable-fuzzing
--disable-osx-attr --disable-tkm --disable-uci
--disable-unwind-backtraces
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp
--disable-af-alg --disable-coverage
--disable-python-eggs-install
--disable-monolithic --disable-leak-detective

View File

@ -0,0 +1,51 @@
/**
* @name Invalid use of chunk_from_chars() macro
* @description The chunk_from_chars() macro creates a temporary chunk_t, which
* is not defined outside of the block in which it has been used,
* therefore, compilers might optimize out the assignment.
* @kind path-problem
* @problem.severity error
* @id strongswan/invalid-chunk-from-chars
* @tags correctness
* @precision very-high
*/
import cpp
import DataFlow::PathGraph
import semmle.code.cpp.dataflow.DataFlow
class ChunkFromChars extends Expr {
ChunkFromChars() {
this = any(MacroInvocation mi |
mi.getOutermostMacroAccess().getMacroName() = "chunk_from_chars"
/* ignore global static uses of the macro */
and exists (Block b | mi.getExpr().getEnclosingBlock() = b)
).getExpr()
}
}
class ChunkFromCharsUsage extends DataFlow::Configuration {
ChunkFromCharsUsage() { this = "ChunkFromCharsUsage" }
override predicate isSource(DataFlow::Node source) {
source.asExpr() instanceof ChunkFromChars
}
override predicate isSink(DataFlow::Node sink) {
exists(sink.asExpr())
}
override predicate isBarrierOut(DataFlow::Node node) {
/* don't track beyond function calls */
exists(FunctionCall fc | node.asExpr().getParent*() = fc)
}
}
Block enclosingBlock(Block b) {
result = b.getEnclosingBlock()
}
from ChunkFromCharsUsage usage, DataFlow::PathNode source, DataFlow::PathNode sink
where
usage.hasFlowPath(source, sink)
and not source.getNode().asExpr().getEnclosingBlock() = enclosingBlock*(sink.getNode().asExpr().getEnclosingBlock())
select source, source, sink, "Invalid use of chunk_from_chars() result in sibling/parent block."

View File

@ -1,65 +0,0 @@
language: c
sudo: required
dist: trusty
compiler:
- gcc
- clang
before_install:
- ./scripts/test.sh deps
- ./scripts/test.sh pydeps
before_script:
- sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 || true
script:
- ./scripts/test.sh
after_success:
if [ "$TEST" == "coverage" ]; then
bash <(curl -s https://codecov.io/bash);
fi
after_failure:
- cat config.log
env:
global:
- TESTS_REDUCED_KEYLENGTHS=yes
- LEAK_DETECTIVE=no
- MONOLITHIC=no
matrix:
- TEST=default
- TEST=default MONOLITHIC=yes
- TEST=default LEAK_DETECTIVE=yes
- TEST=openssl
- TEST=openssl LEAK_DETECTIVE=yes
- TEST=gcrypt
- TEST=gcrypt LEAK_DETECTIVE=yes
# we can't test Vstr as negative int args are not properly passed to CBs
- TEST=printf-builtin
- TEST=printf-builtin LEAK_DETECTIVE=yes
- TEST=all
- TEST=all MONOLITHIC=yes
- TEST=all LEAK_DETECTIVE=yes
matrix:
include:
- compiler: gcc
env: TEST=dist
- compiler: gcc
env: TEST=apidoc
- compiler: gcc
env: TEST=coverage
- compiler: gcc
env: TEST=win64 MONOLITHIC=yes
# this does not work on 14.04 due to a missing @4 decoration for
# TryAcquireSRWLockExclusive in MinGW 3.1.0
- compiler: gcc
env: TEST=win32 MONOLITHIC=yes
dist: precise
- compiler: clang
os: osx
env: TEST=osx

View File

@ -29,8 +29,8 @@ strongswan_STARTER_PLUGINS := kernel-netlink
# list of all plugins - used to enable them with the function below
strongswan_PLUGINS := $(sort $(strongswan_CHARON_PLUGINS) \
$(strongswan_STARTER_PLUGINS) \
$(strongswan_SCEPCLIENT_PLUGINS))
$(strongswan_STARTER_PLUGINS) \
$(strongswan_SCEPCLIENT_PLUGINS))
include $(LOCAL_PATH)/Android.common.mk

2
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,2 @@
Please refer to the [developer documentation](https://wiki.strongswan.org/projects/strongswan/wiki/DeveloperDocumentation)
on our wiki for details regarding **code style** and [**contribution requirements**](https://wiki.strongswan.org/projects/strongswan/wiki/Contributions).

View File

@ -1,3 +1,5 @@
A summary of changes is available in the NEWS file. For a more
detailed Changelog, use the repository (see HACKING) or the
online interface available at http://git.strongswan.org.
A summary of changes is available in the NEWS file. For a more
detailed Changelog, refer to the completed versions on the project's roadmap
(https://wiki.strongswan.org/projects/strongswan/roadmap) or use the Git
repository (see HACKING) or its web interface available at
https://git.strongswan.org.

View File

@ -1789,18 +1789,6 @@ GENERATE_XML = NO
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_SCHEMA =
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
@ -2002,12 +1990,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
@ -2021,15 +2003,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.

14
HACKING
View File

@ -1,6 +1,6 @@
-------------------------
strongSwan - Development
-------------------------
------------------------
strongSwan - Development
------------------------
Git repository
---------------------
@ -27,11 +27,11 @@ the code, you need the following tools:
To check out the master branch, use:
git clone git://git.strongswan.org/strongswan.git
git clone git://git.strongswan.org/strongswan.git
or using HTTP
or using HTTP:
git clone http://git.strongswan.org/strongswan.git
git clone https://git.strongswan.org/strongswan.git
After a successful check out, give the autotools a try:
@ -58,5 +58,5 @@ strongSwan wiki
A wiki for users and developers, including ticket system and source browser
is available at
http://wiki.strongswan.org
https://wiki.strongswan.org

24
INSTALL
View File

@ -1,18 +1,18 @@
---------------------------
strongSwan - Installation
---------------------------
-------------------------
strongSwan - Installation
-------------------------
Contents
--------
1. Overview
2. Required packages
3. Optional packages
3.1 HTTP fetcher
3.2 LDAP
3.3 Other pluggable modules
4. Kernel configuration
1. Overview
2. Required packages
3. Optional packages
3.1 HTTP fetcher
3.2 LDAP
3.3 Other pluggable modules
4. Kernel configuration
1. Overview
--------
@ -104,7 +104,7 @@ Contents
In order to activate the use of the libldap library in strongSwan you must
enable the ./configure switch:
./configure [...] --enable-ldap
./configure [...] --enable-ldap
LDAP Protocol version 2 is not supported anymore, --enable-ldap uses always
version 3 of the LDAP protocol
@ -144,5 +144,5 @@ Contents
For a more up-to-date list of recommended modules refer to:
* http://wiki.strongswan.org/projects/strongswan/wiki/KernelModules
* http://wiki.strongswan.org/projects/strongswan/wiki/KernelModules

View File

@ -24,6 +24,11 @@ config_includedir = $(ipseclibdir)/include
nodist_config_include_HEADERS = config.h
endif
# we can't (and shouldn't) install/uninstall system files during make distcheck,
# so override the autodetected path for systemd units
AM_DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir='$$(prefix)/lib/systemd/system'
# we leave config files behind intentionally so prevent distcheck from complaining
distuninstallcheck_listfiles = find . -type f \! -name '*.conf' \! -name '*.secrets' -print
@ -33,6 +38,9 @@ Android.common.mk : Android.common.mk.in configure.ac
-e "s:\@PACKAGE_VERSION\@:$(PACKAGE_VERSION):" \
$(srcdir)/$@.in > $@
dist-hook:
@echo $(GIT_VERSION) > $(distdir)/.tarball-git-version
Doxyfile : Doxyfile.in
$(AM_V_GEN) \
sed \
@ -59,7 +67,7 @@ cov-report:
lcov -c -o $(top_builddir)/coverage/coverage.info -d $(top_builddir) \
--rc lcov_branch_coverage=1
lcov -r $(top_builddir)/coverage/coverage.info '*/tests/*' '*/suites/*' '/usr*' \
-o $(top_builddir)/coverage/coverage.cleaned.info \
-o $(abs_top_builddir)/coverage/coverage.cleaned.info \
--rc lcov_branch_coverage=1
genhtml --num-spaces 4 --legend --branch-coverage --ignore-errors source \
-t "$(PACKAGE_STRING)" \

687
NEWS
View File

@ -1,3 +1,612 @@
strongswan-5.9.3
----------------
- Added AES_ECB, SHA-3 and SHAKE-256 support to wolfssl plugin.
- Added AES_CCM and SHA-3 signature support to openssl plugin.
- The x509 and openssl plugins now consider the authorityKeyIdentifier, if
available, before verifying signatures, which avoids unnecessary signature
verifications after a CA key rollover if both certificates are loaded.
- The pkcs11 plugin better handles optional attributes like CKA_TRUSTED, which
previously depended on a version check.
- charon-nm now supports using SANs as client identities, not only full DNs.
- charon-tkm now handles IKE encryption.
- A MOBIKE update is sent again if a a change in the NAT mappings is detected
but the endpoints stay the same.
- Converted most of the test case scenarios to the vici interface
strongswan-5.9.2
----------------
- Together with a Linux 5.8 kernel supporting the IMA measurement of the GRUB
bootloader and the Linux kernel, the strongSwan Attestation IMC allows to do
remote attestation of the complete boot phase. A recent TPM 2.0 device with a
SHA-256 PCR bank is required, so that both BIOS and IMA file measurements are
based on SHA-256 hashes.
- Our own TLS library (libtls) that we use for TLS-based EAP methods and PT-TLS
gained experimental support for TLS 1.3. Thanks to Méline Sieber (client) and
Pascal Knecht (client and server) for their work on this.
Because the use of TLS 1.3 with these EAP methods is not yet standardized (two
Internet-Drafts are being worked on), the default maximum version is currently
set to TLS 1.2, which is now also the default minimum version. However the TNC
test scenarios using PT-TLS transport already use TLS 1.3.
- Other improvements for libtls also affect older TLS versions. For instance, we
added support for ECDH with Curve25519/448 (DH groups may also be configured
now), for EdDSA keys and certificates and for RSA-PSS signatures. Support for
old and weak cipher suites has been removed (e.g. with 3DES and MD5) as well
as signature schemes with SHA-1.
- The listener_t::ike_update event is now also called for MOBIKE updates. Its
signature has changed so we only have to call it once if both addresses/ports
have changed (e.g. for an address family switch). The event is now also
exposed via vici.
- The farp plugin has been ported to macOS and FreeBSD. Thanks to Dan James for
working on this.
- To fix DNS server installation with systemd-resolved, charon-nm now creates a
dummy TUN device again (was removed with 5.5.1).
- The botan plugin can use rng_t implementations provided by other plugins when
generating keys etc. if the Botan library supports it.
- charon-tkm now supports multiple CAs and is configured via vici/swanctl.
- Simple glob patterns (e.g. include conf.d/*.conf) now also work on Windows.
Handling of forward slashes in paths on Windows has also been improved.
- The abbreviations for the 'surname' and 'serial number' RDNs in ASN.1 DNs have
been changed to align with RFC 4519: The abbreviation for 'surname' is now
"SN" (was "S" before), which was previously used for 'serial number' that can
now be specified as "serialNumber" only.
- An issue with Windows clients requesting previous IPv6 but not IPv4 virtual
IP addresses has been fixed.
- ike_sa_manager_t: Checking out IKE_SAs by config is now atomic (e.g. when
acquires for different children of the same connection arrive concurrently).
The checkout_new() method has been renamed to create_new(). A new
checkout_new() method allows registering a new IKE_SA with the manager before
checking it in, so jobs can be queued without losing them as they can block
on checking out the new SA.
strongswan-5.9.1
----------------
- Remote attestation via TNC supports the SHA-256 based TPM 2.0 BIOS/EFI
measurements introduced with the Linux 5.4 kernel.
- Nonces in OCSP responses are not enforced anymore and only validated if a
nonce is actually contained.
- Fixed an issue when only some fragments of a retransmitted IKEv2 message were
received, which prevented processing a following fragmented message.
- All queued vici messages are now sent to subscribed clients during shutdown,
which includes ike/child-updown events triggered when all SAs are deleted.
- CHILD_SA IP addresses are updated before installation to allow MOBIKE updates
while retransmitting a CREATE_CHILD_SA request.
- When looking for a route to the peer, the kernel-netlink plugin ignores the
current source address if it's deprecated.
- The file and syslog loggers support logging the log level of each message
after the subsystem (e.g. [IKE2]).
- charon-nm is now properly terminated during system shutdown.
- Improved support for EdDSA keys in vici/swanctl, in particular, encrypted
keys are now supported.
- A new global strongswan.conf option allows sending the Cisco FlexVPN vendor ID
to prevent Cisco devices from narrowing a 0.0.0.0/0 traffic selector.
- The openssl plugin accepts CRLs issued by non-CA certificates if they contain
the cRLSign keyUsage flag (the x509 plugin already does this since 4.5.1).
- Attributes in PKCS#7 containers, as used in SCEP, are now properly
DER-encoded, i.e. sorted.
- The load-tester plugin now supports virtual IPv6 addresses and IPv6 source
address pools.
strongswan-5.9.0
----------------
- We prefer AEAD algorithms for ESP and therefore put AES-GCM in a default AEAD
proposal in front of the previous default proposal.
- The NM backend now clears cached credentials when disconnecting, has DPD and
and close action set to restart, and supports custom remote TS via 'remote-ts'
option (no GUI support).
- The pkcs11 plugin falls back to software hashing for PKCS#1v1.5 RSA signatures
if mechanisms with hashing (e.g. CKM_SHA256_RSA_PKCS) are not supported.
- The owner/group of log files is now set so the daemon can reopen them if the
config is reloaded and it doesn't run as root.
- The wolfssl plugin (with wolfSSL 4.4.0+) supports x448 DH and Ed448 keys.
- The vici plugin stores all CA certificates in one location, which avoids
issues with unloading authority sections or clearing all credentials.
- When unloading a vici connection with start_action=start, any related IKE_SAs
without children are now terminated (including those in CONNECTING state).
- The hashtable implementation has been changed so it maintains insertion order.
This was mainly done so the vici plugin can store its connections in a
hashtable, which makes managing high numbers of connections faster.
- The default maximum size for vici messages (512 KiB) can now be changed via
VICI_MESSAGE_SIZE_MAX compile option.
- The charon.check_current_path option allows forcing a DPD exchange to check if
the current path still works whenever interface/address-changes are detected.
- It's possible to use clocks other than CLOCK_MONOTONIC (e.g. CLOCK_BOOTTIME)
via TIME_CLOCK_ID compile option if clock_gettime() is available and
pthread_condattr_setclock() supports that clock.
- Test cases and functions can now be filtered when running the unit tests.
strongswan-5.8.4
----------------
- In IKEv1 Quick Mode make sure that a proposal exists before determining
lifetimes (fixes crash due to null pointer exception).
- OpenSSL currently doesn't support squeezing bytes out of a SHAKE128/256
XOF (eXtended Output Function) multiple times. Unfortunately,
EVP_DigestFinalXOF() completely resets the context and later calls not
simply fail, they cause a null-pointer dereference in libcrypto. This
fixes the crash at the cost of repeating initializing the whole state
and allocating too much data for subsequent calls.
strongswan-5.8.3
----------------
- Updates for the NM backend (and plugin), among others: EAP-TLS authentication,
configurable local and remote IKE identities, custom server port, redirection
and reauthentication support.
- Previously used reqids are now reallocated to workaround an issue on FreeBSD
where the daemon can't use reqids > 16383.
- On Linux, throw type routes are installed for passthrough policies. They act
as fallbacks on routes in other tables and require less information, so they
can be installed earlier and are not affected by updates.
- For IKEv1, the lifetimes of the selected transform are returned to the
initiator, which is an issue with peers that propose different lifetimes in
different transforms. We also return the correct transform and proposal IDs.
- IKE_SAs are not re-established anymore if a deletion has been queued.
- Added support for Ed448 keys and certificates via openssl plugin and pki tool.
The openssl plugin also supports SHA-3 and SHAKE128/256.
- The use of algorithm IDs from the private use ranges can now be enabled
globally, to use them even if no strongSwan vendor ID was exchanged.
strongswan-5.8.2
----------------
- Identity-based CA constraints are supported via vici/swanctl.conf. They
enforce that the remote's certificate chain contains a CA certificate with a
specific identity. While similar to the existing CA constraints, they don't
require that the CA certificate is locally installed such as intermediate CA
certificates received from peers. Compared to wildcard identity matching (e.g.
"..., OU=Research, CN=*") this requires less trust in the intermediate CAs (to
only issue certificates with legitimate subject DNs) as long as path length
basic constraints prevent them from issuing further intermediate CAs.
- Intermediate CA certificates may now be sent in hash-and-URL encoding by
configuring a base URL for the parent CA.
- Implemented NIST SP-800-90A Deterministic Random Bit Generator (DRBG)
based on AES-CTR and SHA2-HMAC modes. Currently used by gmp and ntru plugins.
- Random nonces sent in an OCSP requests are now expected in the corresponding
OCSP responses.
- The kernel-netlink plugin ignores deprecated IPv6 addresses for MOBIKE.
Whether temporary or permanent IPv6 addresses are included depends on the
charon.prefer_temporary_addrs setting.
- Extended Sequence Numbers (ESN) are configured via PF_KEY if supported by the
kernel.
- Unique section names are used for CHILD_SAs in vici child-updown events and
more information (e.g. statistics) are included for individually deleted
CHILD_SAs (in particular for IKEv1).
- So fallbacks to other plugins work properly, creating HMACs via openssl plugin
now fails instantly if the underlying hash algorithm isn't supported (e.g.
MD5 in FIPS-mode).
- Exponents of RSA keys read from TPM 2.0 via SAPI are now correctly converted.
- Routing table IDs > 255 are supported for custom routes on Linux.
- The D-Bus config file for charon-nm is now installed in
$(datadir)/dbus-1/system.d instead of $(sysconfdir)/dbus-1/system.d.
- INVALID_MAJOR_VERSION notifies are now correctly sent in messages of the same
exchange type and using the same message ID as the request.
- IKEv2 SAs are immediately destroyed when sending or receiving INVALID_SYNTAX
notifies in authenticated messages.
strongswan-5.8.1
----------------
- RDNs in Distinguished Names can now optionally be matched less strict. The
global option charon.rdn_matching takes two alternative values that cause the
matching algorithm to either ignore the order of matched RDNs or additionally
accept DNs that contain more RDNs than configured (unmatched RDNs are treated
like wildcard matches).
- The updown plugin now passes the same interface to the script that is also
used for the automatically installed routes, i.e. the interface over which the
peer is reached instead of the interface on which the local address is found.
- TPM 2.0 contexts are now protected by a mutex to prevent issues if multiple
IKE_SAs use the same private key concurrently.
strongswan-5.8.0
----------------
- The systemd service units have been renamed. The modern unit, which was called
strongswan-swanctl, is now called strongswan (the previous name is configured
as alias). The legacy unit is now called strongswan-starter.
- Support for XFRM interfaces (available since Linux 4.19) has been added.
Configuration is possible via swanctl.conf. Interfaces may be created
dynamically via updown/vici scripts, or statically before or after
establishing the SAs. Routes must be added manually as needed (the daemon will
not install any routes for outbound policies with an interface ID).
- Initiation of childless IKE_SAs is supported (RFC 6023). If enabled and
supported by the responder, no CHILD_SA is established during IKE_AUTH. This
allows using a separate DH exchange even for the first CHILD_SA, which is
otherwise created with keys derived from the IKE_SA's key material.
- The NetworkManager backend and plugin support IPv6.
- The new wolfssl plugin is a wrapper around the wolfSSL crypto library. Thanks
to Sean Parkinson of wolfSSL Inc. for the initial patch.
- IKE SPIs may optionally be labeled via the charon.spi_mask|label options. This
feature was extracted from charon-tkm, however, now applies the mask/label in
network order.
- The openssl plugin supports ChaCha20-Poly1305 when built with OpenSSL 1.1.0.
- The PB-TNC finite state machine according to section 3.2 of RFC 5793 was not
correctly implemented when sending either a CRETRY or SRETRY batch. These
batches can only be sent in the "Decided" state and a CRETRY batch can
immediately carry all messages usually transported by a CDATA batch. It is
currently not possible to send a SRETRY batch since full-duplex mode for
PT-TLS transport is not supported.
- Instead of marking virtual IPv6 addresses as deprecated, the kernel-netlink
plugin uses address labels to avoid their use for non-VPN traffic.
- The agent plugin creates sockets to the ssh/gpg-agent dynamically and does not
keep them open, which otherwise can prevent the agent from getting terminated.
- To avoid broadcast loops the forecast plugin now only reinjects packets that
are marked or received from the configured interface.
- UTF-8 encoded passwords are supported via EAP-MSCHAPv2, which internally uses
an UTF-16LE encoding to calculate the NT hash.
- Adds the build-certs script to generate the keys and certificates used for
regression tests dynamically. They are built with the pki version installed
in the KVM root image so it's not necessary to have an up-to-date version with
all required plugins installed on the host system.
strongswan-5.7.2
----------------
- Private key implementations may optionally provide a list of supported
signature schemes, which is used by the tpm plugin because for each key on a
TPM 2.0 the hash algorithm and for RSA also the padding scheme is predefined.
- For RSA with PSS padding, the TPM 2.0 specification mandates the maximum salt
length (as defined by the length of the key and hash). However, if the TPM is
FIPS-168-4 compliant, the salt length equals the hash length. This is assumed
for FIPS-140-2 compliant TPMs, but if that's not the case, it might be
necessary to manually enable charon.plugins.tpm.fips_186_4 if the TPM doesn't
use the maximum salt length.
- swanctl now accesses directories for credentials relative to swanctl.conf, in
particular, when it's loaded from a custom location via --file argument. The
base directory that's used if --file is not given is configurable at runtime
via SWANCTL_DIR environment variable.
- With RADIUS Accounting enabled, the eap-radius plugin adds the session ID to
Access-Request messages, simplifying associating database entries for IP
leases and accounting with sessions.
- IPs assigned by RADIUS servers are included in Accounting-Stop even if clients
don't claim them, allowing releasing them early on connection errors.
- Selectors installed on transport mode SAs by the kernel-netlink plugin are
updated on IP address changes (e.g. via MOBIKE).
- Added support for RSA signatures with SHA-256 and SHA-512 to the agent plugin.
For older versions of ssh/gpg-agent that only support SHA-1, IKEv2 signature
authentication has to be disabled via charon.signature_authentication.
- The sshkey and agent plugins support Ed25519/Ed448 SSH keys and signatures.
- The openssl plugin supports X25519/X448 Diffie-Hellman and Ed25519/Ed448 keys
and signatures when built against OpenSSL 1.1.1.
- Ed25519, ChaCha20/Poly1305, SHA-3 and AES-CCM were added to the botan plugin.
- The mysql plugin now properly handles database connections with transactions
under heavy load.
- IP addresses in HA pools are now distributed evenly among all segments.
- On newer FreeBSD kernels, the kernel-pfkey plugin reads the reqid directly
from SADB_ACQUIRE messages, i.e. not requiring previous policy installation by
the plugin, e.g. for compatibility with if_ipsec(4) VTIs.
strongswan-5.7.1
----------------
- Fixes a vulnerability in the gmp plugin triggered by crafted certificates with
RSA keys with very small moduli. When verifying signatures with such keys,
the code patched with the fix for CVE-2018-16151/2 caused an integer underflow
and subsequent heap buffer overflow that results in a crash of the daemon.
The vulnerability has been registered as CVE-2018-17540.
strongswan-5.7.0
----------------
- Fixes a potential authorization bypass vulnerability in the gmp plugin that
was caused by a too lenient verification of PKCS#1 v1.5 signatures. Several
flaws could be exploited by a Bleichenbacher-style attack to forge signatures
for low-exponent keys (i.e. with e=3). CVE-2018-16151 has been assigned to
the problem of accepting random bytes after the OID of the hash function in
such signatures, and CVE-2018-16152 has been assigned to the issue of not
verifying that the parameters in the ASN.1 algorithmIdentifier structure is
empty. Other flaws that don't lead to a vulnerability directly (e.g. not
checking for at least 8 bytes of padding) have no separate CVE assigned.
- Dots are not allowed anymore in section names in swanctl.conf and
strongswan.conf. This mainly affects the configuration of file loggers. If the
path for such a log file contains dots it now has to be configured in the new
`path` setting within the arbitrarily renamed subsection in the `filelog`
section.
- Sections in swanctl.conf and strongswan.conf may now reference other sections.
All settings and subsections from such a section are inherited. This allows
to simplify configs as redundant information has only to be specified once
and may then be included in other sections (refer to the example in the man
page for strongswan.conf).
- The originally selected IKE config (based on the IPs and IKE version) can now
change if no matching algorithm proposal is found. This way the order
of the configs doesn't matter that much anymore and it's easily possible to
specify separate configs for clients that require weak algorithms (instead
of having to also add them in other configs that might be selected).
- Support for Postquantum Preshared Keys for IKEv2 (draft-ietf-ipsecme-qr-ikev2)
has been added.
- The new botan plugin is a wrapper around the Botan C++ crypto library. It
requires a fairly recent build from Botan's master branch (or the upcoming
2.8.0 release). Thanks to René Korthaus and his team from Rohde & Schwarz
Cybersecurity for the initial patch.
- The pki tool accepts a xmppAddr otherName as a subjectAlternativeName using
the syntax --san xmppaddr:<jid>.
- Implementation of RFC 8412 "Software Inventory Message and Attributes (SWIMA)
for PA-TNC". SWIMA subscription option sets CLOSE_WRITE trigger on apt
history.log file resulting in a ClientRetry PB-TNC batch to initialize
a new measurement cycle.
- Added support for fuzzing the PA-TNC (RFC 5792) and PB-TNC (RFC 5793) NEA
protocols on Google's OSS-Fuzz infrastructure.
- Support for version 2 of Intel's TPM2-TSS TGC Software Stack. The presence of
the in-kernel /dev/tpmrm0 resource manager is automatically detected.
- Marks the in- and/or outbound SA should apply to packets after processing may
be configured in swanctl.conf on Linux. For outbound SAs this requires at
least a 4.14 kernel. Setting a mask and configuring a mark/mask for inbound
SAs will be added with the upcoming 4.19 kernel.
- New options in swanctl.conf allow configuring how/whether DF, ECN and DS
fields in the IP headers are copied during IPsec processing. Controlling this
is currently only possible on Linux.
- To avoid conflicts, the dhcp plugin now only uses the DHCP server port if
explicitly configured.
strongswan-5.6.3
----------------
- Fixed a DoS vulnerability in the IKEv2 key derivation if the openssl plugin is
used in FIPS mode and HMAC-MD5 is negotiated as PRF.
This vulnerability has been registered as CVE-2018-10811.
- Fixed a vulnerability in the stroke plugin, which did not check the received
length before reading a message from the socket. Unless a group is configured,
root privileges are required to access that socket, so in the default
configuration this shouldn't be an issue.
This vulnerability has been registered as CVE-2018-5388.
⁻ CRLs that are not yet valid are now ignored to avoid problems in scenarios
where expired certificates are removed from CRLs and the clock on the host
doing the revocation check is trailing behind that of the host issuing CRLs.
- The issuer of fetched CRLs is now compared to the issuer of the checked
certificate.
- CRL validation results other than revocation (e.g. a skipped check because
the CRL couldn't be fetched) are now stored also for intermediate CA
certificates and not only for end-entity certificates, so a strict CRL policy
can be enforced in such cases.
- In compliance with RFC 4945, section 5.1.3.2, certificates used for IKE must
now either not contain a keyUsage extension (like the ones generated by pki)
or have at least one of the digitalSignature or nonRepudiation bits set.
- New options for vici/swanctl allow forcing the local termination of an IKE_SA.
This might be useful in situations where it's known the other end is not
reachable anymore, or that it already removed the IKE_SA, so retransmitting a
DELETE and waiting for a response would be pointless. Waiting only a certain
amount of time for a response before destroying the IKE_SA is also possible
by additionally specifying a timeout.
- When removing routes, the kernel-netlink plugin now checks if it tracks other
routes for the same destination and replaces the installed route instead of
just removing it. Same during installation, where existing routes previously
weren't replaced. This should allow using traps with virtual IPs on Linux.
- The dhcp plugin only sends the client identifier option if identity_lease is
enabled. It can also send identities of up to 255 bytes length, instead of
the previous 64 bytes. If a server address is configured, DHCP requests are
now sent from port 67 instead of 68 to avoid ICMP port unreachables.
- Roam events are now completely ignored for IKEv1 SAs.
- ChaCha20/Poly1305 is now correctly proposed without key length. For
compatibility with older releases the chacha20poly1305compat keyword may be
included in proposals to also propose the algorithm with a key length.
- Configuration of hardware offload of IPsec SAs is now more flexible and allows
a new mode, which automatically uses it if the kernel and device support it.
- SHA-2 based PRFs are supported in PKCS#8 files as generated by OpenSSL 1.1.
- The pki --verify tool may load CA certificates and CRLs from directories.
- Fixed an issue with DNS servers passed to NetworkManager in charon-nm.
strongswan-5.6.2
----------------
- Fixed a DoS vulnerability in the parser for PKCS#1 RSASSA-PSS signatures that
was caused by insufficient input validation. One of the configurable
parameters in algorithm identifier structures for RSASSA-PSS signatures is the
mask generation function (MGF). Only MGF1 is currently specified for this
purpose. However, this in turn takes itself a parameter that specifies the
underlying hash function. strongSwan's parser did not correctly handle the
case of this parameter being absent, causing an undefined data read.
This vulnerability has been registered as CVE-2018-6459.
- The previously negotiated DH group is reused when rekeying an SA, instead of
using the first group in the configured proposals, which avoids an additional
exchange if the peer selected a different group via INVALID_KE_PAYLOAD when
the SA was created initially.
The selected DH group is also moved to the front of all sent proposals that
contain it and all proposals that don't are moved to the back in order to
convey the preference for this group to the peer.
- Handling of MOBIKE task queuing has been improved. In particular, the response
to an address update is not ignored anymore if only an address list update or
DPD is queued.
- The fallback drop policies installed to avoid traffic leaks when replacing
addresses in installed policies are now replaced by temporary drop policies,
which also prevent acquires because we currently delete and reinstall IPsec
SAs to update their addresses.
- Access X.509 certificates held in non-volatile storage of a TPM 2.0
referenced via the NV index.
- Adding the --keyid parameter to pki --print allows to print private keys
or certificates stored in a smartcard or a TPM 2.0.
- Fixed proposal selection if a peer incorrectly sends DH groups in the ESP
proposals during IKE_AUTH and also if a DH group is configured in the local
ESP proposal and charon.prefer_configured_proposals is disabled.
- MSKs received via RADIUS are now padded to 64 bytes to avoid compatibility
issues with EAP-MSCHAPv2 and PRFs that have a block size < 64 bytes (e.g.
AES-XCBC-PRF-128).
- The tpm_extendpcr command line tool extends a digest into a TPM PCR.
- Ported the NetworkManager backend from the deprecated libnm-glib to libnm.
- The save-keys debugging/development plugin saves IKE and/or ESP keys to files
compatible with Wireshark.
strongswan-5.6.1
----------------
- In compliance with RFCs 8221 and 8247 several algorithms were removed from the
default ESP/AH and IKEv2 proposals, respectively (3DES, Blowfish and MD5 from
ESP/AH, MD5 and MODP-1024 from IKEv2). These algorithms may still be used in
custom proposals.
- Added support for RSASSA-PSS signatures. For backwards compatibility they are
not used automatically by default, enable charon.rsa_pss to change that. To
explicitly use or require such signatures with IKEv2 signature authentication
(RFC 7427), regardless of whether that option is enabled, use ike:rsa/pss...
authentication constraints.
- The pki tool can optionally sign certificates/CRLs with RSASSA-PSS via the
`--rsa-padding pss` option.
- The sec-updater tool checks for security updates in dpkg-based repositories
(e.g. Debian/Ubuntu) and sets the security flags in the IMV policy database
accordingly. Additionally for each new package version a SWID tag for the
given OS and HW architecture is created and stored in the database.
Using the sec-updater.sh script template the lookup can be automated
(e.g. via an hourly cron job).
- The introduction of file versions in the IMV database scheme broke file
reference hash measurements. This has been fixed by creating generic product
versions having an empty package name.
- A new timeout option for the systime-fix plugin stops periodic system time
checks after a while and enforces a certificate verification, closing or
reauthenticating all SAs with invalid certificates.
- The IKE event counters, previously only available via ipsec listcounters, may
now be queried/reset via vici and the new swanctl --counters command. They are
provided by the new optional counters plugin.
- Class attributes received in RADIUS Access-Accept messages may optionally be
added to RADIUS accounting messages.
- Inbound marks may optionally be installed on the SA again (was removed with
5.5.2) by enabling the mark_in_sa option in swanctl.conf.
strongswan-5.6.0
----------------
@ -291,7 +900,7 @@ strongswan-5.3.3
- In the bliss plugin the c_indices derivation using a SHA-512 based random
oracle has been fixed, generalized and standardized by employing the MGF1 mask
generation function with SHA-512. As a consequence BLISS signatures unsing the
generation function with SHA-512. As a consequence BLISS signatures using the
improved oracle are not compatible with the earlier implementation.
- Support for auto=route with right=%any for transport mode connections has
@ -799,7 +1408,7 @@ strongswan-5.0.3
charon-tkm does not result in the compromise of cryptographic keys.
The extracted functionality has been implemented from scratch in a minimal TCB
(trusted computing base) in the Ada programming language. Further information
can be found at http://www.codelabs.ch/tkm/.
can be found at https://www.codelabs.ch/tkm/.
strongswan-5.0.2
----------------
@ -866,7 +1475,7 @@ strongswan-5.0.1
- The PA-TNC and PB-TNC protocols can now process huge data payloads
>64 kB by distributing PA-TNC attributes over multiple PA-TNC messages
and these messages over several PB-TNC batches. As long as no
consolidated recommandation from all IMVs can be obtained, the TNC
consolidated recommendation from all IMVs can be obtained, the TNC
server requests more client data by sending an empty SDATA batch.
- The rightgroups2 ipsec.conf option can require group membership during
@ -937,7 +1546,7 @@ strongswan-5.0.0
pluto, but currently does not support AH or bundled AH+ESP SAs. Beside
RSA/ECDSA, PSK and XAuth, charon also supports the Hybrid authentication
mode. Information for interoperability and migration is available at
http://wiki.strongswan.org/projects/strongswan/wiki/CharonPlutoIKEv1.
https://wiki.strongswan.org/projects/strongswan/wiki/CharonPlutoIKEv1.
- Charon's bus_t has been refactored so that loggers and other listeners are
now handled separately. The single lock was previously cause for deadlocks
@ -1043,9 +1652,9 @@ strongswan-4.6.1
thus causing failures during the loading of the plugins which depend on these
libraries for resolving external symbols.
- Therefore our approach of computing integrity checksums for plugins had to be
changed radically by moving the hash generation from the compilation to the
post-installation phase.
- Therefore our approach of computing integrity checksums for plugins had to be
changed radically by moving the hash generation from the compilation to the
post-installation phase.
strongswan-4.6.0
@ -1327,7 +1936,7 @@ strongswan-4.4.1
- The openssl plugin now supports X.509 certificate and CRL functions.
- OCSP/CRL checking in IKEv2 has been moved to the revocation plugin, enabled
by default. Plase update manual load directives in strongswan.conf.
by default. Please update manual load directives in strongswan.conf.
- RFC3779 ipAddrBlock constraint checking has been moved to the addrblock
plugin, disabled by default. Enable it and update manual load directives
@ -1368,7 +1977,7 @@ strongswan-4.4.0
- The IKEv2 High Availability plugin has been integrated. It provides
load sharing and failover capabilities in a cluster of currently two nodes,
based on an extend ClusterIP kernel module. More information is available at
http://wiki.strongswan.org/projects/strongswan/wiki/HighAvailability.
https://wiki.strongswan.org/projects/strongswan/wiki/HighAvailability.
The development of the High Availability functionality was sponsored by
secunet Security Networks AG.
@ -1588,7 +2197,7 @@ strongswan-4.3.1
- The nm plugin also accepts CA certificates for gateway authentication. If
a CA certificate is configured, strongSwan uses the entered gateway address
as its idenitity, requiring the gateways certificate to contain the same as
as its identity, requiring the gateways certificate to contain the same as
subjectAltName. This allows a gateway administrator to deploy the same
certificates to Windows 7 and NetworkManager clients.
@ -1613,7 +2222,7 @@ strongswan-4.3.1
fuzzing techniques: 1) Sending a malformed IKE_SA_INIT request leaved an
incomplete state which caused a null pointer dereference if a subsequent
CREATE_CHILD_SA request was sent. 2) Sending an IKE_AUTH request with either
a missing TSi or TSr payload caused a null pointer derefence because the
a missing TSi or TSr payload caused a null pointer dereference because the
checks for TSi and TSr were interchanged. The IKEv2 fuzzer used was
developed by the Orange Labs vulnerability research team. The tool was
initially written by Gabriel Campana and is now maintained by Laurent Butti.
@ -1635,7 +2244,7 @@ strongswan-4.3.0
Initiators and responders can use several authentication rounds (e.g. RSA
followed by EAP) to authenticate. The new ipsec.conf leftauth/rightauth and
leftauth2/rightauth2 parameters define own authentication rounds or setup
constraints for the remote peer. See the ipsec.conf man page for more detials.
constraints for the remote peer. See the ipsec.conf man page for more details.
- If glibc printf hooks (register_printf_function) are not available,
strongSwan can use the vstr string library to run on non-glibc systems.
@ -1789,7 +2398,7 @@ strongswan-4.2.8
- Several MOBIKE improvements: Detect changes in NAT mappings in DPD exchanges,
handle events if kernel detects NAT mapping changes in UDP-encapsulated
ESP packets (requires kernel patch), reuse old addesses in MOBIKE updates as
ESP packets (requires kernel patch), reuse old addresses in MOBIKE updates as
long as possible and other fixes.
- Fixed a bug in addr_in_subnet() which caused insertion of wrong source
@ -1995,7 +2604,7 @@ strongswan-4.2.0
refactored to support modular credential providers, proper
CERTREQ/CERT payload exchanges and extensible authorization rules.
- The framework of strongSwan Manager has envolved to the web application
- The framework of strongSwan Manager has evolved to the web application
framework libfast (FastCGI Application Server w/ Templates) and is usable
by other applications.
@ -2068,7 +2677,7 @@ strongswan-4.1.7
- In NAT traversal situations and multiple queued Quick Modes,
those pending connections inserted by auto=start after the
port floating from 500 to 4500 were erronously deleted.
port floating from 500 to 4500 were erroneously deleted.
- Added a "forceencaps" connection parameter to enforce UDP encapsulation
to surmount restrictive firewalls. NAT detection payloads are faked to
@ -2076,7 +2685,7 @@ strongswan-4.1.7
- Preview of strongSwan Manager, a web based configuration and monitoring
application. It uses a new XML control interface to query the IKEv2 daemon
(see http://wiki.strongswan.org/wiki/Manager).
(see https://wiki.strongswan.org/wiki/Manager).
- Experimental SQLite configuration backend which will provide the configuration
interface for strongSwan Manager in future releases.
@ -2134,7 +2743,7 @@ strongswan-4.1.5
strongswan-4.1.4
----------------
- The pluto IKEv1 daemon now exhibits the same behaviour as its
- The pluto IKEv1 daemon now exhibits the same behavior as its
IKEv2 companion charon by inserting an explicit route via the
_updown script only if a sourceip exists. This is admissible
since routing through the IPsec tunnel is handled automatically
@ -2153,7 +2762,7 @@ strongswan-4.1.4
Thanks to the rightallowany flag the connection behaves later on
as
right=%any
right=%any
so that the peer can rekey the connection as an initiator when his
IP address changes. An alternative notation is
@ -2210,8 +2819,8 @@ strongswan-4.1.3
is provided and more advanced backends (using e.g. a database) are trivial
to implement.
- Fixed a compilation failure in libfreeswan occurring with Linux kernel
headers > 2.6.17.
- Fixed a compilation failure in libfreeswan occurring with Linux kernel
headers > 2.6.17.
strongswan-4.1.2
@ -2361,7 +2970,7 @@ strongswan-4.0.5
The debugging levels can either be specified statically in ipsec.conf as
config setup
charondebug="lib 1, cfg 3, net 2"
charondebug="lib 1, cfg 3, net 2"
or changed at runtime via stroke as
@ -2381,7 +2990,7 @@ strongswan-4.0.4
- Added support for preshared keys in IKEv2. PSK keys configured in
ipsec.secrets are loaded. The authby parameter specifies the authentication
method to authentificate ourself, the other peer may use PSK or RSA.
method to authenticate ourself, the other peer may use PSK or RSA.
- Changed retransmission policy to respect the keyingtries parameter.
@ -2519,7 +3128,7 @@ strongswan-2.7.0
left|rightfirewall keyword causes the automatic insertion
and deletion of ACCEPT rules for tunneled traffic upon
the successful setup and teardown of an IPsec SA, respectively.
left|rightfirwall can be used with KLIPS under any Linux 2.4
left|rightfirewall can be used with KLIPS under any Linux 2.4
kernel or with NETKEY under a Linux kernel version >= 2.6.16
in conjunction with iptables >= 1.3.5. For NETKEY under a Linux
kernel version < 2.6.16 which does not support IPsec policy
@ -2603,9 +3212,9 @@ strongswan-2.6.2
if an FQDN, USER_FQDN, or Key ID was defined, as in the following example.
conn rw
right=%any
rightid=@foo.bar
authby=secret
right=%any
rightid=@foo.bar
authby=secret
- the ipsec command now supports most ipsec auto commands (e.g. ipsec listall).
@ -2640,7 +3249,7 @@ strongswan-2.6.0
to replace the various shell and awk starter scripts (setup, _plutoload,
_plutostart, _realsetup, _startklips, _confread, and auto). Since
ipsec.conf is now parsed only once, the starting of multiple tunnels is
accelerated tremedously.
accelerated tremendously.
- Added support of %defaultroute to the ipsec starter. If the IP address
changes, a HUP signal to the ipsec starter will automatically
@ -2662,7 +3271,7 @@ strongswan-2.6.0
strongswan-2.5.7
----------------
- CA certicates are now automatically loaded from a smartcard
- CA certificates are now automatically loaded from a smartcard
or USB crypto token and appear in the ipsec auto --listcacerts
listing.
@ -2748,7 +3357,7 @@ strongswan-2.5.3
- fixed the initialization of the ESP key length to a default of
128 bits in the case that the peer does not send a key length
attribute for AES encryption.
attribute for AES encryption.
- applied Herbert Xu's uniqueIDs patch
@ -2774,9 +3383,9 @@ strongswan-2.5.1
- Under the native IPsec of the Linux 2.6 kernel, a %trap eroute
installed either by setting auto=route in ipsec.conf or by
a connection put into hold, generates an XFRM_AQUIRE event
for each packet that wants to use the not-yet exisiting
tunnel. Up to now each XFRM_AQUIRE event led to an entry in
a connection put into hold, generates an XFRM_ACQUIRE event
for each packet that wants to use the not-yet existing
tunnel. Up to now each XFRM_ACQUIRE event led to an entry in
the Quick Mode queue, causing multiple IPsec SA to be
established in rapid succession. Starting with strongswan-2.5.1
only a single IPsec SA is established per host-pair connection.
@ -3153,16 +3762,16 @@ strongswan-2.1.0
- The new "ca" section allows to define the following parameters:
ca kool
cacert=koolCA.pem # cacert of kool CA
ocspuri=http://ocsp.kool.net:8001 # ocsp server
ldapserver=ldap.kool.net # default ldap server
crluri=http://www.kool.net/kool.crl # crl distribution point
crluri2="ldap:///O=Kool, C= .." # crl distribution point #2
auto=add # add, ignore
cacert=koolCA.pem # cacert of kool CA
ocspuri=http://ocsp.kool.net:8001 # ocsp server
ldapserver=ldap.kool.net # default ldap server
crluri=http://www.kool.net/kool.crl # crl distribution point
crluri2="ldap:///O=Kool, C= .." # crl distribution point #2
auto=add # add, ignore
The ca definitions can be monitored via the command
ipsec auto --listcainfos
ipsec auto --listcainfos
- Fixed cosmetic corruption of /proc filesystem by integrating
D. Hugh Redelmeier's freeswan-2.06 kernel fixes.

108
README.md
View File

@ -1,4 +1,4 @@
# strongSwan Configuration #
## Patched version, containing patch to disable parsing of AUTH payload in IKEv2 Phase2, because we only want EAP-AKA ##
## Overview ##
@ -9,7 +9,7 @@ which uses the modern [**vici**](src/libcharon/plugins/vici/README.md) *Versatil
IKE Configuration Interface*. The deprecated **ipsec** command using the legacy
**stroke** configuration interface is described [**here**](README_LEGACY.md).
For more detailed information consult the man pages and
[**our wiki**](http://wiki.strongswan.org).
[**our wiki**](https://wiki.strongswan.org).
## Quickstart ##
@ -36,7 +36,7 @@ Configuration on gateway _moon_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/priv/moonKey.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
@ -57,7 +57,7 @@ Configuration on gateway _moon_:
local_ts = 10.1.0.0/16
remote_ts = 10.2.0.0/16
start_action = trap
}
}
}
}
}
@ -66,7 +66,7 @@ Configuration on gateway _sun_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/sunCert.pem
/etc/swanctl/priv/sunKey.pem
/etc/swanctl/private/sunKey.pem
/etc/swanctl/swanctl.conf:
@ -87,7 +87,7 @@ Configuration on gateway _sun_:
local_ts = 10.2.0.0/16
remote_ts = 10.1.0.0/16
start_action = trap
}
}
}
}
}
@ -116,11 +116,11 @@ connections we will use the default IPsec tunnel mode.
| 192.168.0.1 | === | 192.168.0.2 |
moon sun
Configuration on host _moon_:
Configuration on host _moon_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/priv/moonKey.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
@ -148,7 +148,7 @@ Configuration on host _sun_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/sunCert.pem
/etc/swanctl/priv/sunKey.pem
/etc/swanctl/private/sunKey.pem
/etc/swanctl/swanctl.conf:
@ -167,7 +167,7 @@ Configuration on host _sun_:
children {
host-host {
start_action = trap
}
}
}
}
}
@ -185,7 +185,7 @@ Configuration on gateway _moon_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/priv/moonKey.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
@ -211,11 +211,11 @@ Configuration on roadwarrior _carol_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/carolCert.pem
/etc/swanctl/priv/carolKey.pem
/etc/swanctl/private/carolKey.pem
/etc/swanctl/swanctl.conf:
connections {
connections {
home {
remote_addrs = moon.strongswan.org
@ -277,7 +277,7 @@ Configuration on gateway _moon_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/rsa/moonKey.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
@ -311,11 +311,11 @@ Configuration on roadwarrior _carol_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/carolCert.pem
/etc/swanctl/priv/carolKey.pem
/etc/swanctl/private/carolKey.pem
/etc/swanctl/swanctl.conf:
connections {
connections {
home {
remote_addrs = moon.strongswan.org
vips = 0.0.0.0
@ -352,7 +352,7 @@ Configuration on gateway _moon_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/priv/moonKey.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
@ -378,16 +378,16 @@ Configuration on gateway _moon_:
The `swanctl.conf` file additionally contains a `secrets` section defining all
client credentials
secrets {
eap-carol {
id = carol@strongswan.org
secret = Ar3etTnp
}
eap-dave {
id = dave@strongswan.org
secret = W7R0g3do
}
}
secrets {
eap-carol {
id = carol@strongswan.org
secret = Ar3etTnp
}
eap-dave {
id = dave@strongswan.org
secret = W7R0g3do
}
}
Configuration on roadwarrior _carol_:
@ -395,7 +395,7 @@ Configuration on roadwarrior _carol_:
/etc/swanctl/swanctl.conf:
connections {
connections {
home {
remote_addrs = moon.strongswan.org
@ -416,12 +416,12 @@ Configuration on roadwarrior _carol_:
}
}
secrets {
eap-carol {
id = carol@strongswan.org
secret = Ar3etTnp
}
}
secrets {
eap-carol {
id = carol@strongswan.org
secret = Ar3etTnp
}
}
### Roadwarrior Case with EAP Identity ###
@ -437,7 +437,7 @@ Configuration on gateway _moon_:
/etc/swanctl/x509ca/strongswanCert.pem
/etc/swanctl/x509/moonCert.pem
/etc/swanctl/priv/moonKey.pem
/etc/swanctl/private/moonKey.pem
/etc/swanctl/swanctl.conf:
@ -461,16 +461,16 @@ Configuration on gateway _moon_:
}
}
secrets {
eap-carol {
id = carol
secret = Ar3etTnp
}
eap-dave {
id = dave
secret = W7R0g3do
}
}
secrets {
eap-carol {
id = carol
secret = Ar3etTnp
}
eap-dave {
id = dave
secret = W7R0g3do
}
}
Configuration on roadwarrior _carol_:
@ -478,7 +478,7 @@ Configuration on roadwarrior _carol_:
/etc/swanctl/swanctl.conf:
connections {
connections {
home {
remote_addrs = moon.strongswan.org
@ -499,12 +499,12 @@ Configuration on roadwarrior _carol_:
}
}
secrets {
eap-carol {
id = carol
secret = Ar3etTnp
}
}
secrets {
eap-carol {
id = carol
secret = Ar3etTnp
}
}
## Generating Certificates and CRLs ##
@ -570,8 +570,8 @@ RSA or ECDSA private key. For details, refer to the TPM 2.0
In a next step the command
pki --req --type priv --in moonKey.pem \
--dn "C=CH, O=strongswan, CN=moon.strongswan.org \
--san moon.strongswan.org -- outform pem > moonReq.pem
--dn "C=CH, O=strongswan, CN=moon.strongswan.org" \
--san moon.strongswan.org --outform pem > moonReq.pem
creates a PKCS#10 certificate request that has to be signed by the CA.
Through the [multiple] use of the `--san` parameter any number of desired

View File

@ -8,7 +8,7 @@ This document is just a short introduction of the **ipsec** command which uses
the legacy **stroke** configuration interface. The current **swanctl** command
using the modern [**vici**](src/libcharon/plugins/vici/README.md) *Versatile IKE
Configuration Interface* is described [**here**](README.md). For more detailed
information consult the man pages and [**our wiki**](http://wiki.strongswan.org).
information consult the man pages and [**our wiki**](https://wiki.strongswan.org).
## Quickstart ##
@ -252,7 +252,7 @@ correctly.
If you prefer the CA certificate to be in binary DER format then the following
command achieves this transformation:
openssl x509 -in strongswanCert.pem -outform DER -out strongswanCert.der
openssl x509 -in strongswanCert.pem -outform DER -out strongswanCert.der
The statements
@ -275,8 +275,8 @@ the correct format will be determined.
The OpenSSL statement
openssl req -newkey rsa:2048 -keyout hostKey.pem \
-out hostReq.pem
openssl req -newkey rsa:2048 -keyout hostKey.pem \
-out hostReq.pem
generates a 2048 bit RSA private key `hostKey.pem` and a certificate request
`hostReq.pem` which has to be signed by the CA.
@ -285,16 +285,16 @@ If you want to add a _subjectAltName_ field to the host certificate you must
edit the OpenSSL configuration file `openssl.cnf` and add the following line in
the `[ usr_cert ]` section:
subjectAltName=DNS:moon.strongswan.org
subjectAltName=DNS:moon.strongswan.org
if you want to identify the host by its Fully Qualified Domain Name (FQDN), or
subjectAltName=IP:192.168.0.1
subjectAltName=IP:192.168.0.1
if you want the ID to be of type _IPV4_ADDR_. Of course you could include both
ID types with
subjectAltName=DNS:moon.strongswan.org,IP:192.168.0.1
subjectAltName=DNS:moon.strongswan.org,IP:192.168.0.1
but the use of an IP address for the identification of a host should be
discouraged anyway.
@ -302,15 +302,15 @@ discouraged anyway.
For user certificates the appropriate ID type is _RFC822_ADDR_ which can be
specified as
subjectAltName=email:carol@strongswan.org
subjectAltName=email:carol@strongswan.org
or if the user's e-mail address is part of the subject's distinguished name
subjectAltName=email:copy
subjectAltName=email:copy
Now the certificate request can be signed by the CA with the command
openssl ca -in hostReq.pem -days 730 -out hostCert.pem -notext
openssl ca -in hostReq.pem -days 730 -out hostCert.pem -notext
If you omit the `-days` option then the `default_days` value (365 days)
specified in `openssl.cnf` is used. The `-notext` option avoids that a human
@ -351,17 +351,17 @@ Usually, a Windows or Mac OS X (or iOS) based VPN client needs its private key,
its host or user certificate, and the CA certificate. The most convenient way
to load this information is to put everything into a PKCS#12 container:
openssl pkcs12 -export -inkey carolKey.pem \
-in carolCert.pem -name "carol" \
-certfile strongswanCert.pem -caname "strongSwan Root CA" \
-out carolCert.p12
openssl pkcs12 -export -inkey carolKey.pem \
-in carolCert.pem -name "carol" \
-certfile strongswanCert.pem -caname "strongSwan Root CA" \
-out carolCert.p12
### Generating a CRL ###
An empty CRL that is signed by the CA can be generated with the command
openssl ca -gencrl -crldays 15 -out crl.pem
openssl ca -gencrl -crldays 15 -out crl.pem
If you omit the `-crldays` option then the `default_crl_days` value (30 days)
specified in `openssl.cnf` is used.
@ -369,7 +369,7 @@ specified in `openssl.cnf` is used.
If you prefer the CRL to be in binary DER format then this conversion
can be achieved with
openssl crl -in crl.pem -outform DER -out cert.crl
openssl crl -in crl.pem -outform DER -out cert.crl
The strongSwan PKI tool provides the `--signcrl` command to sign CRLs.
@ -383,19 +383,19 @@ will be determined.
A specific host certificate stored in the file `host.pem` is revoked with the
command
openssl ca -revoke host.pem
openssl ca -revoke host.pem
Next the CRL file must be updated
openssl ca -gencrl -crldays 60 -out crl.pem
openssl ca -gencrl -crldays 60 -out crl.pem
The content of the CRL file can be listed with the command
openssl crl -in crl.pem -noout -text
openssl crl -in crl.pem -noout -text
in the case of a Base64 CRL, or alternatively for a CRL in DER format
openssl crl -inform DER -in cert.crl -noout -text
openssl crl -inform DER -in cert.crl -noout -text
Again the `--signcrl` command of the strongSwan PKI tool may also be used to
create new CRLs containing additional certificates.
@ -412,15 +412,15 @@ assume throughout this document that the strongSwan security gateway is **left**
and the peer is **right** then we can write
conn %default
leftcert=moonCert.pem
# load connection definitions automatically
auto=add
leftcert=moonCert.pem
# load connection definitions automatically
auto=add
The X.509 certificate by which the strongSwan security gateway will authenticate
itself by sending it in binary form to its peers as part of the Internet Key
Exchange (IKE) is specified in the line
leftcert=moonCert.pem
leftcert=moonCert.pem
The certificate can either be stored in Base64 PEM-format or in the binary
DER-format. Irrespective of the file suffix the correct format will be
@ -443,8 +443,8 @@ As an ID for the VPN gateway we recommend the use of a Fully Qualified Domain
Name (FQDN) of the form
conn rw
right=%any
leftid=moon.strongswan.org
right=%any
leftid=moon.strongswan.org
**Important**: When a FQDN identifier is used it must be explicitly included as
a so called _subjectAltName_ of type _dnsName_ (`DNS:`) in the certificate
@ -456,14 +456,14 @@ Distinguished Name (DN) instead, which is an identifier of type _DER_ASN1_DN_
and which can be written e.g. in the LDAP-type format
conn rw
right=%any
leftid="C=CH, O=strongSwan, CN=moon.strongswan.org"
right=%any
leftid="C=CH, O=strongSwan, CN=moon.strongswan.org"
Since the subject's DN is part of the certificate, the `leftid` does not have to
be declared explicitly. Thus the entry
conn rw
right=%any
right=%any
automatically assumes the subject DN of `leftcert` to be the host ID.
@ -474,16 +474,16 @@ strongSwan supports multiple local host certificates and corresponding
RSA private keys:
conn rw1
right=%any
rightid=peer1.domain1
leftcert=myCert1.pem
# leftid is DN of myCert1
right=%any
rightid=peer1.domain1
leftcert=myCert1.pem
# leftid is DN of myCert1
conn rw2
right=%any
rightid=peer2.domain2
leftcert=myCert2.pem
# leftid is DN of myCert2
right=%any
rightid=peer2.domain2
leftcert=myCert2.pem
# leftid is DN of myCert2
When _peer1_ initiates a connection then strongSwan will send _myCert1_ and will
sign with _myKey1_ defined in `/etc/ipsec.secrets` (see below) whereas
@ -497,7 +497,7 @@ have dozens of road warriors connecting to a central strongSwan security
gateway. The following most simple statement:
conn rw
right=%any
right=%any
defines the general roadwarrior case. The line `right=%any` literally means
that any IPsec peer is accepted, regardless of its current IP source address and
@ -515,7 +515,7 @@ fourth type, _DER_ASN1_DN_, the identifier must completely match the subject
field of the peer's certificate. One of the two possible representations of a
Distinguished Name (DN) is the LDAP-type format
rightid="C=CH, O=strongSwan IPsec, CN=sun.strongswan.org"
rightid="C=CH, O=strongSwan IPsec, CN=sun.strongswan.org"
Additional whitespace can be added everywhere as desired since it will be
automatically eliminated by the parser. An exception is the single whitespace
@ -524,12 +524,12 @@ between individual words, like e.g. in `strongSwan IPsec`, which is preserved.
The Relative Distinguished Names (RDNs) can alternatively be separated by a
slash `/` instead of a comma `,`
rightid="/C=CH/O=strongSwan IPsec/CN=sun.strongswan.org"
rightid="/C=CH/O=strongSwan IPsec/CN=sun.strongswan.org"
This is the representation extracted from the certificate by the OpenSSL
`-subject` command line option
openssl x509 -in sunCert.pem -noout -subject
openssl x509 -in sunCert.pem -noout -subject
The following RDNs are supported by strongSwan
@ -572,12 +572,12 @@ and `10.1.3.0/24` behind the security gateway then the following connection
definitions will make this possible
conn rw1
right=%any
leftsubnet=10.1.0.0/24
right=%any
leftsubnet=10.1.0.0/24
conn rw3
right=%any
leftsubnet=10.1.3.0/24
right=%any
leftsubnet=10.1.3.0/24
For IKEv2 connections this can even be simplified by using
@ -591,35 +591,35 @@ access can be controlled by explicitly putting a roadwarrior entry for each
eligible peer into `ipsec.conf`:
conn sun
right=%any
rightid=sun.strongswan.org
right=%any
rightid=sun.strongswan.org
conn carol
right=%any
rightid=carol@strongswan.org
right=%any
rightid=carol@strongswan.org
conn dave
right=%any
rightid="C=CH, O=strongSwan, CN=dave@strongswan.org"
right=%any
rightid="C=CH, O=strongSwan, CN=dave@strongswan.org"
When the IP address of a peer is known to be stable, it can be specified as
well. This entry is mandatory when the strongSwan host wants to act as the
initiator of an IPsec connection.
conn sun
right=192.168.0.2
rightid=sun.strongswan.org
right=192.168.0.2
rightid=sun.strongswan.org
conn carol
right=192.168.0.100
rightid=carol@strongswan.org
right=192.168.0.100
rightid=carol@strongswan.org
conn dave
right=192.168.0.200
rightid="C=CH, O=strongSwan, CN=dave@strongswan.org"
right=192.168.0.200
rightid="C=CH, O=strongSwan, CN=dave@strongswan.org"
conn venus
right=192.168.0.50
right=192.168.0.50
In the last example the ID types _FQDN_, _RFC822_ADDR_, _DER_ASN1_DN_ and
_IPV4_ADDR_, respectively, were used. Of course all connection definitions
@ -638,23 +638,23 @@ roadwarriors _rw1_ to _rw3_ connecting to a strongSwan security gateway the
following entries are required in `/etc/ipsec.conf`:
conn rw1
right=%any
righsubnet=10.4.0.5/32
right=%any
rightsubnet=10.4.0.5/32
conn rw2
right=%any
rightsubnet=10.4.0.47/32
right=%any
rightsubnet=10.4.0.47/32
conn rw3
right=%any
rightsubnet=10.4.0.128/28
right=%any
rightsubnet=10.4.0.128/28
Because the charon daemon uses narrowing (even for IKEv1) these three entries
can be reduced to the single connection definition
conn rw
right=%any
rightsubnet=10.4.0.0/24
right=%any
rightsubnet=10.4.0.0/24
Any host will be accepted (of course after successful authentication based on
the peer's X.509 certificate only) if it declares a client subnet lying totally
@ -670,8 +670,8 @@ traffic back to the roadwarriors easier. For example, to assign each client an
IP address from the `10.5.0.0/24` subnet `conn rw` can be defined as
conn rw
right=%any
rightsourceip=10.5.0.0/24
right=%any
rightsourceip=10.5.0.0/24
### Protocol and Port Selectors ###
@ -684,30 +684,30 @@ For IKEv2 multiple such restrictions can also be configured in
Some examples:
conn icmp
right=%any
rightprotoport=icmp
leftid=moon.strongswan.org
leftprotoport=icmp
right=%any
rightprotoport=icmp
leftid=moon.strongswan.org
leftprotoport=icmp
conn http
right=%any
rightprotoport=6
leftid=moon.strongswan.org
leftprotoport=6/80
right=%any
rightprotoport=6
leftid=moon.strongswan.org
leftprotoport=6/80
conn l2tp
right=%any
# with port wildcard for interoperability with certain L2TP clients
rightprotoport=17/%any
leftid=moon.strongswan.org
leftprotoport=17/1701
right=%any
# with port wildcard for interoperability with certain L2TP clients
rightprotoport=17/%any
leftid=moon.strongswan.org
leftprotoport=17/1701
conn dhcp
right=%any
rightprotoport=udp/bootpc
leftid=moon.strongswan.org
leftsubnet=0.0.0.0/0 #allows DHCP discovery broadcast
leftprotoport=udp/bootps
right=%any
rightprotoport=udp/bootpc
leftid=moon.strongswan.org
leftsubnet=0.0.0.0/0 #allows DHCP discovery broadcast
leftprotoport=udp/bootps
Protocols and ports can be designated either by their numerical values
or by their acronyms defined in `/etc/services`.
@ -742,24 +742,24 @@ The IPsec policy defined above can now be enforced with the following three
IPsec security associations:
conn sales
right=%any
rightid="C=CH, O=ACME, OU=Sales, CN=*"
rightsourceip=10.1.0.0/24 # Sales IP range
leftsubnet=10.0.0.0/24 # Sales subnet
right=%any
rightid="C=CH, O=ACME, OU=Sales, CN=*"
rightsourceip=10.1.0.0/24 # Sales IP range
leftsubnet=10.0.0.0/24 # Sales subnet
conn research
right=%any
rightid="C=CH, O=ACME, OU=Research, CN=*"
rightsourceip=10.1.1.0/24 # Research IP range
leftsubnet=10.0.1.0/24 # Research subnet
right=%any
rightid="C=CH, O=ACME, OU=Research, CN=*"
rightsourceip=10.1.1.0/24 # Research IP range
leftsubnet=10.0.1.0/24 # Research subnet
conn web
right=%any
rightid="C=CH, O=ACME, OU=*, CN=*"
rightsubnet=10.1.0.0/23 # Remote access IP range
leftsubnet=10.0.2.100/32 # Web server
rightprotoport=tcp # TCP protocol only
leftprotoport=tcp/http # TCP port 80 only
right=%any
rightid="C=CH, O=ACME, OU=*, CN=*"
rightsubnet=10.1.0.0/23 # Remote access IP range
leftsubnet=10.0.2.100/32 # Web server
rightprotoport=tcp # TCP protocol only
leftprotoport=tcp/http # TCP port 80 only
The `*` character is used as a wildcard in relative distinguished names (RDNs).
In order to match a wildcard template, the _ID_DER_ASN1_DN_ of a peer must
@ -788,24 +788,24 @@ to specific client host and subnets can be controlled on the basis of the CA
that issued the peer certificate
conn sales
right=%any
rightca="C=CH, O=ACME, OU=Sales, CN=Sales CA"
rightsourceip=10.1.0.0/24 # Sales IP range
leftsubnet=10.0.0.0/24 # Sales subnet
right=%any
rightca="C=CH, O=ACME, OU=Sales, CN=Sales CA"
rightsourceip=10.1.0.0/24 # Sales IP range
leftsubnet=10.0.0.0/24 # Sales subnet
conn research
right=%any
rightca="C=CH, O=ACME, OU=Research, CN=Research CA"
rightsourceip=10.1.1.0/24 # Research IP range
leftsubnet=10.0.1.0/24 # Research subnet
right=%any
rightca="C=CH, O=ACME, OU=Research, CN=Research CA"
rightsourceip=10.1.1.0/24 # Research IP range
leftsubnet=10.0.1.0/24 # Research subnet
conn web
right=%any
rightca="C=CH, O=ACME, CN=ACME Root CA"
rightsubnet=10.1.0.0/23 # Remote access IP range
leftsubnet=10.0.2.100/32 # Web server
rightprotoport=tcp # TCP protocol only
leftprotoport=tcp/http # TCP port 80 only
right=%any
rightca="C=CH, O=ACME, CN=ACME Root CA"
rightsubnet=10.1.0.0/23 # Remote access IP range
leftsubnet=10.0.2.100/32 # Web server
rightprotoport=tcp # TCP protocol only
leftprotoport=tcp/http # TCP port 80 only
In the example above, the connection _sales_ can be used by peers
presenting certificates issued by the Sales CA, only. In the same way,
@ -820,15 +820,15 @@ The `leftca` parameter usually doesn't have to be set explicitly because
by default it is set to the issuer field of the certificate loaded via
`leftcert`. The statement
rightca=%same
rightca=%same
sets the CA requested from the peer to the CA used by the left side itself
as e.g. in
conn sales
right=%any
rightca=%same
leftcert=mySalesCert.pem
right=%any
rightca=%same
leftcert=mySalesCert.pem
## Configuring certificates and CRLs ##
@ -843,7 +843,7 @@ by a root CA, but strongSwan also supports multi-level hierarchies with
intermediate CAs in between. All CA certificates belonging to a trust chain
must be copied in either binary DER or Base64 PEM format into the directory
/etc/ipsec.d/cacerts/
/etc/ipsec.d/cacerts/
### Installing optional certificate revocation lists (CRLs) ###
@ -903,7 +903,7 @@ the CRL distribution points contained in X.509 certificates.
The `ipsec.conf` option
config setup
cachecrls=yes
cachecrls=yes
activates the local caching of CRLs that were dynamically fetched from an
HTTP or LDAP server. Cached copies are stored in `/etc/ipsec.d/crls` using a
@ -928,9 +928,9 @@ In the simplest OCSP setup, a default URI under which the OCSP server for a
given CA can be accessed is defined in `ipsec.conf`:
ca strongswan
cacert=strongswanCert.pem
ocspuri=http://ocsp.strongswan.org:8880
auto=add
cacert=strongswanCert.pem
ocspuri=http://ocsp.strongswan.org:8880
auto=add
The HTTP port can be freely chosen.
@ -1013,8 +1013,8 @@ the `strictcrlpolicy` option. This is done in the `config setup` section
of the `ipsec.conf` file:
config setup
strictcrlpolicy=yes
...
strictcrlpolicy=yes
...
A certificate received from a peer will not be accepted if no corresponding
CRL or OCSP response is available. And if an IKE SA re-negotiation takes
@ -1037,13 +1037,13 @@ keyword for the peer side, the connection definitions presented earlier can
alternatively be written as
conn sun
right=%any
rightid=sun.strongswan.org
rightcert=sunCert.cer
right=%any
rightid=sun.strongswan.org
rightcert=sunCert.cer
conn carol
right=192.168.0.100
rightcert=carolCert.der
conn carol
right=192.168.0.100
rightcert=carolCert.der
If the peer certificates are loaded locally then there is no need to send any
certificates to the other end via the IKE protocol. Especially if self-signed
@ -1144,7 +1144,7 @@ keys are safe.
On a mobile laptop computer the situation is quite different. The computer can
be stolen or the user may leave it unattended so that unauthorized persons
can get access to it. In theses cases it would be preferable not to keep any
can get access to it. In these cases it would be preferable not to keep any
passphrases openly in `/etc/ipsec.secrets` but to prompt for them interactively
instead. This is easily done by defining

48
SECURITY.md Normal file
View File

@ -0,0 +1,48 @@
# Security Policy
## Reporting a Vulnerability
Please report any security-relevant flaw to security@strongswan.org. Whenever
possible encrypt your email with the [PGP key](https://pgp.key-server.io/0x1EB41ECF25A536E4)
with key ID 0x1EB41ECF25A536E4.
## Severity Classification
* **High Severity Flaw**
* Allows remote access to the VPN with improper, missing, or invalid
credentials
* Allows local escalation of privileges on the server
* Plain text traffic on the secure interface
* Key generation and crypto flaws that reduce the difficulty in decrypting
secure traffic
* **Medium Severity Flaw**
* Remotely crashing the strongSwan daemon, which would allow DoS attacks on
the VPN service
* **Low Severity Flaw**
* All other minor issues not directly compromising security or availability
of the strongSwan daemon or the host the daemon is running on
## Action Taken
For **high** and **medium** severity vulnerabilities we are generally going to
apply for a [CVE Identifier](https://cve.mitre.org/cve/identifiers/) first.
Next we notify all known strongSwan customers and the major Linux
distributions, giving them a time of about three weeks to patch their software
release. On a predetermined date, we officially issue an advisory and a patch
for the vulnerability and usually a new stable strongSwan release containing
the security fix.
Minor vulnerabilities of **low** severity usually will be fixed immediately
in our repository and released with the next stable release.
## List of Reported and Fixed Security Flaws
A list of all reported strongSwan high and medium security flaws may be
found in the [CVE database](https://nvd.nist.gov/vuln/search/results?query=strongswan).
The corresponding security patches are published on https://download.strongswan.org/security/.

2
TODO
View File

@ -4,5 +4,5 @@
A roadmap of the strongSwan project is available online at:
http://wiki.strongswan.org/projects/strongswan/roadmap
https://wiki.strongswan.org/projects/strongswan/roadmap

View File

@ -18,13 +18,13 @@ options = \
options/imv_policy_manager.opt \
options/manager.opt \
options/medsrv.opt \
options/pacman.opt \
options/pki.opt \
options/pool.opt \
options/scepclient.opt \
options/starter.opt \
options/swanctl.opt \
options/tnc.opt \
options/sec-updater.opt \
options/sw-collector.opt
plugins = \
@ -33,12 +33,14 @@ plugins = \
plugins/attr.opt \
plugins/attr-sql.opt \
plugins/bliss.opt \
plugins/botan.opt \
plugins/bypass-lan.opt \
plugins/certexpire.opt \
plugins/coupling.opt \
plugins/curl.opt \
plugins/dhcp.opt \
plugins/dnscert.opt \
plugins/drbg.opt \
plugins/duplicheck.opt \
plugins/eap-aka.opt \
plugins/eap-aka-3gpp.opt \
@ -61,13 +63,11 @@ plugins = \
plugins/imc-hcd.opt \
plugins/imc-os.opt \
plugins/imc-scanner.opt \
plugins/imc-swid.opt \
plugins/imc-swima.opt \
plugins/imc-test.opt \
plugins/imv-attestation.opt \
plugins/imv-os.opt \
plugins/imv-scanner.opt \
plugins/imv-swid.opt \
plugins/imv-swima.opt \
plugins/imv-test.opt \
plugins/ipseckey.opt \
@ -87,6 +87,7 @@ plugins = \
plugins/random.opt \
plugins/resolve.opt \
plugins/revocation.opt \
plugins/save-keys.opt \
plugins/socket-default.opt \
plugins/sql.opt \
plugins/stroke.opt \
@ -102,6 +103,7 @@ plugins = \
plugins/updown.opt \
plugins/vici.opt \
plugins/whitelist.opt \
plugins/wolfssl.opt \
plugins/xauth-eap.opt \
plugins/xauth-pam.opt
@ -174,7 +176,7 @@ install-data-local: $(plugins_install_src)
test -e "$(DESTDIR)${strongswanconfdir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanconfdir)" || true
test -e "$(DESTDIR)${strongswanddir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanddir)" || true
test -e "$(DESTDIR)${charonconfdir}" || $(INSTALL) -d "$(DESTDIR)$(charonconfdir)" || true
test -e "$(DESTDIR)$(strongswanconfdir)/strongswan.conf" || $(INSTALL) -m 644 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswanconfdir)/strongswan.conf || true
test -e "$(DESTDIR)$(strongswan_conf)" || $(INSTALL) -m 644 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswan_conf) || true
for f in $(options_install_src); do \
name=`basename $$f`; \
test -f "$(DESTDIR)$(strongswanddir)/$$name" || $(INSTALL) -m 644 "$(srcdir)/$$f" "$(DESTDIR)$(strongswanddir)/$$name" || true; \

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Copyright (C) 2014-2017 Tobias Brunner
# Copyright (C) 2014-2019 Tobias Brunner
# HSR Hochschule fuer Technik Rapperswil
#
# This program is free software; you can redistribute it and/or modify it
@ -67,9 +67,10 @@ charon.filelog./var/log/daemon\.log {}
import sys
import re
from textwrap import TextWrapper
from optparse import OptionParser
from functools import cmp_to_key
from argparse import ArgumentParser
from functools import cmp_to_key, total_ordering
@total_ordering
class ConfigOption:
"""Representing a configuration option or described section in strongswan.conf"""
def __init__(self, path, default = None, section = False, commented = False, include = False):
@ -83,6 +84,9 @@ class ConfigOption:
self.desc = []
self.options = []
def __eq__(self, other):
return self.name == other.name
def __lt__(self, other):
return self.name < other.name
@ -344,21 +348,22 @@ class ManFormatter:
else:
self.__format_option(option)
options = OptionParser(usage = "Usage: %prog [options] file1 file2\n\n"
"If no filenames are provided the input is read from stdin.")
options.add_option("-f", "--format", dest="format", type="choice", choices=["conf", "man"],
help="output format: conf, man [default: %default]", default="conf")
options.add_option("-r", "--root", dest="root", metavar="NAME",
help="root section of which options are printed, "
"if not found everything is printed")
options.add_option("-n", "--nosort", action="store_false", dest="sort",
default=True, help="do not sort sections alphabetically")
args = ArgumentParser()
args.add_argument('file', nargs='*',
help="files to process, omit to read input from stdin")
args.add_argument("-f", "--format", dest="format", choices=["conf", "man"],
help="output format (default: %(default)s)", default="conf")
args.add_argument("-r", "--root", dest="root", metavar="NAME",
help="root section of which options are printed; everything"
"is printed if not found")
args.add_argument("-n", "--nosort", action="store_false", dest="sort",
default=True, help="do not sort sections alphabetically")
(opts, args) = options.parse_args()
opts = args.parse_args()
parser = Parser(opts.sort)
if len(args):
for filename in args:
if len(opts.file):
for filename in opts.file:
try:
with open(filename, 'r') as file:
parser.parse(file)

View File

@ -2,33 +2,41 @@ charon.filelog {}
Section to define file loggers, see LOGGER CONFIGURATION in
**strongswan.conf**(5).
charon.filelog.<filename> { # }
<filename> is the full path to the log file.
charon.filelog.<name> { # }
<name> may be the full path to the log file if it only contains
characters permitted in section names. Is ignored if _path_ is specified.
charon.filelog.<filename>.default = 1
charon.filelog.<name>.path =
Optional path to the log file. Overrides the section name. Must be used
if the path contains characters that aren't allowed in section names.
charon.filelog.<name>.default = 1
Default loglevel.
Specifies the default loglevel to be used for subsystems for which no
specific loglevel is defined.
charon.filelog.<filename>.<subsystem> = <default>
charon.filelog.<name>.<subsystem> = <default>
Loglevel for a specific subsystem.
charon.filelog.<filename>.append = yes
charon.filelog.<name>.append = yes
If this option is enabled log entries are appended to the existing file.
charon.filelog.<filename>.flush_line = no
charon.filelog.<name>.flush_line = no
Enabling this option disables block buffering and enables line buffering.
charon.filelog.<filename>.ike_name = no
charon.filelog.<name>.ike_name = no
Prefix each log entry with the connection name and a unique numerical
identifier for each IKE_SA.
charon.filelog.<filename>.time_format
charon.filelog.<name>.log_level = no
Add the log level of each message after the subsystem (e.g. [IKE2]).
charon.filelog.<name>.time_format
Prefix each log entry with a timestamp. The option accepts a format string
as passed to **strftime**(3).
charon.filelog.<filename>.time_add_ms = no
charon.filelog.<name>.time_add_ms = no
Adds the milliseconds within the current second after the timestamp
(separated by a dot, so _time_format_ should end with %S or %T).
@ -59,3 +67,6 @@ charon.syslog.<facility>.<subsystem> = <default>
charon.syslog.<facility>.ike_name = no
Prefix each log entry with the connection name and a unique numerical
identifier for each IKE_SA.
charon.syslog.<facility>.log_level = no
Add the log level of each message after the subsystem (e.g. [IKE2]).

View File

@ -8,6 +8,10 @@ charon {}
**charon-cmd** instead of **charon**). For many options defaults can be
defined in the **libstrongswan** section.
charon.accept_private_algs = no
Deliberately violate the IKE standard's requirement and allow the use of
private algorithm identifiers, even if the peer implementation is unknown.
charon.accept_unencrypted_mainmode_messages = no
Accept unencrypted ID and HASH payloads in IKEv1 Main Mode.
@ -31,11 +35,34 @@ charon.cert_cache = yes
memory.
charon.cache_crls = no
Whether Certicate Revocation Lists (CRLs) fetched via HTTP or LDAP should
Whether Certificate Revocation Lists (CRLs) fetched via HTTP or LDAP should
be saved under a unique file name derived from the public key of the
Certification Authority (CA) to **/etc/ipsec.d/crls** (stroke) or
**/etc/swanctl/x509crl** (vici), respectively.
charon.check_current_path = no
Whether to use DPD to check if the current path still works after any
changes to interfaces/addresses.
By default, after detecting any changes to interfaces and/or addresses no
action is taken if the current path to the remote peer still looks usable.
Enabling this option will use DPD to check if the path actually still works,
or, for instance, the peer removed the state after a longer phase without
connectivity. It will also trigger a MOBIKE update if NAT mappings were
removed during the downtime.
charon.cisco_flexvpn = no
Send the Cisco FlexVPN vendor ID payload (IKEv2 only).
Send the Cisco FlexVPN vendor ID payload, which is required in order to make
Cisco brand devices allow negotiating a local traffic selector (from
strongSwan's point of view) that is not the assigned virtual IP address if
such an address is requested by strongSwan. Sending the Cisco FlexVPN
vendor ID prevents the peer from narrowing the initiator's local traffic
selector and allows it to e.g. negotiate a TS of 0.0.0.0/0 == 0.0.0.0/0
instead. This has been tested with a "tunnel mode ipsec ipv4" Cisco
template but should also work for GRE encapsulation.
charon.cisco_unity = no
Send Cisco Unity vendor ID payload (IKEv1 only).
@ -52,7 +79,7 @@ charon.crypto_test.bench_size = 1024
Buffer size used for crypto benchmark.
charon.crypto_test.bench_time = 50
Number of iterations to test each algorithm.
Time in ms during which crypto algorithm performance is measured.
charon.crypto_test.on_add = no
Test crypto algorithms during registration (requires test vectors provided
@ -102,9 +129,6 @@ charon.dns2
charon.dos_protection = yes
Enable Denial of Service protection using cookies and aggressiveness checks.
charon.ecp_x_coordinate_only = yes
Compliance with the errata for RFC 4753.
charon.flush_auth_cfg = no
Free objects during authentication (might conflict with plugins).
@ -116,6 +140,10 @@ charon.flush_auth_cfg = no
charon.follow_redirects = yes
Whether to follow IKEv2 redirects (RFC 5685).
charon.force_eap_only_authentication = no
Violate RFC 5998 and use EAP-only authentication even if the peer did not
send an EAP_ONLY_AUTHENTICATION notify during IKE_AUTH.
charon.fragment_size = 1280
Maximum size (complete IP datagram size in bytes) of a sent IKE fragment
when using proprietary IKEv1 or standardized IKEv2 fragmentation, defaults
@ -212,6 +240,11 @@ charon.interfaces_use
charon.keep_alive = 20s
NAT keep alive interval.
charon.keep_alive_dpd_margin = 0s
Number of seconds the keep alive interval may be exceeded before a DPD is
sent instead of a NAT keep alive (0 to disable). This is only useful if a
clock is used that includes time spent suspended (e.g. CLOCK_BOOTTIME).
charon.leak_detective.detailed = yes
Includes source file names and line numbers in leak detective output.
@ -286,8 +319,16 @@ charon.prefer_configured_proposals = yes
notifies).
charon.prefer_temporary_addrs = no
By default public IPv6 addresses are preferred over temporary ones (RFC
4941), to make connections more stable. Enable this option to reverse this.
Controls whether permanent or temporary IPv6 addresses are used as source,
or announced as additional addresses if MOBIKE is used.
By default, permanent IPv6 source addresses are preferred over temporary
ones (RFC 4941), to make connections more stable. Enable this option to
reverse this.
It also affects which IPv6 addresses are announced as additional addresses
if MOBIKE is used. If the option is disabled, only permanent addresses are
sent, and only temporary ones if it is enabled.
charon.process_route = yes
Process RTM_NEWROUTE and RTM_DELROUTE events.
@ -296,6 +337,22 @@ charon.processor.priority_threads {}
Section to configure the number of reserved threads per priority class
see JOB PRIORITY MANAGEMENT in **strongswan.conf**(5).
charon.rdn_matching = strict
How RDNs in subject DNs of certificates are matched against configured
identities (_strict_, _reordered_, or _relaxed_).
How RDNs in subject DNs of certificates are matched against configured
identities. Possible values are _strict_ (the default), _reordered_, and
_relaxed_. With _strict_ the number, type and order of all RDNs has to
match, wildcards (*) for the values of RDNs are allowed (that's the case
for all three variants). Using _reordered_ also matches DNs if the RDNs
appear in a different order, the number and type still has to match.
Finally, _relaxed_ also allows matches of DNs that contain more RDNs than
the configured identity (missing RDNs are treated like a wildcard match).
Note that _reordered_ and _relaxed_ impose a considerable overhead on memory
usage and runtime, in particular, for mismatches, compared to _strict_.
charon.receive_delay = 0
Delay in ms for receiving packets, to simulate larger RTT.
@ -341,6 +398,9 @@ charon.routing_table
charon.routing_table_prio
Priority of the routing table.
charon.rsa_pss = no
Whether to use RSA with PSS padding instead of PKCS#1 padding by default.
charon.send_delay = 0
Delay in ms for sending packets, to simulate larger RTT.
@ -367,6 +427,13 @@ charon.signature_authentication_constraints = yes
certificate chain, are also used as constraints against the signature scheme
used by peers during IKEv2.
charon.spi_label = 0x0000000000000000
Value mixed into the local IKE SPIs after applying _spi_mask_.
charon.spi_mask = 0x0000000000000000
Mask applied to local IKE SPIs before mixing in _spi_label_ (bits set will
be replaced with _spi_label_).
charon.spi_min = 0xc0000000
The lower limit for SPIs requested from the kernel for IPsec SAs.
@ -406,6 +473,24 @@ charon.tls.mac
charon.tls.suites
List of TLS cipher suites.
charon.tls.ke_group
List of TLS key exchange groups.
charon.tls.signature
List of TLS signature schemes.
charon.tls.send_certreq_authorities = yes
Whether to include CAs in a server's CertificateRequest message.
Whether to include CAs in a server's CertificateRequest message. May be
disabled if clients can't handle a long list of CAs.
charon.tls.version_min = 1.2
Minimum TLS version to negotiate.
charon.tls.version_max = 1.2
Maximum TLS version to negotiate.
charon.user
Name of the user the daemon changes to after startup.

View File

@ -10,4 +10,4 @@ imv_policy_manager.command_allow =
Shell command to be executed with recommendation allow.
imv_policy_manager.command_block =
Shell command to be executed with all other recommendations.
Shell command to be executed with all other recommendations.

View File

@ -1,7 +0,0 @@
pacman.database =
Database URI for the database that stores the package information. If it
contains a password, make sure to adjust the permissions of the config file
accordingly.
pacman.load =
Plugins to load in package manager.

View File

@ -0,0 +1,29 @@
sec-updater {}
Options for the sec-updater tool.
Options for the sec-updater tool.
sec-updater.database =
Global IMV policy database URI. If it contains a password, make sure to
adjust the permissions of the config file accordingly.
sec-updater.swid_gen.command = /usr/local/bin/swid_generator
SWID generator command to be executed.
sec-updater.swid_gen.tag_creator.name = strongSwan Project
Name of the tagCreator entity.
sec-updater.swid_gen.tag_creator.regid = strongswan.org
regid of the tagCreator entity.
sec-updater.tnc_manage_command = /var/www/tnc/manage.py
strongTNC manage.py command used to import SWID tags.
sec-updater.tmp.deb_file = /tmp/sec-updater.deb
Temporary storage for downloaded deb package file.
sec-updater.tmp.tag_file = /tmp/sec-updater.tag
Temporary storage for generated SWID tags.
sec-updater.load =
Plugins to load in sec-updater tool.

6
conf/plugins/botan.opt Normal file
View File

@ -0,0 +1,6 @@
charon.plugins.botan.internal_rng_only = no
Force the use of Botan's internal RNG.
If enabled, only Botan's internal RNG will be used throughout the plugin.
Otherwise, and if supported by Botan, rng_t implementations provided by
other loaded plugins will be used as RNG.

View File

@ -9,11 +9,27 @@ charon.plugins.dhcp.force_server_address = no
192.168.0.255) as server address might work.
charon.plugins.dhcp.identity_lease = no
Derive user-defined MAC address from hash of IKE identity.
Derive user-defined MAC address from hash of IKE identity and send client
identity DHCP option.
charon.plugins.dhcp.server = 255.255.255.255
DHCP server unicast or broadcast IP address.
charon.plugins.dhcp.use_server_port = no
Use the DHCP server port (67) as source port when a unicast server address
is configured.
Use the DHCP server port (67) as source port, instead of the DHCP client
port (68), when a unicast server address is configured and the plugin acts
as relay agent. When replying in this mode the DHCP server will always send
packets to the DHCP server port and if no process binds that port an ICMP
port unreachables will be sent back, which might be problematic for some
DHCP servers. To avoid that, enabling this option will cause the plugin to
bind the DHCP server port to send its requests when acting as relay agent.
This is not necessary if a DHCP server is already running on the same host
and might even cause conflicts (and since the server port is already bound,
ICMPs should not be an issue).
charon.plugins.dhcp.interface
Interface name the plugin uses for address allocation.

3
conf/plugins/drbg.opt Normal file
View File

@ -0,0 +1,3 @@
charon.plugins.drbg.max_drbg_requests = 4294967294
Number of pseudo-random bit requests from the DRBG before an automatic
reseeding occurs.

View File

@ -13,6 +13,10 @@ charon.plugins.eap-radius.accounting_requires_vip = no
If enabled, accounting is disabled unless an IKE_SA has at least one
virtual IP. Only for IKEv2, for IKEv1 a virtual IP is strictly necessary.
charon.plugins.eap-radius.accounting_send_class = no
If enabled, adds the Class attributes received in Access-Accept message to
the RADIUS accounting messages.
charon.plugins.eap-radius.class_group = no
Use class attributes in Access-Accept messages as group membership
information.
@ -104,6 +108,10 @@ charon.plugins.eap-radius.servers {}
charon.plugins.eap-radius.sockets = 1
Number of sockets (ports) to use, increase for high load.
charon.plugins.eap-radius.station_id_with_port = yes
Whether to include the UDP port in the Called- and Calling-Station-Id
RADIUS attributes.
charon.plugins.eap-radius.xauth {}
Section to configure multiple XAuth authentication rounds via RADIUS.

View File

@ -2,6 +2,13 @@ charon.plugins.ha.autobalance = 0
Interval in seconds to automatically balance handled segments between nodes.
Set to 0 to disable.
charon.plugin.ha.buflen = 2048
Buffer size for received HA messages.
Buffer size for received HA messages. For IKEv1 the public DH factors are
also transmitted so depending on the DH group the HA messages can get quite
big (the default should be fine up to _modp4096_).
charon.plugins.ha.fifo_interface = yes
charon.plugins.ha.heartbeat_delay = 1000

View File

@ -10,6 +10,9 @@ libimcv.plugins.imc-attestation.aik_pubkey =
libimcv.plugins.imc-attestation.aik_handle =
AIK object handle.
libimcv.plugins.imc-attestation.hash_algorithm = sha384
Preferred measurement hash algorithm.
libimcv.plugins.imc-attestation.mandatory_dh_groups = yes
Enforce mandatory Diffie-Hellman groups.
@ -26,19 +29,25 @@ libimcv.plugins.imc-attestation.pcr_info = no
Whether to send pcr_before and pcr_after info.
libimcv.plugins.imc-attestation.pcr17_before =
PCR17 value before measurement.
PCR17 value before measurement.
libimcv.plugins.imc-attestation.pcr17_meas =
Dummy measurement value extended into PCR17 if the TBOOT log is not available.
Dummy measurement value extended into PCR17 if the TBOOT log is not
available.
libimcv.plugins.imc-attestation.pcr17_after =
PCR17 value after measurement.
PCR17 value after measurement.
libimcv.plugins.imc-attestation.pcr18_before =
PCR18 value before measurement.
PCR18 value before measurement.
libimcv.plugins.imc-attestation.pcr18_meas =
Dummy measurement value extended into PCR17 if the TBOOT log is not available.
Dummy measurement value extended into PCR17 if the TBOOT log is not
available.
libimcv.plugins.imc-attestation.pcr18_after =
PCR18 value after measurement.
PCR18 value after measurement.
libimcv.plugins.imc-attestation.pcr_padding = no
Whether to pad IMA SHA1 measurements values when extending into
SHA256 PCR bank.

View File

@ -6,7 +6,7 @@ libimcv.plugins.imc-hcd.subtypes
libimcv.plugins.imc-hcd.subtypes.<section>
Defines a PWG HCD PA subtype section. Recognized subtype section names are
_system_, _control_, _marker_, _finisher_, _interface_ and _scanner_.
_system_, _control_, _marker_, _finisher_, _interface_ and _scanner_.
libimcv.plugins.imc-hcd.subtypes.<section>.attributes_natural_language = en
Variable length natural language tag conforming to RFC 5646 specifies

View File

@ -1,14 +1,18 @@
libimcv.plugins.imc-os.device_cert =
Manually set the path to the client device certificate
(e.g. /etc/pts/aikCert.der)
(e.g. /etc/pts/aikCert.der)
libimcv.plugins.imc-os.device_id =
Manually set the client device ID in hexadecimal format
(e.g. 1083f03988c9762703b1c1080c2e46f72b99cc31)
(e.g. 1083f03988c9762703b1c1080c2e46f72b99cc31)
libimcv.plugins.imc-os.device_handle =
Manually set handle to a private key bound to a smartcard or TPM
(e.g. 0x81010004)
libimcv.plugins.imc-os.device_pubkey =
Manually set the path to the client device public key
(e.g. /etc/pts/aikPub.der)
(e.g. /etc/pts/aikPub.der)
libimcv.plugins.imc-os.push_info = yes
Send operating system info without being prompted.

View File

@ -1,8 +0,0 @@
libimcv.plugins.imc-swid.swid_directory = ${prefix}/share
Directory where SWID tags are located.
libimcv.plugins.imc-swid.swid_pretty = no
Generate XML-encoded SWID tags with pretty indentation.
libimcv.plugins.imc-swid.swid_full = no
Include file information in the XML-encoded SWID tags.

View File

@ -19,3 +19,6 @@ libimcv.plugins.imc-swima.swid_pretty = no
libimcv.plugins.imc-swima.swid_full = no
Include file information in the XML-encoded SWID tags.
libimcv.plugins.imc-swima.subscriptions = no
Accept SW Inventory or SW Events subscriptions.

View File

@ -7,7 +7,7 @@ libimcv.plugins.imv-attestation.mandatory_dh_groups = yes
libimcv.plugins.imv-attestation.dh_group = ecp256
Preferred Diffie-Hellman group.
libimcv.plugins.imv-attestation.hash_algorithm = sha256
libimcv.plugins.imv-attestation.hash_algorithm = sha384
Preferred measurement hash algorithm.
libimcv.plugins.imv-attestation.min_nonce_len = 0

View File

@ -1,5 +0,0 @@
libimcv.plugins.imv-swid.rest_api_uri =
HTTP URI of the SWID REST API.
libimcv.plugins.imv-swid.rest_api_timeout = 120
Timeout of SWID REST API HTTP POST transaction.

View File

@ -7,7 +7,7 @@ charon.plugins.kernel-netlink.force_receive_buffer_size = no
If the maximum Netlink socket receive buffer in bytes set by
_receive_buffer_size_ exceeds the system-wide maximum from
/proc/sys/net/core/rmem_max, this option can be used to override the limit.
Enabling this option requires special priviliges (CAP_NET_ADMIN).
Enabling this option requires special privileges (CAP_NET_ADMIN).
charon.plugins.kernel-netlink.fwmark =
Firewall mark to set on the routing rule that directs traffic to our routing
@ -18,6 +18,16 @@ charon.plugins.kernel-netlink.fwmark =
inverts the meaning (i.e. the rule only applies to packets that don't match
the mark).
charon.plugins.kernel-netlink.hw_offload_feature_interface = lo
Interface to be used to find hardware offload feature flag on.
If the kernel supports hardware offloading, the plugin needs to find the
feature flag which represents hardware offloading support for network
devices. Using the loopback device for this purpose is usually fine, since
it should always be present. For rare cases in which the loopback device
cannot be used to obtain the appropriate feature flag, this option can
be used to specify an alternative interface for offload feature detection.
charon.plugins.kernel-netlink.mss = 0
MSS to set on installed routes, 0 to disable.
@ -47,6 +57,13 @@ charon.plugins.kernel-netlink.port_bypass = no
port based policies use global XFRM bypass policies for the used IKE UDP
ports.
charon.plugins.kernel-netlink.process_rules = no
Whether to process changes in routing rules to trigger roam events.
Whether to process changes in routing rules to trigger roam events. This is
currently only useful if the kernel based route lookup is used (i.e. if
route installation is disabled or an inverted fwmark match is configured).
charon.plugins.kernel-netlink.receive_buffer_size = 0
Maximum Netlink socket receive buffer in bytes.

View File

@ -5,3 +5,13 @@ charon.plugins.kernel-pfkey.events_buffer_size = 0
Because events are received asynchronously installing e.g. lots of policies
may require a larger buffer than the default on certain platforms in order
to receive all messages.
charon.plugins.kernel-pfkey.route_via_internal = no
Whether to use the internal or external interface in installed routes.
Whether to use the internal or external interface in installed routes.
The internal interface is the one where the IP address contained in the
local traffic selector is located, the external interface is the one over
which the destination address of the IPsec tunnel can be reached.
This is not relevant if virtual IPs are used, for which a TUN device is
created that's used in the routes.

View File

@ -25,7 +25,7 @@ charon.plugins.load-tester.crl
certificates.
charon.plugins.load-tester.delay = 0
Delay between initiatons for each thread.
Delay between initiations for each thread.
charon.plugins.load-tester.delete_after_established = no
Delete an IKE_SA as soon as it has been established.
@ -66,7 +66,7 @@ charon.plugins.load-tester.initiators = 0
Number of concurrent initiator threads to use in load test.
charon.plugins.load-tester.initiator_auth = pubkey
Authentication method(s) the intiator uses.
Authentication method(s) the initiator uses.
charon.plugins.load-tester.initiator_id =
Initiator ID used in load test.
@ -119,7 +119,7 @@ charon.plugins.load-tester.responder_tsr = initiator_tsr
Traffic selector on responder side, as narrowed by responder.
charon.plugins.load-tester.request_virtual_ip = no
Request an INTERNAL_IPV4_ADDR from the server.
Request an INTERNAL_IPV4_ADDR and INTERNAL_IPV6_ADDR from the server.
charon.plugins.load-tester.shutdown_when_complete = no
Shutdown the daemon after all IKE_SAs have been established.

View File

@ -1,7 +1,3 @@
charon.plugins.ntru.max_drbg_requests = 4294967294
Number of pseudo-random bit requests from the DRBG before an automatic
reseeding occurs.
charon.plugins.ntru.parameter_set = optimum
The following parameter sets are available: **x9_98_speed**,
**x9_98_bandwidth**, **x9_98_balance** and **optimum**, the last set not

View File

@ -0,0 +1,16 @@
charon.plugins.save-keys.load := no
Whether to load the plugin.
charon.plugins.save-keys.esp = no
Whether to save ESP keys.
charon.plugins.save-keys.ike = no
Whether to save IKE keys.
charon.plugins.save-keys.wireshark_keys
Directory where the keys are stored in the format supported by Wireshark
Directory where the keys are stored in the format supported by Wireshark.
IKEv1 keys are stored in the _ikev1_decryption_table_ file.
IKEv2 keys are stored in the _ikev2_decryption_table_ file.
Keys for ESP CHILD_SAs are stored in the _esp_sa_ file.

View File

@ -10,3 +10,7 @@ charon.plugins.systime-fix.threshold =
charon.plugins.systime-fix.threshold_format = %Y
**strptime**(3) format used to parse threshold option.
charon.plugins.systime-fix.timeout = 0s
How long to wait for a valid system time if an interval is configured. 0 to
recheck indefinitely.

View File

@ -5,10 +5,10 @@ charon.plugins.tnccs-20.max_message_size = 65490
Maximum size of a PA-TNC message (upper limit via PT-EAP = 65497).
charon.plugins.tnccs-20.mutual = no
Enable PB-TNC mutual protocol.
Enable PB-TNC mutual protocol.
charon.plugins.tnccs-20.tests.pb_tnc_noskip = no
Send an unsupported PB-TNC message type with the NOSKIP flag set.
Send an unsupported PB-TNC message type with the NOSKIP flag set.
charon.plugins.tnccs-20.tests.pb_tnc_version = 2
Send a PB-TNC batch with a modified PB-TNC version.
Send a PB-TNC batch with a modified PB-TNC version.

View File

@ -1,2 +1,16 @@
charon.plugins.tpm.use_rng = no
Whether the TPM should be used as RNG.
charon.plugins.tpm.fips_186_4 = no
Is the TPM 2.0 FIPS-186-4 compliant, forcing e.g. the use of the default
salt length instead of maximum salt length with RSAPSS padding.
charon.plugins.tpm.tcti.name = device|tabrmd
Name of TPM 2.0 TCTI library. Valid values: _tabrmd_, _device_ or _mssim_.
Defaults are _device_ if the _/dev/tpmrm0_ in-kernel TPM 2.0 resource manager
device exists, and _tabrmd_ otherwise, requiring the d-bus based TPM 2.0
access broker and resource manager to be available.
charon.plugins.tpm.tcti.opts = /dev/tpmrm0|<none>
Options for the TPM 2.0 TCTI library. Defaults are _/dev/tpmrm0_ if the
TCTI library name is _device_ and no options otherwise.

2
conf/plugins/wolfssl.opt Normal file
View File

@ -0,0 +1,2 @@
charon.plugins.wolfssl.fips_mode = no
Enable to prevent loading the plugin if wolfSSL is not in FIPS mode.

View File

@ -32,13 +32,12 @@ and key/value pairs:
.PP
Values must be terminated by a newline.
.PP
Comments are possible using the \fB#\fP-character, but be careful: The parser
implementation is currently limited and does not like brackets in comments.
Comments are possible using the \fB#\fP-character.
.PP
Section names and keys may contain any printable character except:
.PP
.EX
. { } # \\n \\t space
. , : { } = " # \\n \\t space
.EE
.PP
An example file in this format might look like this:
@ -60,6 +59,71 @@ An example file in this format might look like this:
.PP
Indentation is optional, you may use tabs or spaces.
.SH REFERENCING OTHER SECTIONS
It is possible to inherit settings and sections from another section. This
feature is mainly useful in swanctl.conf (which uses the same file format).
The syntax is as follows:
.PP
.EX
section := name : references { settings }
references := absname[, absname]*
absname := name[.name]*
.EE
.PP
All key/value pairs and all subsections of the referenced sections will be
inherited by the section that references them via their absolute name. Values
may be overridden in the section or any of its sub-sections (use an empty
assignment to clear a value so its default value, if any, will apply). It is
currently not possible to limit the inclusion level or clear/remove inherited
sub-sections.
If the order is important (e.g. for auth rounds in a connection, if \fIround\fR
is not used), it should be noted that inherited settings/sections will follow
those defined in the current section (if multiple sections are referenced, their
settings are enumerated left to right).
References are evaluated dynamically at runtime, so referring to sections later
in the config file or included via other files is no problem.
Here is an example of how this might look like:
.PP
.EX
conn-defaults {
# default settings for all conns (e.g. a cert, or IP pools)
}
eap-defaults {
# defaults if eap is used (e.g. a remote auth round)
}
child-defaults {
# defaults for child configs (e.g. traffic selectors)
}
connections {
conn-a : conn-defaults, eap-defaults {
# set/override stuff specific to this connection
children {
child-a : child-defaults {
# set/override stuff specific to this child
}
}
}
conn-b : conn-defaults {
# set/override stuff specific to this connection
children {
child-b : child-defaults {
# set/override stuff specific to this child
}
}
}
conn-c : connections.conn-a {
# everything is inherited, including everything conn-a
# already inherits from the sections it and its
# sub-section reference
}
}
.EE
.PP
.SH INCLUDING FILES
Using the
.B include

View File

@ -15,12 +15,15 @@ does not have any effect.
There are currently two types of loggers:
.TP
.B File loggers
Log directly to a file and are defined by specifying the full path to the
file as subsection in the
Log directly to a file and are defined by specifying an arbitrarily named
subsection in the
.B charon.filelog
section. To log to the console the two special filenames
section. The full path to the file is configured in the \fIpath\fR setting of
that subsection, however, if it only contains characters permitted in section
names, the setting may also be omitted and the path specified as name of the
subsection. To log to the console the two special filenames
.BR stdout " and " stderr
can be used.
may be used.
.TP
.B Syslog loggers
Log into a syslog facility and are defined by specifying the facility to log to
@ -71,7 +74,7 @@ libtls library messages
libipsec library messages
.TP
.B lib
libstrongwan library messages
libstrongswan library messages
.TP
.B tnc
Trusted Network Connect
@ -93,7 +96,7 @@ Absolutely silent
Very basic auditing logs, (e.g. SA up/SA down)
.TP
.B 1
Generic control flow with errors, a good default to see whats going on
Generic control flow with errors, a good default to see what's going on
.TP
.B 2
More detailed debugging control flow
@ -108,7 +111,8 @@ Also include sensitive material in dumps, e.g. keys
.EX
charon {
filelog {
/var/log/charon.log {
charon {
path = /var/log/charon.log
time_format = %b %e %T
append = no
default = 1
@ -290,7 +294,7 @@ For public key authentication, the responder uses the
identity. For the initiator, each connection attempt uses a different identity
in the form
.BR "\(dqCN=c1-r1, OU=load-test, O=strongSwan\(dq" ,
where the first number inidicates the client number, the second the
where the first number indicates the client number, the second the
authentication round (if multiple authentication rounds are used).
.PP
For PSK authentication, FQDN identities are used. The server uses

View File

@ -1,8 +1,10 @@
#
# Copyright (C) 2007-2017 Tobias Brunner
# Copyright (C) 2006-2016 Andreas Steffen
# Copyright (C) 2006-2019 Andreas Steffen
# Copyright (C) 2006-2014 Martin Willi
# HSR Hochschule fuer Technik Rapperswil
# Copyright (C) 2017 Domonkos P. Tomcsanyi
# umlaut Communications Gmbh.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@ -19,7 +21,7 @@
# initialize & set some vars
# ============================
AC_INIT([strongSwan],[5.6.0])
AC_INIT([strongSwan],[5.9.3])
AM_INIT_AUTOMAKE(m4_esyscmd([
echo tar-ustar
echo subdir-objects
@ -55,7 +57,7 @@ ARG_WITH_SUBST([piddir], [/var/run], [set path for PID and UNIX sock
ARG_WITH_SUBST([ipsecdir], [${libexecdir%/}/ipsec], [set installation path for ipsec tools])
ARG_WITH_SUBST([ipseclibdir], [${libdir%/}/ipsec], [set installation path for ipsec libraries])
ARG_WITH_SUBST([plugindir], [${ipseclibdir%/}/plugins], [set the installation path of plugins])
ARG_WITH_SUBST([imcvdir], [${ipseclibdir%/}/imcvs], [set the installation path of IMC and IMV dynamic librariers])
ARG_WITH_SUBST([imcvdir], [${ipseclibdir%/}/imcvs], [set the installation path of IMC and IMV dynamic libraries])
ARG_WITH_SUBST([nm-ca-dir], [/usr/share/ca-certificates], [directory the NM backend uses to look up trusted root certificates])
ARG_WITH_SUBST([swanctldir], [${sysconfdir}/swanctl], [base directory for swanctl configuration files and credentials])
ARG_WITH_SUBST([linux-headers], [\${top_srcdir}/src/include], [set directory of linux header files to use])
@ -63,7 +65,7 @@ ARG_WITH_SUBST([routing-table], [220], [set routing table to use for IPsec
ARG_WITH_SUBST([routing-table-prio], [220], [set priority for IPsec routing table])
ARG_WITH_SUBST([ipsec-script], [ipsec], [change the name of the ipsec script])
ARG_WITH_SUBST([fips-mode], [0], [set openssl FIPS mode: disabled(0), enabled(1), Suite B enabled(2)])
ARG_WITH_SUBST([libfuzzer], [], [path to libFuzzer.a])
ARG_WITH_SUBST([libfuzzer], [], [-fsanitize=fuzzer or path to libFuzzer.a, a local driver is used if not specified])
ARG_WITH_SET([capabilities], [no], [set capability dropping library. Currently supported values are "libcap" and "native"])
ARG_WITH_SET([mpz_powm_sec], [yes], [use the more side-channel resistant mpz_powm_sec in libgmp, if available])
ARG_WITH_SET([dev-headers], [no], [install strongSwan development headers to directory.])
@ -77,6 +79,15 @@ fi
ARG_WITH_SET([systemdsystemunitdir], [$systemdsystemunitdir_default], [directory for systemd service files])
AC_SUBST(systemdsystemunitdir)
AC_ARG_WITH(
[dbuspolicydir],
AS_HELP_STRING([--with-dbuspolicydir=arg],[directory for D-Bus policies (default: ${dbusdatadir|datarootdir}/dbus-1/system.d)]),
[dbuspolicydir="$withval"],
[PKG_CHECK_VAR([dbusdatadir], [dbus-1], [datadir], , [dbusdatadir="${datarootdir}"])
dbuspolicydir="${dbusdatadir}/dbus-1/system.d"]
)
AC_SUBST(dbuspolicydir)
AC_ARG_WITH(
[user],
AS_HELP_STRING([--with-user=user],[change user of the daemons to "user" after startup (default is "root").]),
@ -126,11 +137,13 @@ ARG_DISBL_SET([aes], [disable AES software implementation plugin.])
ARG_ENABL_SET([af-alg], [enable AF_ALG crypto interface to Linux Crypto API.])
ARG_ENABL_SET([bliss], [enable BLISS software implementation plugin.])
ARG_ENABL_SET([blowfish], [enable Blowfish software implementation plugin.])
ARG_ENABL_SET([botan], [enables the Botan crypto plugin.])
ARG_ENABL_SET([ccm], [enables the CCM AEAD wrapper crypto plugin.])
ARG_ENABL_SET([chapoly], [enables the ChaCha20/Poly1305 AEAD plugin.])
ARG_DISBL_SET([cmac], [disable CMAC crypto implementation plugin.])
ARG_ENABL_SET([ctr], [enables the Counter Mode wrapper crypto plugin.])
ARG_DISBL_SET([des], [disable DES/3DES software implementation plugin.])
ARG_DISBL_SET([drbg], [disable the NIST Deterministic Random Bit Generator plugin.])
ARG_DISBL_SET([fips-prf], [disable FIPS PRF software implementation plugin.])
ARG_ENABL_SET([gcm], [enables the GCM AEAD wrapper crypto plugin.])
ARG_ENABL_SET([gcrypt], [enables the libgcrypt plugin.])
@ -144,6 +157,7 @@ ARG_ENABL_SET([newhope], [enable New Hope crypto plugin.])
ARG_DISBL_SET([nonce], [disable nonce generation plugin.])
ARG_ENABL_SET([ntru], [enables the NTRU crypto plugin.])
ARG_ENABL_SET([openssl], [enables the OpenSSL crypto plugin.])
ARG_ENABL_SET([wolfssl], [enables the wolfSSL crypto plugin.])
ARG_ENABL_SET([padlock], [enables VIA Padlock crypto plugin.])
ARG_DISBL_SET([random], [disable RNG implementation on top of /dev/(u)random.])
ARG_DISBL_SET([rc2], [disable RC2 software implementation plugin.])
@ -187,7 +201,8 @@ ARG_ENABL_SET([eap-sim-pcsc], [enable EAP-SIM backend based on a smartcard rea
ARG_ENABL_SET([eap-aka], [enable EAP AKA authentication module.])
ARG_ENABL_SET([eap-aka-3gpp], [enable EAP AKA backend implementing 3GPP MILENAGE algorithms in software.])
ARG_ENABL_SET([eap-aka-3gpp2], [enable EAP AKA backend implementing 3GPP2 algorithms in software. Requires libgmp.])
ARG_ENABL_SET([eap-simaka-sql], [enable EAP-SIM/AKA backend based on a triplet/quintuplet SQL database.])
ARG_ENABL_SET([eap-simaka-pcsc], [enable EAP-SIM/AKA backend based on a smartcard reader. Requires libpcsclite.])
ARG_ENABL_SET([eap-simaka-sql], [enable EAP-SIM/AKA backend based on a triplet/quintuplet SQL database.])
ARG_ENABL_SET([eap-simaka-pseudonym], [enable EAP-SIM/AKA pseudonym storage plugin.])
ARG_ENABL_SET([eap-simaka-reauth], [enable EAP-SIM/AKA reauthentication data storage plugin.])
ARG_ENABL_SET([eap-identity], [enable EAP module providing EAP-Identity helper.])
@ -245,8 +260,6 @@ ARG_ENABL_SET([imc-os], [enable IMC operating system module.])
ARG_ENABL_SET([imv-os], [enable IMV operating system module.])
ARG_ENABL_SET([imc-attestation],[enable IMC attestation module.])
ARG_ENABL_SET([imv-attestation],[enable IMV attestation module.])
ARG_ENABL_SET([imc-swid], [enable IMC swid module.])
ARG_ENABL_SET([imv-swid], [enable IMV swid module.])
ARG_ENABL_SET([imc-swima], [enable IMC swima module.])
ARG_ENABL_SET([imv-swima], [enable IMV swima module.])
ARG_ENABL_SET([imc-hcd], [enable IMC hcd module.])
@ -263,6 +276,7 @@ ARG_ENABL_SET([android-log], [enable Android specific logger plugin.])
ARG_ENABL_SET([bypass-lan], [enable plugin to install bypass policies for local subnets.])
ARG_ENABL_SET([certexpire], [enable CSV export of expiration dates of used certificates.])
ARG_ENABL_SET([connmark], [enable connmark plugin using conntrack based marks to select return path SA.])
ARG_ENABL_SET([counters], [enable plugin that collects several performance counters.])
ARG_ENABL_SET([forecast], [enable forecast plugin forwarding broadcast/multicast messages.])
ARG_ENABL_SET([duplicheck], [advanced duplicate checking plugin using liveness checks.])
ARG_ENABL_SET([error-notify], [enable error notification plugin.])
@ -272,6 +286,7 @@ ARG_ENABL_SET([led], [enable plugin to control LEDs on IKEv2 activity
ARG_ENABL_SET([load-tester], [enable load testing plugin for IKEv2 daemon.])
ARG_ENABL_SET([lookip], [enable fast virtual IP lookup and notification plugin.])
ARG_ENABL_SET([radattr], [enable plugin to inject and process custom RADIUS attributes as IKEv2 client.])
ARG_ENABL_SET([save-keys], [enable development/debugging plugin that saves IKE and ESP keys in Wireshark format.])
ARG_ENABL_SET([systime-fix], [enable plugin to handle cert lifetimes with invalid system time gracefully.])
ARG_ENABL_SET([test-vectors], [enable plugin providing crypto test vectors.])
ARG_DISBL_SET([updown], [disable updown firewall script plugin.])
@ -280,7 +295,6 @@ ARG_ENABL_SET([aikgen], [enable AIK generator for TPM 1.2.])
ARG_DISBL_SET([charon], [disable the IKEv1/IKEv2 keying daemon charon.])
ARG_ENABL_SET([cmd], [enable the command line IKE client charon-cmd.])
ARG_ENABL_SET([conftest], [enforce Suite B conformance test framework.])
ARG_ENABL_SET([dumm], [enable the DUMM UML test framework.])
ARG_ENABL_SET([fast], [enable libfast (FastCGI Application Server w/ templates.])
ARG_ENABL_SET([fuzzing], [enable fuzzing scripts (found in directory fuzz).])
ARG_ENABL_SET([libipsec], [enable user space IPsec implementation.])
@ -315,6 +329,7 @@ ARG_ENABL_SET([tss-tss2], [enable the use of the TSS 2.0 Trusted Software
# compile options
ARG_ENABL_SET([coverage], [enable lcov coverage report generation.])
ARG_ENABL_SET([git-version], [use output of 'git describe' as version information in executables.])
ARG_ENABL_SET([leak-detective], [enable malloc hooks to find memory leaks.])
ARG_ENABL_SET([lock-profiler], [enable lock/mutex profiling code.])
ARG_ENABL_SET([log-thread-ids], [use thread ID, if available, instead of an incremented value starting from 1, to identify threads.])
@ -372,18 +387,35 @@ AC_PROG_LEX
AC_PROG_YACC
AM_PATH_PYTHON(,,[:])
AC_PATH_PROG([PERL], [perl], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_ARG_VAR([PERL], [the Perl interpreter])
AC_PATH_PROG([GPERF], [gperf], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_ARG_VAR([GPERF], [the GNU gperf program])
# because gperf is not needed by end-users we just report it but do not abort on failure
AC_MSG_CHECKING([gperf version >= 3.0.0])
# because gperf is not needed by end-users we only abort if generated files don't exist
AC_MSG_CHECKING([gperf len type])
if test -x "$GPERF"; then
if test "`$GPERF --version | $AWK -F' ' '/^GNU gperf/ { print $3 }' | $AWK -F. '{ print $1 }'`" -ge "3"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
GPERF_OUTPUT="`echo foo | ${GPERF}`"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <string.h>
const char *in_word_set(const char*, size_t); $GPERF_OUTPUT]])],
[GPERF_LEN_TYPE=size_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <string.h>
const char *in_word_set(const char*, unsigned); $GPERF_OUTPUT]])],
[GPERF_LEN_TYPE=unsigned],
[AC_MSG_ERROR([unable to determine gperf len type])]
)]
)
AC_SUBST(GPERF_LEN_TYPE)
AC_MSG_RESULT([$GPERF_LEN_TYPE])
else
AC_MSG_RESULT([not found])
GPERF_TEST_FILE="$srcdir/src/libstrongswan/crypto/proposal/proposal_keywords_static.c"
if test ! -f "$GPERF_TEST_FILE"; then
AC_MSG_ERROR([GNU gperf required to generate e.g. $GPERF_TEST_FILE])
fi
fi
# ========================
@ -416,7 +448,7 @@ if test x$eap_radius = xtrue -o x$radattr = xtrue -o x$tnc_pdp = xtrue; then
radius=true;
fi
if test x$tnc_imc = xtrue -o x$tnc_imv = xtrue -o x$tnccs_11 = xtrue -o x$tnccs_11 = xtrue -o x$tnccs_dynamic = xtrue -o x$eap_tnc = xtrue; then
if test x$tnc_imc = xtrue -o x$tnc_imv = xtrue -o x$tnccs_11 = xtrue -o x$tnccs_20 = xtrue -o x$tnccs_dynamic = xtrue -o x$eap_tnc = xtrue; then
tnc_tnccs=true;
fi
@ -424,12 +456,12 @@ if test x$eap_tls = xtrue -o x$eap_ttls = xtrue -o x$eap_peap = xtrue -o x$tnc_t
tls=true;
fi
if test x$imc_test = xtrue -o x$imv_test = xtrue -o x$imc_scanner = xtrue -o x$imv_scanner = xtrue -o x$imc_os = xtrue -o x$imv_os = xtrue -o x$imc_attestation = xtrue -o x$imv_attestation = xtrue -o x$imc_swid = xtrue -o x$imv_swid = xtrue -o x$imc_swima = xtrue -o x$imv_swima = xtrue -o x$imc_hcd = xtrue -o x$imv_hcd = xtrue; then
if test x$imc_test = xtrue -o x$imv_test = xtrue -o x$imc_scanner = xtrue -o x$imv_scanner = xtrue -o x$imc_os = xtrue -o x$imv_os = xtrue -o x$imc_attestation = xtrue -o x$imv_attestation = xtrue -o x$imc_swima = xtrue -o x$imv_swima = xtrue -o x$imc_hcd = xtrue -o x$imv_hcd = xtrue; then
imcv=true;
fi
if test x$fips_prf = xtrue; then
if test x$openssl = xfalse; then
if test x$openssl = xfalse -a x$wolfssl = xfalse; then
sha1=true;
fi
fi
@ -471,10 +503,14 @@ if test x$aikgen = xtrue; then
tss_trousers=true
fi
if test x$ntru = xtrue -o x$bliss = xtrue; then
if test x$gmp = xtrue -o x$ntru = xtrue -o x$bliss = xtrue; then
mgf1=true
fi
if test x$stroke = xtrue; then
counters=true
fi
# ===========================================
# check required libraries and header files
# ===========================================
@ -629,8 +665,8 @@ AC_CHECK_FUNC(
]
)
AC_CHECK_FUNCS(prctl mallinfo getpass closefrom getpwnam_r getgrnam_r getpwuid_r)
AC_CHECK_FUNCS(fmemopen funopen mmap memrchr setlinebuf strptime dirfd sigwaitinfo)
AC_CHECK_FUNCS(prctl mallinfo getpass closefrom getpwnam_r getgrnam_r getpwuid_r chown)
AC_CHECK_FUNCS(fmemopen funopen mmap memrchr setlinebuf strptime dirfd sigwaitinfo explicit_bzero)
AC_CHECK_FUNC([syslog], [
AC_DEFINE([HAVE_SYSLOG], [], [have syslog(3) and friends])
@ -827,7 +863,7 @@ AC_COMPILE_IFELSE(
[
AC_MSG_RESULT([yes])
windows=true
openssl_lib=eay32
AC_SUBST(PTHREADLIB, "")
# explicitly disable ms-bitfields, as it breaks __attribute__((packed))
case "$CFLAGS" in
@ -837,7 +873,6 @@ AC_COMPILE_IFELSE(
],
[
AC_MSG_RESULT([no])
openssl_lib=crypto
# check for clock_gettime() on non-Windows only. Otherwise this
# check might find clock_gettime() in libwinpthread, but we don't want
@ -851,7 +886,6 @@ AC_COMPILE_IFELSE(
LIBS=$saved_LIBS
]
)
AC_SUBST(OPENSSL_LIB, [-l$openssl_lib])
AM_CONDITIONAL(USE_WINDOWS, [test "x$windows" = xtrue])
AC_MSG_CHECKING([for working __attribute__((packed))])
@ -919,9 +953,9 @@ if test x$gmp = xtrue; then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include "gmp.h"]],
[[void *x = mpz_powm_sec;]])],
[[void *x __attribute__((unused)); x = mpz_powm_sec;]])],
[AC_MSG_RESULT([yes]);
AC_DEFINE([HAVE_MPZ_POWM_SEC], [], [have mpz_mown_sec()])],
AC_DEFINE([HAVE_MPZ_POWM_SEC], [], [have mpz_powm_sec()])],
[AC_MSG_RESULT([no])]
)
else
@ -989,6 +1023,10 @@ if test x$systemd = xtrue; then
AC_SUBST(systemd_journal_CFLAGS)
AC_SUBST(systemd_journal_LIBS)]
)
saved_LIBS=$LIBS
LIBS="$systemd_LIBS $systemd_daemon_LIBS"
AC_CHECK_FUNCS(sd_listen_fds_with_names)
LIBS=$saved_LIBS
fi
if test x$tss_trousers = xtrue; then
@ -998,40 +1036,40 @@ if test x$tss_trousers = xtrue; then
fi
if test x$tss_tss2 = xtrue; then
PKG_CHECK_MODULES(tss2_tabrmd, [tcti-tabrmd],
[tss2_tabrmd=true; AC_DEFINE([TSS2_TCTI_TABRMD], [], [use TCTI Access Broker and Resource Mamager])],
[tss2_tabrmd=false])
PKG_CHECK_MODULES(tss2_socket, [tcti-socket],
[tss2_socket=true; AC_DEFINE([TSS2_TCTI_SOCKET], [], [use TCTI Sockets])],
[tss2_socket=false])
if test x$tss2_tabrmd = xtrue -o x$tss2_socket = xtrue; then
AC_DEFINE([TSS_TSS2], [], [use TSS 2.0 libraries])
AC_SUBST(tss2_CFLAGS, "$tss2_tabrmd_CFLAGS $tss2_socket_CFLAGS")
AC_SUBST(tss2_LIBS, "$tss2_tabrmd_LIBS $tss2_socket_LIBS")
PKG_CHECK_MODULES(tss2_sys, [tss2-sys],
[tss2_sys=true; AC_DEFINE([TSS2_SYS], [], [use TSS2 v2 System API])],
[tss2_sys=false])
PKG_CHECK_MODULES(tss2_esys, [tss2-esys],
[tss2_esys=true; AC_DEFINE([TSS2_ESYS], [], [use TSS2 v2 Extended System API])],
[tss2_esys=false])
if test x$tss2_sys = xtrue; then
AC_DEFINE([TSS_TSS2_V2], [], [use TSS 2.0 v2 libraries])
AC_SUBST(tss2_CFLAGS, "$tss2_sys_CFLAGS")
AC_SUBST(tss2_LIBS, "$tss2_sys_LIBS")
else
AC_MSG_FAILURE([no TSS2 TCTI library detected])
PKG_CHECK_MODULES(tss2_tabrmd, [tcti-tabrmd],
[tss2_tabrmd=true; AC_DEFINE([TSS2_TCTI_TABRMD], [], [use TCTI Access Broker and Resource Manager])],
[tss2_tabrmd=false])
PKG_CHECK_MODULES(tss2_socket, [tcti-socket],
[tss2_socket=true; AC_DEFINE([TSS2_TCTI_SOCKET], [], [use TCTI Sockets])],
[tss2_socket=false])
if test x$tss2_tabrmd = xtrue -o x$tss2_socket = xtrue; then
AC_DEFINE([TSS_TSS2_V1], [], [use TSS 2.0 v1 libraries])
AC_SUBST(tss2_CFLAGS, "$tss2_tabrmd_CFLAGS $tss2_socket_CFLAGS")
AC_SUBST(tss2_LIBS, "$tss2_tabrmd_LIBS $tss2_socket_LIBS")
else
AC_MSG_FAILURE([no TSS2 TCTI or SAPI libraries detected])
fi
fi
fi
if test x$imc_swima = xtrue -o $imv_swima = xtrue -o x$imv_swid = xtrue; then
if test x$imc_swima = xtrue -o x$imv_swima = xtrue; then
PKG_CHECK_MODULES(json, [json-c], [],
[PKG_CHECK_MODULES(json, [json])])
AC_SUBST(json_CFLAGS)
AC_SUBST(json_LIBS)
fi
if test x$dumm = xtrue; then
PKG_CHECK_MODULES(gtk, [gtk+-2.0 vte])
AC_SUBST(gtk_CFLAGS)
AC_SUBST(gtk_LIBS)
AC_CHECK_PROGS(RUBY, ruby)
PKG_CHECK_MODULES(ruby, [ruby])
saved_LIBS=$LIBS
LIBS=$ruby_LIBS
AC_CHECK_FUNCS(rb_errinfo)
LIBS=$saved_LIBS
fi
if test x$fast = xtrue; then
AC_CHECK_LIB([neo_utl],[hdf_init],[LIBS="$LIBS"],[AC_MSG_ERROR([ClearSilver library neo_utl not found!])],[])
AC_MSG_CHECKING([for -lneo_cgi and dependencies])
@ -1103,11 +1141,26 @@ if test x$sqlite = xtrue; then
fi
if test x$openssl = xtrue; then
AC_CHECK_LIB([$openssl_lib],[EVP_CIPHER_CTX_new],[LIBS="$LIBS"],
[AC_MSG_ERROR([OpenSSL lib$openssl_lib not found])],[$DLLIB])
if test "x$windows" = xtrue; then
openssl_lib=eay32
AC_CHECK_LIB([$openssl_lib],[EVP_CIPHER_CTX_new],[LIBS="$LIBS"],
[AC_MSG_RESULT([no]);openssl_lib=""],[$DLLIB])
fi
if test -z "$openssl_lib"; then
openssl_lib=crypto
AC_CHECK_LIB([$openssl_lib],[EVP_CIPHER_CTX_new],[LIBS="$LIBS"],
[AC_MSG_ERROR([OpenSSL lib$openssl_lib not found])],[$DLLIB])
fi
AC_SUBST(OPENSSL_LIB, [-l$openssl_lib])
AC_CHECK_HEADER([openssl/evp.h],,[AC_MSG_ERROR([OpenSSL header openssl/evp.h not found!])])
fi
if test x$wolfssl = xtrue; then
PKG_CHECK_MODULES(wolfssl, [wolfssl])
AC_SUBST(wolfssl_CFLAGS)
AC_SUBST(wolfssl_LIBS)
fi
if test x$gcrypt = xtrue; then
AC_CHECK_LIB([gcrypt],[gcry_control],[LIBS="$LIBS"],[AC_MSG_ERROR([gcrypt library not found])],[-lgpg-error])
AC_CHECK_HEADER([gcrypt.h],,[AC_MSG_ERROR([gcrypt header gcrypt.h not found!])])
@ -1122,6 +1175,17 @@ if test x$gcrypt = xtrue; then
)
fi
if test x$botan = xtrue; then
PKG_CHECK_MODULES(botan, [botan-3], [],
[PKG_CHECK_MODULES(botan, [botan-2])])
AC_SUBST(botan_CFLAGS)
AC_SUBST(botan_LIBS)
saved_LIBS=$LIBS
LIBS="$botan_LIBS"
AC_CHECK_FUNCS(botan_rng_init_custom)
LIBS=$saved_LIBS
fi
if test x$uci = xtrue; then
AC_CHECK_LIB([uci],[uci_alloc_context],[LIBS="$LIBS"],[AC_MSG_ERROR([UCI library libuci not found])],[])
AC_CHECK_HEADER([uci.h],,[AC_MSG_ERROR([UCI header uci.h not found!])])
@ -1142,13 +1206,23 @@ if test x$eap_sim_pcsc = xtrue; then
AC_SUBST(pcsclite_LIBS)
fi
if test x$eap_simaka_pcsc = xtrue; then
PKG_CHECK_MODULES(pcsclite, [libpcsclite])
AC_SUBST(pcsclite_CFLAGS)
AC_SUBST(pcsclite_LIBS)
fi
if test x$nm = xtrue; then
PKG_CHECK_EXISTS([libnm-glib],
[PKG_CHECK_MODULES(nm, [NetworkManager gthread-2.0 libnm-util libnm-glib libnm-glib-vpn])],
[PKG_CHECK_MODULES(nm, [NetworkManager gthread-2.0 libnm_util libnm_glib libnm_glib_vpn])]
)
PKG_CHECK_MODULES(nm, [gthread-2.0 libnm])
AC_SUBST(nm_CFLAGS)
AC_SUBST(nm_LIBS)
AC_MSG_CHECKING([for D-Bus policy directory])
if test -n "$dbuspolicydir" -a "x$dbuspolicydir" != xno; then
AC_MSG_RESULT([$dbuspolicydir])
else
AC_MSG_ERROR([not found (try --with-dbuspolicydir)])
fi
fi
if test x$xauth_pam = xtrue; then
@ -1157,7 +1231,7 @@ if test x$xauth_pam = xtrue; then
fi
if test x$connmark = xtrue -o x$forecast = xtrue; then
PKG_CHECK_MODULES(libiptc, [libiptc])
PKG_CHECK_MODULES(libiptc, [libip4tc])
AC_SUBST(libiptc_CFLAGS)
AC_SUBST(libiptc_LIBS)
fi
@ -1206,6 +1280,11 @@ if test x$bfd_backtraces = xtrue; then
AC_CHECK_LIB([bfd],[bfd_init],[LIBS="$LIBS"],[AC_MSG_ERROR([binutils libbfd not found!])],[])
AC_CHECK_HEADER([bfd.h],[AC_DEFINE([HAVE_BFD_H],,[have binutils bfd.h])],
[AC_MSG_ERROR([binutils bfd.h header not found!])])
AC_CHECK_DECLS(
[bfd_section_flags, bfd_get_section_flags,
bfd_section_vma, bfd_get_section_vma,
bfd_section_size, bfd_get_section_size], [], [],
[[#include <bfd.h>]])
BFDLIB="-lbfd"
AC_SUBST(BFDLIB)
fi
@ -1253,6 +1332,29 @@ if test x$coverage = xtrue; then
CFLAGS="${CFLAGS} -g -O0"
fi
if test x$fuzzing = xtrue; then
case "$libfuzzer" in
"")
AC_MSG_NOTICE([fuzz targets enabled without libFuzzer, using local driver])
CFLAGS="${CFLAGS} -fsanitize=address"
libfuzzer="libFuzzerLocal.a"
;;
"-fsanitize=fuzzer")
libfuzzer=""
FUZZING_CFLAGS="-fsanitize=fuzzer"
AC_SUBST(FUZZING_CFLAGS)
;;
*)
# required for libFuzzer
FUZZING_LDFLAGS="-stdlib=libc++ -lstdc++"
if test "$SANITIZER" = "coverage"; then
FUZZING_LDFLAGS="$FUZZING_LDFLAGS -lm"
fi
AC_SUBST(FUZZING_LDFLAGS)
;;
esac
fi
if test x$ruby_gems = xtrue; then
AC_PATH_PROG([GEM], [gem], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
if test x$GEM = x; then
@ -1266,7 +1368,7 @@ fi
AM_CONDITIONAL(RUBY_GEMS_INSTALL, [test "x$ruby_gems_install" = xtrue])
if test x$python_eggs = xtrue; then
PYTHON_PACKAGE_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/dr/dev/'`
PYTHON_PACKAGE_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/dr/.dev/'`
AC_SUBST([PYTHON_PACKAGE_VERSION])
if test x$python_eggs_install = xtrue; then
AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
@ -1279,6 +1381,7 @@ if test x$python_eggs = xtrue; then
else
AC_SUBST(PYTHONEGGINSTALLDIR, "--install-dir $pythoneggdir")
fi
AC_PATH_PROG([TOX], [tox], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
fi
AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue])
@ -1296,6 +1399,27 @@ AC_CACHE_CHECK(
)
if test "x$ss_cv_static_plugin_constructors" = xyes; then
static_plugin_constructors=true
if test "$PYTHON" = ":"; then
AC_MSG_FAILURE([Python is required to resolve plugin constructors statically])
fi
fi
AC_MSG_CHECKING([version from Git repository])
AC_SUBST(GIT_VERSION, [$($srcdir/scripts/git-version "$srcdir")])
case "$GIT_VERSION" in
"$PACKAGE_VERSION"*)
AC_MSG_RESULT([$GIT_VERSION])
;;
UNKNOWN)
AC_MSG_RESULT([$GIT_VERSION (could be due to insufficient clone depth)])
;;
*)
AC_MSG_ERROR([$PACKAGE_VERSION is not a prefix of $GIT_VERSION, tag missing?])
;;
esac
if test x$git_version = xtrue -a "$GIT_VERSION" != "UNKNOWN"; then
AC_DEFINE_UNQUOTED(VERSION, ["$GIT_VERSION"])
fi
# ===============================================
@ -1362,7 +1486,9 @@ ADD_PLUGIN([ipseckey], [c charon])
ADD_PLUGIN([pem], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([padlock], [s charon])
ADD_PLUGIN([openssl], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([wolfssl], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([gcrypt], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([botan], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([af-alg], [s charon scepclient pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([fips-prf], [s charon nm cmd])
ADD_PLUGIN([gmp], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen fuzz])
@ -1377,6 +1503,7 @@ ADD_PLUGIN([ctr], [s charon scripts nm cmd])
ADD_PLUGIN([ccm], [s charon scripts nm cmd])
ADD_PLUGIN([gcm], [s charon scripts nm cmd])
ADD_PLUGIN([ntru], [s charon scripts nm cmd])
ADD_PLUGIN([drbg], [s charon pki scripts nm cmd])
ADD_PLUGIN([newhope], [s charon scripts nm cmd])
ADD_PLUGIN([bliss], [s charon pki scripts nm cmd])
ADD_PLUGIN([curl], [s charon scepclient pki scripts nm cmd])
@ -1395,6 +1522,7 @@ ADD_PLUGIN([kernel-pfkey], [c charon starter nm cmd])
ADD_PLUGIN([kernel-pfroute], [c charon starter nm cmd])
ADD_PLUGIN([kernel-netlink], [c charon starter nm cmd])
ADD_PLUGIN([resolve], [c charon cmd])
ADD_PLUGIN([save-keys], [c])
ADD_PLUGIN([socket-default], [c charon nm cmd])
ADD_PLUGIN([socket-dynamic], [c charon cmd])
ADD_PLUGIN([socket-win], [c charon])
@ -1414,6 +1542,7 @@ ADD_PLUGIN([eap-sim-pcsc], [c charon])
ADD_PLUGIN([eap-aka], [c charon])
ADD_PLUGIN([eap-aka-3gpp], [c charon])
ADD_PLUGIN([eap-aka-3gpp2], [c charon])
ADD_PLUGIN([eap-simaka-pcsc], [c charon])
ADD_PLUGIN([eap-simaka-sql], [c charon])
ADD_PLUGIN([eap-simaka-pseudonym], [c charon])
ADD_PLUGIN([eap-simaka-reauth], [c charon])
@ -1459,6 +1588,7 @@ ADD_PLUGIN([radattr], [c charon])
ADD_PLUGIN([uci], [c charon])
ADD_PLUGIN([addrblock], [c charon])
ADD_PLUGIN([unity], [c charon])
ADD_PLUGIN([counters], [c charon])
AC_SUBST(charon_plugins)
AC_SUBST(starter_plugins)
@ -1529,7 +1659,9 @@ AM_CONDITIONAL(USE_MYSQL, test x$mysql = xtrue)
AM_CONDITIONAL(USE_SQLITE, test x$sqlite = xtrue)
AM_CONDITIONAL(USE_PADLOCK, test x$padlock = xtrue)
AM_CONDITIONAL(USE_OPENSSL, test x$openssl = xtrue)
AM_CONDITIONAL(USE_WOLFSSL, test x$wolfssl = xtrue)
AM_CONDITIONAL(USE_GCRYPT, test x$gcrypt = xtrue)
AM_CONDITIONAL(USE_BOTAN, test x$botan = xtrue)
AM_CONDITIONAL(USE_AGENT, test x$agent = xtrue)
AM_CONDITIONAL(USE_KEYCHAIN, test x$keychain = xtrue)
AM_CONDITIONAL(USE_PKCS11, test x$pkcs11 = xtrue)
@ -1542,6 +1674,7 @@ AM_CONDITIONAL(USE_AF_ALG, test x$af_alg = xtrue)
AM_CONDITIONAL(USE_NTRU, test x$ntru = xtrue)
AM_CONDITIONAL(USE_NEWHOPE, test x$newhope = xtrue)
AM_CONDITIONAL(USE_BLISS, test x$bliss = xtrue)
AM_CONDITIONAL(USE_DRBG, test x$drbg = xtrue)
# charon plugins
# ----------------
@ -1581,6 +1714,7 @@ AM_CONDITIONAL(USE_RADATTR, test x$radattr = xtrue)
AM_CONDITIONAL(USE_EAP_SIM, test x$eap_sim = xtrue)
AM_CONDITIONAL(USE_EAP_SIM_FILE, test x$eap_sim_file = xtrue)
AM_CONDITIONAL(USE_EAP_SIM_PCSC, test x$eap_sim_pcsc = xtrue)
AM_CONDITIONAL(USE_EAP_SIMAKA_PCSC, test x$eap_simaka_pcsc = xtrue)
AM_CONDITIONAL(USE_EAP_SIMAKA_SQL, test x$eap_simaka_sql = xtrue)
AM_CONDITIONAL(USE_EAP_SIMAKA_PSEUDONYM, test x$eap_simaka_pseudonym = xtrue)
AM_CONDITIONAL(USE_EAP_SIMAKA_REAUTH, test x$eap_simaka_reauth = xtrue)
@ -1617,12 +1751,11 @@ AM_CONDITIONAL(USE_IMC_OS, test x$imc_os = xtrue)
AM_CONDITIONAL(USE_IMV_OS, test x$imv_os = xtrue)
AM_CONDITIONAL(USE_IMC_ATTESTATION, test x$imc_attestation = xtrue)
AM_CONDITIONAL(USE_IMV_ATTESTATION, test x$imv_attestation = xtrue)
AM_CONDITIONAL(USE_IMC_SWID, test x$imc_swid = xtrue)
AM_CONDITIONAL(USE_IMV_SWID, test x$imv_swid = xtrue)
AM_CONDITIONAL(USE_IMC_SWIMA, test x$imc_swima = xtrue)
AM_CONDITIONAL(USE_IMV_SWIMA, test x$imv_swima = xtrue)
AM_CONDITIONAL(USE_IMC_HCD, test x$imc_hcd = xtrue)
AM_CONDITIONAL(USE_IMV_HCD, test x$imv_hcd = xtrue)
AM_CONDITIONAL(USE_SAVE_KEYS, test x$save_keys = xtrue)
AM_CONDITIONAL(USE_SOCKET_DEFAULT, test x$socket_default = xtrue)
AM_CONDITIONAL(USE_SOCKET_DYNAMIC, test x$socket_dynamic = xtrue)
AM_CONDITIONAL(USE_SOCKET_WIN, test x$socket_win = xtrue)
@ -1635,12 +1768,12 @@ AM_CONDITIONAL(USE_UNITY, test x$unity = xtrue)
AM_CONDITIONAL(USE_RESOLVE, test x$resolve = xtrue)
AM_CONDITIONAL(USE_ATTR, test x$attr = xtrue)
AM_CONDITIONAL(USE_ATTR_SQL, test x$attr_sql = xtrue)
AM_CONDITIONAL(USE_COUNTERS, test x$counters = xtrue)
# other options
# ---------------
AM_CONDITIONAL(USE_LEAK_DETECTIVE, test x$leak_detective = xtrue)
AM_CONDITIONAL(USE_LOCK_PROFILER, test x$lock_profiler = xtrue)
AM_CONDITIONAL(USE_DUMM, test x$dumm = xtrue)
AM_CONDITIONAL(USE_FAST, test x$fast = xtrue)
AM_CONDITIONAL(USE_MANAGER, test x$manager = xtrue)
AM_CONDITIONAL(USE_ME, test x$mediation = xtrue)
@ -1664,7 +1797,7 @@ AM_CONDITIONAL(USE_LIBNTTFFT, test x$bliss = xtrue -o x$newhope = xtrue)
AM_CONDITIONAL(USE_LIBTNCIF, test x$tnc_tnccs = xtrue -o x$imcv = xtrue)
AM_CONDITIONAL(USE_LIBTNCCS, test x$tnc_tnccs = xtrue)
AM_CONDITIONAL(USE_LIBPTTLS, test x$tnc_tnccs = xtrue)
AM_CONDITIONAL(USE_LIBTPMTSS, test x$tss_trousers = xtrue -o x$tss_tss2 = xtrue -o x$tpm -o x$aikgen = xtrue -o x$imcv = xtrue)
AM_CONDITIONAL(USE_LIBTPMTSS, test x$tss_trousers = xtrue -o x$tss_tss2 = xtrue -o x$tpm = xtrue -o x$aikgen = xtrue -o x$imcv = xtrue)
AM_CONDITIONAL(USE_FILE_CONFIG, test x$stroke = xtrue)
AM_CONDITIONAL(USE_IPSEC_SCRIPT, test x$stroke = xtrue -o x$scepclient = xtrue -o x$conftest = xtrue)
AM_CONDITIONAL(USE_LIBCAP, test x$capabilities = xlibcap)
@ -1691,7 +1824,8 @@ AM_CONDITIONAL(USE_LEGACY_SYSTEMD, test -n "$systemdsystemunitdir" -a "x$systemd
AM_CONDITIONAL(USE_RUBY_GEMS, test x$ruby_gems = xtrue)
AM_CONDITIONAL(USE_PYTHON_EGGS, test x$python_eggs = xtrue)
AM_CONDITIONAL(USE_PERL_CPAN, test x$perl_cpan = xtrue)
AM_CONDITIONAL(USE_PY_TEST, test "x$PY_TEST" != x)
AM_CONDITIONAL(USE_TOX, test "x$TOX" != x)
AM_CONDITIONAL(USE_PY_TEST, test "x$PY_TEST" != x -a "x$TOX" = x)
# ========================
# set global definitions
@ -1721,7 +1855,7 @@ fi
if test x$fuzzing = xtrue; then
AC_DEFINE([USE_FUZZING], [], [build code for fuzzing])
fi
if test x$imc_swima = xtrue -o x$imv_swima = xtrue -o x$imv_swid = xtrue ; then
if test x$imc_swima = xtrue -o x$imv_swima = xtrue; then
AC_DEFINE([USE_JSON], [], [build code for JSON])
fi
@ -1737,7 +1871,7 @@ AM_COND_IF([USE_CHARON], [strongswan_options=${strongswan_options}" charon charo
AM_COND_IF([USE_FILE_CONFIG], [strongswan_options=${strongswan_options}" starter"])
AM_COND_IF([USE_IMV_ATTESTATION], [strongswan_options=${strongswan_options}" attest"])
AM_COND_IF([USE_IMCV], [strongswan_options=${strongswan_options}" imcv"])
AM_COND_IF([USE_IMV_OS], [strongswan_options=${strongswan_options}" pacman"])
AM_COND_IF([USE_IMV_SWIMA], [strongswan_options=${strongswan_options}" sec-updater"])
AM_COND_IF([USE_LIBTNCCS], [strongswan_options=${strongswan_options}" tnc"])
AM_COND_IF([USE_MANAGER], [strongswan_options=${strongswan_options}" manager"])
AM_COND_IF([USE_MEDSRV], [strongswan_options=${strongswan_options}" medsrv"])
@ -1759,7 +1893,7 @@ AC_CONFIG_FILES([
man/Makefile
init/Makefile
init/systemd/Makefile
init/systemd-swanctl/Makefile
init/systemd-starter/Makefile
src/Makefile
src/include/Makefile
src/libstrongswan/Makefile
@ -1808,7 +1942,9 @@ AC_CONFIG_FILES([
src/libstrongswan/plugins/sqlite/Makefile
src/libstrongswan/plugins/padlock/Makefile
src/libstrongswan/plugins/openssl/Makefile
src/libstrongswan/plugins/wolfssl/Makefile
src/libstrongswan/plugins/gcrypt/Makefile
src/libstrongswan/plugins/botan/Makefile
src/libstrongswan/plugins/agent/Makefile
src/libstrongswan/plugins/keychain/Makefile
src/libstrongswan/plugins/pkcs11/Makefile
@ -1817,6 +1953,7 @@ AC_CONFIG_FILES([
src/libstrongswan/plugins/ccm/Makefile
src/libstrongswan/plugins/gcm/Makefile
src/libstrongswan/plugins/af_alg/Makefile
src/libstrongswan/plugins/drbg/Makefile
src/libstrongswan/plugins/ntru/Makefile
src/libstrongswan/plugins/bliss/Makefile
src/libstrongswan/plugins/bliss/tests/Makefile
@ -1848,8 +1985,6 @@ AC_CONFIG_FILES([
src/libimcv/plugins/imv_os/Makefile
src/libimcv/plugins/imc_attestation/Makefile
src/libimcv/plugins/imv_attestation/Makefile
src/libimcv/plugins/imc_swid/Makefile
src/libimcv/plugins/imv_swid/Makefile
src/libimcv/plugins/imc_swima/Makefile
src/libimcv/plugins/imv_swima/Makefile
src/libimcv/plugins/imc_hcd/Makefile
@ -1863,6 +1998,7 @@ AC_CONFIG_FILES([
src/libcharon/Makefile
src/libcharon/plugins/eap_aka/Makefile
src/libcharon/plugins/eap_aka_3gpp/Makefile
src/libcharon/plugins/eap_aka_3gpp/tests/Makefile
src/libcharon/plugins/eap_aka_3gpp2/Makefile
src/libcharon/plugins/eap_dynamic/Makefile
src/libcharon/plugins/eap_identity/Makefile
@ -1871,6 +2007,7 @@ AC_CONFIG_FILES([
src/libcharon/plugins/eap_sim/Makefile
src/libcharon/plugins/eap_sim_file/Makefile
src/libcharon/plugins/eap_sim_pcsc/Makefile
src/libcharon/plugins/eap_simaka_pcsc/Makefile
src/libcharon/plugins/eap_simaka_sql/Makefile
src/libcharon/plugins/eap_simaka_pseudonym/Makefile
src/libcharon/plugins/eap_simaka_reauth/Makefile
@ -1886,11 +2023,13 @@ AC_CONFIG_FILES([
src/libcharon/plugins/xauth_noauth/Makefile
src/libcharon/plugins/tnc_ifmap/Makefile
src/libcharon/plugins/tnc_pdp/Makefile
src/libcharon/plugins/save_keys/Makefile
src/libcharon/plugins/socket_default/Makefile
src/libcharon/plugins/socket_dynamic/Makefile
src/libcharon/plugins/socket_win/Makefile
src/libcharon/plugins/bypass_lan/Makefile
src/libcharon/plugins/connmark/Makefile
src/libcharon/plugins/counters/Makefile
src/libcharon/plugins/forecast/Makefile
src/libcharon/plugins/farp/Makefile
src/libcharon/plugins/smp/Makefile
@ -1945,11 +2084,10 @@ AC_CONFIG_FILES([
src/_copyright/Makefile
src/scepclient/Makefile
src/aikgen/Makefile
src/tpm_extendpcr/Makefile
src/pki/Makefile
src/pki/man/Makefile
src/pool/Makefile
src/dumm/Makefile
src/dumm/ext/extconf.rb
src/libfast/Makefile
src/manager/Makefile
src/medsrv/Makefile
@ -1957,7 +2095,9 @@ AC_CONFIG_FILES([
src/conftest/Makefile
src/pt-tls-client/Makefile
src/sw-collector/Makefile
src/sec-updater/Makefile
src/swanctl/Makefile
src/xfrmi/Makefile
scripts/Makefile
testing/Makefile
])
@ -1991,6 +2131,7 @@ AC_CONFIG_FILES([
src/swanctl/swanctl.conf.5.tail
src/pt-tls-client/pt-tls-client.1
src/sw-collector/sw-collector.8
src/sec-updater/sec-updater.8
])
AC_OUTPUT

6
fuzz/.gitignore vendored
View File

@ -1 +1,5 @@
fuzz_certs
fuzz_certs
fuzz_crls
fuzz_ids
fuzz_pa_tnc
fuzz_pb_tnc

View File

@ -1,18 +1,59 @@
CPPFLAGS = @CPPFLAGS@ \
AM_CPPFLAGS = @CPPFLAGS@ \
@FUZZING_CFLAGS@ \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libimcv \
-I$(top_srcdir)/src/libtncif \
-I$(top_srcdir)/src/libtpmtss \
-I$(top_srcdir)/src/libtnccs \
-I$(top_srcdir)/src/libtnccs/plugins/tnccs_20 \
-DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
-DPLUGINS="\"${fuzz_plugins}\""
LDFLAGS = @LDFLAGS@ ${libfuzzer} \
fuzz_ldflags = ${libfuzzer} \
$(top_builddir)/src/libstrongswan/.libs/libstrongswan.a \
-Wl,-Bstatic -lgmp -Wl,-Bdynamic \
-stdlib=libc++ -lstdc++
@FUZZING_LDFLAGS@
FUZZ_TARGETS=fuzz_certs
pa_tnc_ldflags = \
$(top_builddir)/src/libimcv/.libs/libimcv.a \
$(top_builddir)/src/libtncif/.libs/libtncif.a \
$(top_builddir)/src/libtpmtss/.libs/libtpmtss.a \
$(fuzz_ldflags)
pb_tnc_ldflags = \
$(top_builddir)/src/libtnccs/.libs/libtnccs.a \
$(top_builddir)/src/libtncif/.libs/libtncif.a \
$(fuzz_ldflags)
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_ids fuzz_pa_tnc fuzz_pb_tnc
all-local: $(FUZZ_TARGETS)
CLEANFILES=$(FUZZ_TARGETS)
fuzz_certs: fuzz_certs.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
fuzz_certs: fuzz_certs.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
fuzz_crls: fuzz_crls.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
fuzz_ids: fuzz_ids.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
fuzz_pa_tnc: fuzz_pa_tnc.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(pa_tnc_ldflags)
fuzz_pb_tnc: fuzz_pb_tnc.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(pb_tnc_ldflags)
noinst_LIBRARIES = libFuzzerLocal.a
libFuzzerLocal_a_SOURCES = libFuzzerLocal.c
libFuzzerLocal_a_LIBADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
check: all
for f in $(FUZZ_TARGETS); do \
corpus=$${f#fuzz_}; \
./$$f $(FUZZING_CORPORA)/$${corpus}/*; \
crashes=$(FUZZING_CORPORA)/$${corpus}-crash; \
test ! -d $${crashes} || ./$$f $${crashes}/*; \
done

40
fuzz/fuzz_crls.c Normal file
View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2018 Tobias Brunner
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <library.h>
#include <utils/debug.h>
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
certificate_t *cert;
chunk_t chunk;
dbg_default_set_level(-1);
library_init(NULL, "fuzz_crls");
plugin_loader_add_plugindirs(PLUGINDIR, PLUGINS);
if (!lib->plugins->load(lib->plugins, PLUGINS))
{
return 1;
}
chunk = chunk_create((u_char*)buf, len);
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL,
BUILD_BLOB, chunk, BUILD_END);
DESTROY_IF(cert);
lib->plugins->unload(lib->plugins);
library_deinit();
return 0;
}

33
fuzz/fuzz_ids.c Normal file
View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2018 Tobias Brunner
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <library.h>
#include <utils/debug.h>
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
identification_t *id;
chunk_t chunk;
dbg_default_set_level(-1);
library_init(NULL, "fuzz_ids");
chunk = chunk_create((u_char*)buf, len);
id = identification_create_from_data(chunk);
DESTROY_IF(id);
library_deinit();
return 0;
}

73
fuzz/fuzz_pa_tnc.c Normal file
View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2018 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <library.h>
#include <imcv.h>
#include <pa_tnc/pa_tnc_msg.h>
#include <ietf/ietf_attr_pa_tnc_error.h>
#include <utils/debug.h>
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
pa_tnc_msg_t *msg;
pa_tnc_attr_t *attr;
ietf_attr_pa_tnc_error_t *error;
linked_list_t *non_fatal_types;
enumerator_t *enumerator;
chunk_t chunk;
dbg_default_set_level(-1);
library_init(NULL, "fuzz_pa_tnc");
plugin_loader_add_plugindirs(PLUGINDIR, PLUGINS);
if (!lib->plugins->load(lib->plugins, PLUGINS))
{
return 1;
}
libimcv_init(FALSE);
chunk = chunk_create((u_char*)buf, len);
/* Parse incoming PA-TNC message */
msg = pa_tnc_msg_create_from_data(chunk);
if (msg->process(msg) == SUCCESS)
{
non_fatal_types = linked_list_create();
msg->process_ietf_std_errors(msg, non_fatal_types);
non_fatal_types->destroy(non_fatal_types);
}
/* enumerate correctly decoded attributes */
enumerator = msg->create_attribute_enumerator(msg);
while (enumerator->enumerate(enumerator, &attr))
{
attr->get_noskip_flag(attr);
}
enumerator->destroy(enumerator);
/* enumerate errors detected while parsing PA-TNC message and attributes */
enumerator = msg->create_error_enumerator(msg);
while (enumerator->enumerate(enumerator, &attr))
{
error = (ietf_attr_pa_tnc_error_t*)attr;
error->get_error_code(error);
}
enumerator->destroy(enumerator);
msg->destroy(msg);
libimcv_deinit();
lib->plugins->unload(lib->plugins);
library_deinit();
return 0;
}

78
fuzz/fuzz_pb_tnc.c Normal file
View File

@ -0,0 +1,78 @@
/*
* Copyright (C) 2018 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <library.h>
#include <batch/pb_tnc_batch.h>
#include <messages/ietf/pb_error_msg.h>
#include <state_machine/pb_tnc_state_machine.h>
#include <utils/debug.h>
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
pb_tnc_batch_t *batch;
pb_tnc_state_machine_t *state;
pb_tnc_msg_t *msg;
pb_error_msg_t *error;
enumerator_t *enumerator;
bool from_server;
chunk_t chunk;
dbg_default_set_level(-1);
library_init(NULL, "fuzz_pb_tnc");
plugin_loader_add_plugindirs(PLUGINDIR, PLUGINS);
if (!lib->plugins->load(lib->plugins, PLUGINS))
{
return 1;
}
chunk = chunk_create((u_char*)buf, len);
INIT(state,
.receive_batch = (void*)return_true,
.set_empty_cdata = (void*)nop,
);
/* parse incoming PB-TNC batch */
batch = pb_tnc_batch_create_from_data(chunk);
if (batch->process_header(batch, TRUE, FALSE, &from_server) == SUCCESS ||
batch->process_header(batch, TRUE, TRUE, &from_server) == SUCCESS)
{
batch->process(batch, state);
}
/* enumerate correctly decoded PB-TNC messages */
enumerator = batch->create_msg_enumerator(batch);
while (enumerator->enumerate(enumerator, &msg))
{
msg->get_type(msg);
}
enumerator->destroy(enumerator);
/* enumerate errors detected while parsing PB-TNC batch and messages */
enumerator = batch->create_error_enumerator(batch);
while (enumerator->enumerate(enumerator, &msg))
{
error = (pb_error_msg_t*)msg;
error->get_error_code(error);
}
enumerator->destroy(enumerator);
batch->destroy(batch);
free(state);
lib->plugins->unload(lib->plugins);
library_deinit();
return 0;
}

59
fuzz/libFuzzerLocal.c Normal file
View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2017 Tobias Brunner
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <library.h>
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
__attribute__((weak)) extern int LLVMFuzzerInitialize(int *argc, char ***argv);
/**
* This is a simple driver for the fuzz targets to verify test inputs outside
* of OSS-Fuzz.
*
* Failures will usually cause crashes.
*/
int main(int argc, char **argv)
{
chunk_t *data;
int i, res = 0;
fprintf(stderr, "%s: running %d inputs\n", argv[0], argc - 1);
if (LLVMFuzzerInitialize)
{
LLVMFuzzerInitialize(&argc, &argv);
}
for (i = 1; i < argc; i++)
{
fprintf(stderr, "running: %s\n", argv[i]);
data = chunk_map(argv[i], FALSE);
if (!data)
{
fprintf(stderr, "opening %s failed: %s\n", argv[i], strerror(errno));
return 1;
}
res = LLVMFuzzerTestOneInput(data->ptr, data->len);
fprintf(stderr, "done: %s: (%zd bytes)\n", argv[i], data->len);
chunk_unmap(data);
if (res)
{
break;
}
}
fprintf(stderr, "%s: completed %d inputs\n", argv[0], i-1);
return res;
}

View File

@ -3,12 +3,12 @@ SUBDIRS =
if USE_LEGACY_SYSTEMD
if USE_CHARON
SUBDIRS += systemd
SUBDIRS += systemd-starter
endif
endif
if USE_SYSTEMD
if USE_SWANCTL
SUBDIRS += systemd-swanctl
SUBDIRS += systemd
endif
endif

1
init/systemd-starter/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
strongswan-starter.service

View File

@ -0,0 +1,12 @@
EXTRA_DIST = strongswan-starter.service.in
CLEANFILES = strongswan-starter.service
systemdsystemunit_DATA = strongswan-starter.service
strongswan-starter.service : strongswan-starter.service.in
$(AM_V_GEN) \
sed \
-e "s:@SBINDIR@:$(sbindir):" \
-e "s:@IPSEC_SCRIPT@:$(ipsec_script):" \
$(srcdir)/$@.in > $@

View File

@ -0,0 +1,10 @@
[Unit]
Description=strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf
After=syslog.target network-online.target
[Service]
ExecStart=@SBINDIR@/@IPSEC_SCRIPT@ start --nofork
Restart=on-abnormal
[Install]
WantedBy=multi-user.target

View File

@ -1 +0,0 @@
strongswan-swanctl.service

View File

@ -1,11 +0,0 @@
EXTRA_DIST = strongswan-swanctl.service.in
CLEANFILES = strongswan-swanctl.service
systemdsystemunit_DATA = strongswan-swanctl.service
strongswan-swanctl.service : strongswan-swanctl.service.in
$(AM_V_GEN) \
sed \
-e "s:@SBINDIR@:$(sbindir):" \
$(srcdir)/$@.in > $@

View File

@ -1,13 +0,0 @@
[Unit]
Description=strongSwan IPsec IKEv1/IKEv2 daemon using swanctl
After=network-online.target
[Service]
Type=notify
ExecStart=@SBINDIR@/charon-systemd
ExecStartPost=@SBINDIR@/swanctl --load-all --noprompt
ExecReload=@SBINDIR@/swanctl --reload
Restart=on-abnormal
[Install]
WantedBy=multi-user.target

View File

@ -8,5 +8,4 @@ strongswan.service : strongswan.service.in
$(AM_V_GEN) \
sed \
-e "s:@SBINDIR@:$(sbindir):" \
-e "s:@IPSEC_SCRIPT@:$(ipsec_script):" \
$(srcdir)/$@.in > $@

View File

@ -1,11 +1,15 @@
[Unit]
Description=strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf
After=syslog.target network-online.target
Description=strongSwan IPsec IKEv1/IKEv2 daemon using swanctl
After=network-online.target
[Service]
ExecStart=@SBINDIR@/@IPSEC_SCRIPT@ start --nofork
StandardOutput=syslog
Type=notify
ExecStart=@SBINDIR@/charon-systemd
ExecStartPost=@SBINDIR@/swanctl --load-all --noprompt
ExecReload=@SBINDIR@/swanctl --reload
ExecReload=@SBINDIR@/swanctl --load-all --noprompt
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
Alias=strongswan-swanctl.service

View File

@ -323,7 +323,7 @@ defines the action to take if the remote peer unexpectedly closes a CHILD_SA
for meaning of values).
A
.B closeaction should not be
used if the peer uses reauthentication or uniquids checking, as these events
used if the peer uses reauthentication or uniqueids checking, as these events
might trigger the defined action when not desired.
.TP
.BR compress " = yes | " no
@ -538,10 +538,6 @@ The value \fB%forever\fP
means 'never give up'.
Relevant only locally, other end need not agree on it.
.TP
.B keylife
synonym for
.BR lifetime .
.TP
.BR left " = <ip address> | <fqdn> | " %any " | <range> | <subnet> "
The IP address of the left participant's public-network interface
or one of several magic values.
@ -609,9 +605,10 @@ To limit the acceptable set of hashing algorithms for trustchain validation,
append hash algorithms to
.BR pubkey
or a key strength definition (for example
.BR pubkey-sha1-sha256
.BR pubkey-sha256-sha512 ,
.BR rsa-2048-sha256-sha384-sha512 ,
or
.BR rsa-2048-ecdsa-256-sha256-sha384-sha512 ).
.BR rsa-2048-sha256-ecdsa-256-sha256-sha384 ).
Unless disabled in
.BR strongswan.conf (5),
or explicit IKEv2 signature constraints are configured (see below), such key
@ -631,6 +628,12 @@ constraint (without ike: prefix) will also apply to IKEv2 authentication, unless
this is disabled in
.BR strongswan.conf (5).
To use or require RSASSA-PSS signatures use rsa/pss instead of rsa as in e.g.
.BR ike:rsa/pss-sha256 .
If \fBpubkey\fR or \fBrsa\fR constraints are configured RSASSA-PSS signatures
will only be used/accepted if enabled in
.BR strongswan.conf (5).
For
.BR eap ,
an optional EAP method can be appended. Currently defined methods are
@ -1031,8 +1034,8 @@ Relevant only locally, other end need not agree on it. Also see EXPIRY/REKEY
below.
.TP
.BR mark " = <value>[/<mask>]"
sets an XFRM mark in the inbound and outbound
IPsec SAs and policies. If the mask is missing then a default
sets an XFRM mark on the inbound policy and outbound
IPsec SA and policy. If the mask is missing then a default
mask of
.B 0xffffffff
is assumed. The special value
@ -1043,13 +1046,13 @@ make the mark unique for each IPsec SA direction (in/out) the special value
may be used.
.TP
.BR mark_in " = <value>[/<mask>]"
sets an XFRM mark in the inbound IPsec SA and
policy. If the mask is missing then a default mask of
sets an XFRM mark on the inbound policy (not on the SA). If the mask is missing
then a default mask of
.B 0xffffffff
is assumed.
.TP
.BR mark_out " = <value>[/<mask>]"
sets an XFRM mark in the outbound IPsec SA and
sets an XFRM mark on the outbound IPsec SA and
policy. If the mask is missing then a default mask of
.B 0xffffffff
is assumed.
@ -1128,10 +1131,6 @@ will suppress randomization.
Relevant only locally, other end need not agree on it. Also see EXPIRY/REKEY
below.
.TP
.B rekeymargin
synonym for
.BR margintime .
.TP
.BR replay_window " = " \-1 " | <number>"
The IPsec replay window size for this connection. With the default of \-1
the value configured with

View File

@ -1,19 +0,0 @@
SOURCE:=../../src/frontends/gnome
VERSION:=1.3.1
source: prepare
cd build/NetworkManager-strongswan-$(VERSION) && debuild -S
prepare: clean
mkdir build
make -C $(SOURCE) dist-gzip
mv $(SOURCE)/NetworkManager-strongswan-$(VERSION).tar.gz build/network-manager-strongswan_$(VERSION).orig.tar.gz
tar -zxv -C build -f build/network-manager-strongswan_$(VERSION).orig.tar.gz
dch -b -v $(VERSION)
cp -R debian build/NetworkManager-strongswan-$(VERSION)
clean:
rm -Rf build
.PHONY: source prepare clean

View File

@ -1,54 +0,0 @@
network-manager-strongswan (1.3.1-1) unstable; urgency=low
* New upstream release, adds PSK support
* Invoke charon-nm as IKE backend (Closes: #741415)
* Hand over maintenance to Debian strongSwan Maintainers (pkg-swan)
-- Martin <martin@strongswan.org> Thu, 24 Apr 2014 15:42:39 +0200
network-manager-strongswan (1.3.0-1) unstable; urgency=low
* New upstream release, support for NetworkManager 0.9 (Closes: #639400)
-- Martin Willi <martin@strongswan.org> Mon, 02 Jul 2012 09:55:20 +0200
network-manager-strongswan (1.1.2-2) unstable; urgency=low
* Do not install unused libtool and static libraries
(Closes: #622499)
-- Martin Willi <martin@strongswan.org> Tue, 19 Apr 2011 11:07:10 +0200
network-manager-strongswan (1.1.2-1) unstable; urgency=low
* New upstream release, fixes pkgconfig for new libnm-glib packages
(Closes: #569302)
-- Martin Willi <martin@strongswan.org> Thu, 18 Feb 2010 09:41:39 +0100
network-manager-strongswan (1.1.1-2) unstable; urgency=low
* Added ${shlibs:Depends} dependency
* Reload network-manager after installation, reloading dbus is insufficient.
* Fixed debhelper-but-no-misc-depends, out-of-date-standards-version and
copyright-without-copyright-notice lintian warnings
-- Martin Willi <martin@strongswan.org> Mon, 12 Oct 2009 10:19:40 +0200
network-manager-strongswan (1.1.1-1) unstable; urgency=low
* New upstream release fixing a crasher when saving connections
* Fix "Wrong path to network-manager initscript in postinst"
Reload dbus instead of network-manager, as other VPN plugins do.
(Closes: #529189)
* Fix "FTBFS: No package 'libnm-util' found"
added dependencies to libnm-util-dev and libnm-glib-vpn-dev
(Closes: #528977)
-- Martin Willi <martin@strongswan.org> Tue, 19 May 2009 13:16:51 +0200
network-manager-strongswan (1.1.0-1) unstable; urgency=low
* Initial Debian packaging of NetworkManager plugin for strongSwan
-- Martin Willi <martin@strongswan.org> Wed, 25 Mar 2009 09:07:05 +0100

View File

@ -1,31 +0,0 @@
Source: network-manager-strongswan
Section: net
Priority: extra
Maintainer: strongSwan Maintainers <pkg-swan-devel@lists.alioth.debian.org>
Uploaders: Rene Mayrhofer <rmayr@debian.org>,
Yves-Alexis Perez <corsac@debian.org>,
Romain Francoise <rfrancoise@debian.org>
Build-Depends: cdbs,
debhelper (>= 7),
network-manager-dev (>= 0.9),
libnm-util-dev (>= 0.9),
libnm-glib-dev (>= 0.9),
libnm-glib-vpn-dev (>= 0.9),
libdbus-glib-1-dev,
libgnomeui-dev,
automake,
gnome-common,
Standards-Version: 3.9.1
Package: network-manager-strongswan
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, strongswan-nm, network-manager (>= 0.9)
Description: network management framework (strongSwan plugin)
NetworkManager attempts to keep an active network connection available at
all times. It is intended primarily for laptops where it allows easy
switching between local wireless networks, it's also useful on desktops
with a selection of different interfaces to use. It is not intended for
usage on servers.
.
This package provides a VPN plugin for strongSwan, providing easy access to
IKEv2 IPSec VPN's.

View File

@ -1,10 +0,0 @@
Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59
Name: NetworkManager-strongswan
Source: http://download.strongswan.org/NetworkManager
Copyright: 2008-2009, Martin Willi <martin@strongswan.org>
2005-2008, Dan Williams
2005, David Zeuthen
License: GPL-2
On Debian systems the full text of the GNU General Public License can be found
in the `/usr/share/common-licenses/GPL-2' file.

View File

@ -1,19 +0,0 @@
#!/bin/sh
set -e
case "$1" in
configure)
if [ -x "/etc/init.d/network-manager" ]; then
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d network-manager force-reload || true
else
/etc/init.d/network-manager force-reload || true
fi
fi
;;
esac
#DEBHELPER#
exit 0

View File

@ -1,16 +0,0 @@
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
DEB_CONFIGURE_EXTRA_FLAGS := --with-charon=/usr/lib/ipsec/charon-nm
DEB_CONFIGURE_LIBEXECDIR := "\$$(prefix)/lib/NetworkManager"
DEB_DH_MAKESHLIBS_ARGS_ALL := -X/usr/lib/NetworkManager/
DEB_DH_INSTALL_SOURCEDIR := debian/tmp
install/network-manager-strongswan::
rm debian/network-manager-strongswan/usr/lib/NetworkManager/libnm-strongswan-properties.*a

View File

@ -1,19 +0,0 @@
SOURCE=../..
VERSION:=5.0.1dr1
source: prepare
cd build/strongswan-$(VERSION) && debuild -S
prepare: clean
mkdir build
make -C $(SOURCE) dist-gzip
mv $(SOURCE)/strongswan-$(VERSION).tar.gz build/strongswan_$(VERSION).orig.tar.gz
tar -zxv -C build -f build/strongswan_$(VERSION).orig.tar.gz
dch -b -v $(VERSION)
cp -R debian build/strongswan-$(VERSION)
clean:
rm -Rf build
.PHONY: source prepare clean

View File

@ -1,5 +0,0 @@
strongswan (5.0.1dr1) unstable; urgency=low
* New package for strongSwan 5.0 series
-- Martin Willi <martin@strongswan.org> Mon, 02 Jul 2012 18:48:55 +0200

View File

@ -1 +0,0 @@
7

View File

@ -1,61 +0,0 @@
Source: strongswan
Section: net
Priority: extra
Maintainer: Martin Willi <martin@strongswan.org>
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 7.0.0), libssl-dev (>= 0.9.8), libcap-dev, network-manager-dev (>= 0.9), libnm-glib-dev (>= 0.9), libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl4-nss-dev, libldap2-dev, libmysqlclient-dev, libsqlite3-dev
Homepage: http://www.strongswan.org
Package: strongswan
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: IPsec VPN solution.
strongSwan is a IPsec based VPN solution for the Linux kernel. It uses the
native IPsec stack and runs on any recent 2.6 kernel (no patching required).
It supports both, the IKEv1 and the newer IKEv2 protocols.
.
This package contains the IKEv1/IKEv2 keying daemon charon and command line
configuration backend.
Package: strongswan-tools
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Additional command line tools for strongSwan.
This packages provides pki and other strongSwan utilities.
Package: strongswan-nm
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, network-manager (>= 0.9)
Description: strongSwan plugin to interact with NetworkManager
This plugin provides an interface which allows NetworkManager to configure
and control the IKEv2 daemon directly through DBUS. It is designed to work
in conjunction with the network-manager-strongswan package, providing
a simple graphical frontend to configure IPsec based VPNs.
Package: libstrongswan
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: strongSwan utility and crypto library
libstrongswan is the underlying library of charon and other strongSwan
components. It is built in a modular way and is extendable through various
plugins.
Package: libstrongswan-dev
Architecture: any
Priority: optional
Depends: ${misc:Depends}, libstrongswan (=${binary:Version})
Section: devel
Description: strongSwan development headers
C header files to develop with libstrongswan.
Package: strongswan-dbg
Architecture: any
Section: debug
Priority: extra
Depends: ${misc:Depends}, strongswan, libstrongswan
Description: strongSwan library and binaries - debugging symbols
StrongSwan is an IPsec-based VPN solution for the Linux kernel. It uses the
native IPsec stack and runs on any recent 2.6 kernel (no patching required).
It supports both IKEv1 and the newer IKEv2 protocols.
.
This package provides the symbols needed for debugging of strongswan.

View File

@ -1,2 +0,0 @@
usr/lib/strongswan/include/config.h usr/lib/strongswan/include/
usr/include/strongswan/* usr/include/strongswan/

View File

@ -1,31 +0,0 @@
etc/strongswan.conf etc/
usr/lib/strongswan/libstrongswan.so* usr/lib/strongswan/
usr/lib/strongswan/libcharon.so* usr/lib/strongswan/
usr/lib/strongswan/libtls.so* usr/lib/strongswan/
usr/lib/strongswan/plugins/libstrongswan-x509.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-pubkey.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-xcbc.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-random.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-agent.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-openssl.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-ldap.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-curl.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-kernel-netlink.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-eap-identity.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-eap-mschapv2.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-eap-tls.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-eap-md5.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-pkcs1.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-revocation.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-nonce.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-pkcs8.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-pem.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-socket-default.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-constraints.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-ctr.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-ccm.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-cmac.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-gcm.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-xauth-generic.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-xauth-eap.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-pkcs11.so* usr/lib/strongswan/plugins/

View File

@ -1,71 +0,0 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
CC = gcc
CFLAGS = -Wall -Wno-format -Wno-pointer-sign -g
CONFIGURE_ARGS = \
--prefix=/usr --libexecdir=/usr/lib --sysconfdir=/etc --enable-curl \
--enable-ldap --disable-aes --disable-des --disable-md5 --disable-sha1 \
--disable-sha2 --disable-fips-prf --disable-gmp --disable-pgp --disable-dnskey \
--enable-mysql --enable-sqlite --enable-eap-identity --enable-eap-md5 \
--enable-eap-mschapv2 --enable-eap-tls --enable-eap-radius --enable-xauth-eap \
--enable-farp --enable-attr-sql --enable-dhcp --enable-openssl --enable-agent \
--enable-pkcs11 --enable-ctr --enable-ccm --enable-gcm --enable-addrblock \
--enable-nm --disable-hmac --with-capabilities=libcap \
--with-ipsecdir=/usr/lib/strongswan --with-ipseclibdir=/usr/lib/strongswan \
--with-dev-headers=/usr/include/strongswan
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O2
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif
ifeq ($(DEB_BUILD_ARCH_CPU),i386)
CONFIGURE_ARGS += --enable-padlock
endif
build:
dh_testdir
./configure $(CONFIGURE_ARGS) CC="$(CC)" CFLAGS="$(CFLAGS)"
$(MAKE)
touch build
clean:
dh_testdir
dh_testroot
rm -f build
[ ! -f Makefile ] || $(MAKE) clean
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean
dh_installdirs
$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs NEWS
dh_installdocs README
dh_installinit --name=ipsec
dh_install -s
dh_link
dh_strip --dbg=strongswan-dbg
dh_compress
dh_fixperms -Xetc/ipsec.secrets -Xetc/ipsec.d
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol -s
dh_md5sums
dh_builddeb -s
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

View File

@ -1 +0,0 @@
usr/lib/strongswan/charon-nm usr/lib/strongswan/

View File

@ -1,133 +0,0 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: vpn
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Strongswan IPsec services
### END INIT INFO
# Author: Rene Mayrhofer <rene@mayrhofer.eu.org>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="strongswan IPsec services"
NAME=ipsec
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- start \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
# give the proper signal to stop
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- stop \
|| return 2
# but kill if that didn't work
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
do_reload() {
$DAEMON reload
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
$DAEMON status
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -1,3 +0,0 @@
usr/lib/strongswan/scepclient usr/lib/strongswan/
usr/lib/strongswan/pki usr/lib/strongswan/
usr/share/man/man8/scepclient.8 usr/share/man/man8/

View File

@ -1,36 +0,0 @@
usr/lib/strongswan/_updown usr/lib/strongswan/
usr/lib/strongswan/_updown_espmark usr/lib/strongswan/
usr/lib/strongswan/starter usr/lib/strongswan/
usr/lib/strongswan/_copyright usr/lib/strongswan/
usr/lib/strongswan/pool usr/lib/strongswan/
usr/lib/strongswan/libradius.so* usr/lib/strongswan/
usr/sbin/ipsec usr/sbin/
etc/ipsec.conf etc/
etc/ipsec.d etc/
etc/ipsec.d/reqs etc/ipsec.d/
etc/ipsec.d/cacerts etc/ipsec.d/
etc/ipsec.d/aacerts etc/ipsec.d/
etc/ipsec.d/acerts etc/ipsec.d/
etc/ipsec.d/ocspcerts etc/ipsec.d/
etc/ipsec.d/private etc/ipsec.d/
etc/ipsec.d/crls etc/ipsec.d/
etc/ipsec.d/certs etc/ipsec.d/
usr/share/man/man8/ipsec.8 usr/share/man/man8/
usr/share/man/man8/_updown.8 usr/share/man/man8/
usr/share/man/man8/_updown_espmark.8 usr/share/man/man8/
usr/share/man/man5/ipsec.conf.5 usr/share/man/man5/
usr/share/man/man5/ipsec.secrets.5 usr/share/man/man5/
usr/share/man/man5/strongswan.conf.5 usr/share/man/man5/
usr/lib/strongswan/charon usr/lib/strongswan/
usr/lib/strongswan/stroke usr/lib/strongswan/
usr/lib/strongswan/plugins/libstrongswan-stroke.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-updown.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-attr-sql.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-mysql.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-sqlite.so usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-addrblock.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-eap-radius.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-dhcp.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-farp.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-attr.so* usr/lib/strongswan/plugins/
usr/lib/strongswan/plugins/libstrongswan-resolve.so* usr/lib/strongswan/plugins/

View File

@ -1,2 +0,0 @@
version=3
http://download.strongswan.org/strongswan-([\d.]+)\.tar\.bz2

View File

@ -1,3 +1,5 @@
EXTRA_DIST = git-version
AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libtls \

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
* Hochschule fuer Technik Rapperswil
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the

Some files were not shown because too many files have changed in this diff Show More