Compare commits

...

1280 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
7231 changed files with 137792 additions and 76747 deletions

View File

@ -3,6 +3,7 @@ clone_depth: 50
image:
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019
environment:
global:
@ -18,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

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,67 +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
env: TEST=fuzzing MONOLITHIC=yes
- 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 \

505
NEWS
View File

@ -1,11 +1,436 @@
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"
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.
@ -13,6 +438,18 @@ strongswan-5.7.0
- 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
----------------
@ -463,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
@ -971,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
----------------
@ -1038,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
@ -1109,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
@ -1215,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
@ -1540,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.
@ -1760,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.
@ -1785,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.
@ -1807,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.
@ -2248,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.
@ -2306,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
@ -2325,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
@ -2382,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
@ -2533,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
@ -2553,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.
@ -2691,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
@ -2775,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).
@ -2812,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
@ -2920,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
@ -2946,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
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_AQUIRE event led to an entry in
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.
@ -3325,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.

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 ##
@ -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
}
}
}
}
}
@ -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,7 +116,7 @@ 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
@ -167,7 +167,7 @@ Configuration on host _sun_:
children {
host-host {
start_action = trap
}
}
}
}
}
@ -215,7 +215,7 @@ Configuration on roadwarrior _carol_:
/etc/swanctl/swanctl.conf:
connections {
connections {
home {
remote_addrs = moon.strongswan.org
@ -315,7 +315,7 @@ Configuration on roadwarrior _carol_:
/etc/swanctl/swanctl.conf:
connections {
connections {
home {
remote_addrs = moon.strongswan.org
vips = 0.0.0.0
@ -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 ###
@ -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,7 +570,7 @@ 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 \
--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.

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

@ -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 \
@ -101,6 +103,7 @@ plugins = \
plugins/updown.opt \
plugins/vici.opt \
plugins/whitelist.opt \
plugins/wolfssl.opt \
plugins/xauth-eap.opt \
plugins/xauth-pam.opt
@ -173,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,37 +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>.path =
Optional path to the log file. Overrides the section name, may be used
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.<filename>.default = 1
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).
@ -63,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.
@ -36,6 +40,29 @@ charon.cache_crls = no
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).
@ -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.
@ -370,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.
@ -409,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.

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.

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

@ -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,18 +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)
(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

@ -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

@ -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.

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

@ -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,6 +1,10 @@
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

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

@ -40,12 +40,6 @@ Section names and keys may contain any printable character except:
. , : { } = " # \\n \\t space
.EE
.PP
In rare circumstances \fB.\fP characters may be used in section names (e.g. for
log file names in a filelog section), but should generally be avoided.
To use \fB:\fP characters in section names (e.g. for Windows log file paths)
they may be written as \fB::\fP, which the parser replaces with a single
\fB:\fP.
An example file in this format might look like this:
.PP
.EX

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
@ -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-2017 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.7.0dr6])
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.])
@ -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,33 +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
GPERF_OUTPUT="`echo foo | ${GPERF}`"
AC_COMPILE_IFELSE(
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*, 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([yes])
else
AC_MSG_RESULT([no])
fi
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
# ========================
@ -444,7 +461,7 @@ if test x$imc_test = xtrue -o x$imv_test = xtrue -o x$imc_scanner = xtrue -o x$i
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
@ -648,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])
@ -1025,44 +1042,34 @@ if test x$tss_tss2 = xtrue; then
PKG_CHECK_MODULES(tss2_esys, [tss2-esys],
[tss2_esys=true; AC_DEFINE([TSS2_ESYS], [], [use TSS2 v2 Extended System API])],
[tss2_esys=false])
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_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")
elif 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])
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; 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])
@ -1148,6 +1155,12 @@ if test x$openssl = xtrue; then
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!])])
@ -1162,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!])])
@ -1182,10 +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_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
@ -1194,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
@ -1243,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
@ -1291,15 +1333,26 @@ if test x$coverage = xtrue; then
fi
if test x$fuzzing = xtrue; then
if test x$libfuzzer = x; then
case "$libfuzzer" in
"")
AC_MSG_NOTICE([fuzz targets enabled without libFuzzer, using local driver])
CFLAGS="${CFLAGS} -fsanitize=address"
libfuzzer="libFuzzerLocal.a"
else
;;
"-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)
fi
;;
esac
fi
if test x$ruby_gems = xtrue; then
@ -1315,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])
@ -1328,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])
@ -1345,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
# ===============================================
@ -1411,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])
@ -1426,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])
@ -1464,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])
@ -1580,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)
@ -1593,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
# ----------------
@ -1632,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)
@ -1691,7 +1774,6 @@ AM_CONDITIONAL(USE_COUNTERS, test x$counters = xtrue)
# ---------------
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)
@ -1742,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
@ -1810,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
@ -1859,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
@ -1868,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
@ -1921,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
@ -2001,8 +2088,6 @@ AC_CONFIG_FILES([
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
@ -2012,6 +2097,7 @@ AC_CONFIG_FILES([
src/sw-collector/Makefile
src/sec-updater/Makefile
src/swanctl/Makefile
src/xfrmi/Makefile
scripts/Makefile
testing/Makefile
])

1
fuzz/.gitignore vendored
View File

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

View File

@ -1,4 +1,5 @@
AM_CPPFLAGS = @CPPFLAGS@ \
@FUZZING_CFLAGS@ \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libimcv \
-I$(top_srcdir)/src/libtncif \
@ -24,7 +25,7 @@ pb_tnc_ldflags = \
$(top_builddir)/src/libtncif/.libs/libtncif.a \
$(fuzz_ldflags)
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_pa_tnc fuzz_pb_tnc
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_ids fuzz_pa_tnc fuzz_pb_tnc
all-local: $(FUZZ_TARGETS)
@ -36,6 +37,9 @@ fuzz_certs: fuzz_certs.c ${libfuzzer}
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)

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;
}

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

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

@ -196,6 +196,11 @@ int main(int argc, char *argv[])
if (argc > 2)
{
len = atoi(argv[2]);
if (len > (1 << 30))
{
fprintf(stderr, "buffer too large (1 GiB limit)\n");
return 1;
}
}
if (argc > 3)
{

View File

@ -47,6 +47,7 @@ struct {
{"ecp192", ECP_192_BIT},
{"ecp224", ECP_224_BIT},
{"curve25519", CURVE_25519},
{"curve448", CURVE_448},
};
static void start_timing(struct timespec *start)

View File

@ -1,21 +1,31 @@
#!/bin/bash
DIR=$(dirname `readlink -f $0`)
# we run an unprinted group, as it seems the first run is inaccurate (cache?)
function modptest {
$DIR/dh_speed "$1" 400 modp768 modp768 modp1024 modp1024s160 modp1536 modp2048 modp2048s224 modp2048s256 | tail -n 7
$DIR/dh_speed "$1" 100 modp1024 modp3072 modp4096 | tail -n 2
$DIR/dh_speed "$1" 5 modp2048 modp6144 modp8192 | tail -n 2
}
echo "testing gmp"
# gmp needs a RNG plugin, pick gcrypt
sudo ./dh_speed "gmp gcrypt" 400 modp768 modp768 modp1024 modp1024s160 modp1536 modp2048 modp2048s224 modp2048s256 | tail -n 7
sudo ./dh_speed "gmp gcrypt" 100 modp1024 modp3072 modp4096 | tail -n 2
sudo ./dh_speed "gmp gcrypt" 5 modp2048 modp6144 modp8192 | tail -n 2
# gmp needs an RNG plugin, pick gcrypt
modptest "gmp gcrypt"
echo "testing curve25519"
# curve25519 needs an RNG plugin, pick gcrypt
$DIR/dh_speed "curve25519 gcrypt" 300 curve25519 curve25519 | tail -n 1
echo "testing gcrypt"
sudo ./dh_speed "gcrypt" 400 modp768 modp768 modp1024 modp1024s160 modp1536 modp2048 modp2048s224 modp2048s256 | tail -n 7
sudo ./dh_speed "gcrypt" 100 modp1024 modp3072 modp4096 | tail -n 2
sudo ./dh_speed "gcrypt" 5 modp2048 modp6144 modp8192 | tail -n 2
modptest "gcrypt"
echo "testing openssl"
sudo ./dh_speed "openssl" 400 modp768 modp768 modp1024 modp1024s160 modp1536 modp2048 modp2048s224 modp2048s256 | tail -n 7
sudo ./dh_speed "openssl" 100 modp1024 modp3072 modp4096 | tail -n 2
sudo ./dh_speed "openssl" 5 modp2048 modp6144 modp8192 | tail -n 2
sudo ./dh_speed "openssl" 300 ecp192 ecp192 ecp224 ecp256 ecp384 ecp521 | tail -n 5
modptest "openssl"
$DIR/dh_speed "openssl" 300 ecp192 ecp192 ecp224 ecp256 ecp384 ecp521 | tail -n 5
echo "testing botan"
modptest "botan"
$DIR/dh_speed "botan" 300 ecp256 ecp256 ecp384 ecp521 | tail -n 3
$DIR/dh_speed "botan" 300 curve25519 curve25519 | tail -n 1

16
scripts/git-version Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
SRCDIR=$1
TARBALL=$SRCDIR/.tarball-git-version
if test -f $TARBALL; then
V=$(cat $TARBALL)
elif test -d $SRCDIR/.git; then
V=$(git -C $SRCDIR describe --tags HEAD 2>/dev/null)
fi
if test -z "$V"; then
V="UNKNOWN"
fi
echo $V

View File

@ -45,13 +45,13 @@ int main(int argc, char *argv[])
if (!enum_from_name(hash_algorithm_short_names, argv[1], &alg))
{
fprintf(stderr, "unknown hash algorthm: %s\n", argv[1]);
fprintf(stderr, "unknown hash algorithm: %s\n", argv[1]);
return 1;
}
hasher = lib->crypto->create_hasher(lib->crypto, alg);
if (!hasher)
{
fprintf(stderr, "hash algorthm not supported: %N\n",
fprintf(stderr, "hash algorithm not supported: %N\n",
hash_algorithm_names, alg);
return 1;
}

View File

@ -14,6 +14,8 @@
*/
#include <stdio.h>
#include <library.h>
#include <utils/identification.h>
/**
@ -25,6 +27,9 @@ int main(int argc, char *argv[])
chunk_t enc;
int i;
library_init(NULL, "id2sql");
atexit(library_deinit);
if (argc < 2)
{
return -1;
@ -45,6 +50,7 @@ int main(int argc, char *argv[])
printf("%02x", (unsigned int)enc.ptr[i]);
}
printf("'\n");
id->destroy(id);
return 0;
}

View File

@ -56,6 +56,10 @@ int main(int argc, char *argv[])
}
rounds = atoi(argv[3]);
if (rounds < 0 || rounds > (1 << 26))
{ /* arbitrary limit to the number of chunk_t/sigs that fit into 1 GiB */
usage();
}
if (streq(argv[2], "rsa"))
{

View File

@ -35,4 +35,6 @@ function ecdsatestall {
rsatestall "gmp gcrypt pem pkcs1"
rsatestall "gcrypt pem pkcs1"
rsatestall "openssl pem"
rsatestall "botan pem"
ecdsatestall "openssl pem"
ecdsatestall "botan pem"

View File

@ -73,7 +73,7 @@ static void print_section(section_t *section, int level)
printf("%s%s", j == 0 ? " : " : ", ", ref->name);
}
}
printf(" {\n", indent);
printf(" {\n");
print_section(sub, level + 1);
printf("%s}\n", indent);
}
@ -81,7 +81,6 @@ static void print_section(section_t *section, int level)
/**
* Recursively print a given section and all subsections/settings
* FIXME: Doesn't work properly if any of the keys contain dots
*/
static void print_settings_section(settings_t *settings, char *section,
int level)

View File

@ -1,12 +1,104 @@
#!/bin/sh
# Build script for Travis CI
# Build script for CI
if test -z $TRAVIS_BUILD_DIR; then
TRAVIS_BUILD_DIR=$PWD
build_botan()
{
# same revision used in the build recipe of the testing environment
BOTAN_REV=2.18.0
BOTAN_DIR=$DEPS_BUILD_DIR/botan
if test -d "$BOTAN_DIR"; then
return
fi
echo "$ build_botan()"
# if the leak detective is enabled we have to disable threading support
# (used for std::async) as that causes invalid frees somehow, the
# locking allocator causes a static leak via the first function that
# references it (e.g. crypter or hasher), so we disable that too
if test "$LEAK_DETECTIVE" = "yes"; then
BOTAN_CONFIG="--without-os-features=threads
--disable-modules=locking_allocator"
fi
# disable some larger modules we don't need for the tests
BOTAN_CONFIG="$BOTAN_CONFIG --disable-modules=pkcs11,tls,x509,xmss
--prefix=$DEPS_PREFIX"
git clone https://github.com/randombit/botan.git $BOTAN_DIR &&
cd $BOTAN_DIR &&
git checkout -qf $BOTAN_REV &&
python ./configure.py --amalgamation $BOTAN_CONFIG &&
make -j4 libs >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
}
build_wolfssl()
{
WOLFSSL_REV=0caf3ba456f1 # v4.7.1r + SHA-3 fix
WOLFSSL_DIR=$DEPS_BUILD_DIR/wolfssl
if test -d "$WOLFSSL_DIR"; then
return
fi
echo "$ build_wolfssl()"
WOLFSSL_CFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DES_ECB -DHAVE_AES_ECB \
-DHAVE_ECC_BRAINPOOL -DWOLFSSL_MIN_AUTH_TAG_SZ=8"
WOLFSSL_CONFIG="--prefix=$DEPS_PREFIX
--disable-crypttests --disable-examples
--enable-aesccm --enable-aesctr --enable-camellia
--enable-curve25519 --enable-curve448 --enable-des3
--enable-ecccustcurves --enable-ed25519 --enable-ed448
--enable-keygen --enable-md4 --enable-rsapss --enable-sha3
--enable-shake256"
git clone https://github.com/wolfSSL/wolfssl.git $WOLFSSL_DIR &&
cd $WOLFSSL_DIR &&
git checkout -qf $WOLFSSL_REV &&
./autogen.sh &&
./configure C_EXTRA_FLAGS="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG &&
make -j4 >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
}
build_tss2()
{
TSS2_REV=2.4.3
TSS2_PKG=tpm2-tss-$TSS2_REV
TSS2_DIR=$DEPS_BUILD_DIR/$TSS2_PKG
TSS2_SRC=https://github.com/tpm2-software/tpm2-tss/releases/download/$TSS2_REV/$TSS2_PKG.tar.gz
if test -d "$TSS2_DIR"; then
return
fi
echo "$ build_tss2()"
curl -L $TSS2_SRC | tar xz -C $DEPS_BUILD_DIR &&
cd $TSS2_DIR &&
./configure --prefix=$DEPS_PREFIX --disable-doxygen-doc &&
make -j4 >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
}
: ${BUILD_DIR=$PWD}
: ${DEPS_BUILD_DIR=$BUILD_DIR/..}
: ${DEPS_PREFIX=/usr/local}
if [ -e /etc/os-release ]; then
. /etc/os-release
elif [ -e /usr/lib/os-release ]; then
. /usr/lib/os-release
fi
cd $TRAVIS_BUILD_DIR
TARGET=check
DEPS="libgmp-dev"
@ -18,29 +110,56 @@ default)
# should be the default, but lets make sure
CONFIG="--with-printf-hooks=glibc"
;;
openssl)
CONFIG="--disable-defaults --enable-pki --enable-openssl"
openssl*)
CONFIG="--disable-defaults --enable-pki --enable-openssl --enable-pem"
export TESTS_PLUGINS="test-vectors pem openssl!"
DEPS="libssl-dev"
;;
gcrypt)
CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1"
DEPS="libgcrypt11-dev"
export TESTS_PLUGINS="test-vectors pkcs1 gcrypt!"
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
DEPS="libgcrypt20-dev"
else
DEPS="libgcrypt11-dev"
fi
;;
botan)
CONFIG="--disable-defaults --enable-pki --enable-botan --enable-pem"
export TESTS_PLUGINS="test-vectors pem botan!"
DEPS=""
if test "$1" = "build-deps"; then
build_botan
fi
;;
wolfssl)
CONFIG="--disable-defaults --enable-pki --enable-wolfssl --enable-pem"
export TESTS_PLUGINS="test-vectors pem wolfssl!"
# build with custom options to enable all the features the plugin supports
DEPS=""
if test "$1" = "build-deps"; then
build_wolfssl
fi
;;
printf-builtin)
CONFIG="--with-printf-hooks=builtin"
;;
all|coverage)
all|coverage|sonarcloud)
if [ "$TEST" = "sonarcloud" ]; then
if [ -z "$SONAR_PROJECT" -o -z "$SONAR_ORGANIZATION" -o -z "$SONAR_TOKEN" ]; then
echo "The SONAR_PROJECT, SONAR_ORGANIZATION and SONAR_TOKEN" \
"environment variables are required to run this test"
exit 1
fi
fi
CONFIG="--enable-all --disable-android-dns --disable-android-log
--disable-dumm --disable-kernel-pfroute --disable-keychain
--disable-kernel-pfroute --disable-keychain
--disable-lock-profiler --disable-padlock --disable-fuzzing
--disable-osx-attr --disable-tkm --disable-uci
--disable-systemd --disable-soup --disable-unwind-backtraces
--disable-unwind-backtraces
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp"
# Ubuntu 14.04 does provide a too old libtss2-dev
CONFIG="$CONFIG --disable-tss-tss2"
# Ubuntu 14.04 does not provide libnm
CONFIG="$CONFIG --disable-nm"
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp
--disable-python-eggs-install"
# not enabled on the build server
CONFIG="$CONFIG --disable-af-alg"
if test "$TEST" != "coverage"; then
@ -49,11 +168,30 @@ all|coverage)
# not actually required but configure checks for it
DEPS="$DEPS lcov"
fi
# Botan requires newer compilers, so disable it on Ubuntu 16.04
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "16.04" ]; then
CONFIG="$CONFIG --disable-botan"
fi
DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
libpcsclite-dev libpam0g-dev binutils-dev libunwind8-dev
libjson0-dev iptables-dev python-pip libtspi-dev"
PYDEPS="pytest"
libldap2-dev libpcsclite-dev libpam0g-dev binutils-dev libnm-dev
libgcrypt20-dev libjson-c-dev python3-pip libtspi-dev libsystemd-dev"
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
DEPS="$DEPS libiptc-dev"
else
DEPS="$DEPS iptables-dev python3-setuptools"
fi
# tox has dependencies that can't be resolved on 16.04 (even with pip)
if [ "$ID" != "ubuntu" -o "$VERSION_ID" != "16.04" ]; then
PYDEPS="tox"
fi
if test "$1" = "build-deps"; then
if [ "$ID" != "ubuntu" -o "$VERSION_ID" != "16.04" ]; then
build_botan
fi
build_wolfssl
build_tss2
fi
;;
win*)
CONFIG="--disable-defaults --enable-svc --enable-ikev2
@ -61,56 +199,57 @@ win*)
--enable-constraints --enable-revocation --enable-pem --enable-pkcs1
--enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert
--enable-eap-tnc --enable-eap-ttls --enable-eap-identity
--enable-updown --enable-ext-auth --enable-libipsec
--enable-updown --enable-ext-auth --enable-libipsec --enable-pkcs11
--enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
--enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
--enable-pki --enable-swanctl --enable-socket-win"
--enable-pki --enable-swanctl --enable-socket-win
--enable-kernel-iph --enable-kernel-wfp --enable-winhttp"
# no make check for Windows binaries unless we run on a windows host
if test "$APPVEYOR" != "True"; then
TARGET=
else
CONFIG="$CONFIG --enable-openssl"
CFLAGS="$CFLAGS -I/c/OpenSSL-$TEST/include"
LDFLAGS="-L/c/OpenSSL-$TEST"
CFLAGS="$CFLAGS -I$OPENSSL_DIR/include"
LDFLAGS="-L$OPENSSL_DIR"
export LDFLAGS
fi
CFLAGS="$CFLAGS -mno-ms-bitfields"
DEPS="gcc-mingw-w64-base"
case "$TEST" in
win64)
# headers on 12.04 are too old, so we only build the plugins here
CONFIG="--host=x86_64-w64-mingw32 $CONFIG --enable-dbghelp-backtraces
--enable-kernel-iph --enable-kernel-wfp --enable-winhttp"
CONFIG="--host=x86_64-w64-mingw32 $CONFIG --enable-dbghelp-backtraces"
DEPS="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev $DEPS"
CC="x86_64-w64-mingw32-gcc"
# apply patch to MinGW headers
if test "$APPVEYOR" != "True" -a -z "$1"; then
sudo patch -f -p 4 -d /usr/share/mingw-w64/include < src/libcharon/plugins/kernel_wfp/mingw-w64-4.8.1.diff
fi
;;
win32)
CONFIG="--host=i686-w64-mingw32 $CONFIG"
# currently only works on 12.04, so use mingw-w64-dev instead of mingw-w64-i686-dev
DEPS="gcc-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-dev $DEPS"
DEPS="gcc-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-i686-dev $DEPS"
CC="i686-w64-mingw32-gcc"
;;
esac
;;
osx)
android)
if test "$1" = "deps"; then
git clone git://git.strongswan.org/android-ndk-boringssl.git -b ndk-static \
src/frontends/android/app/src/main/jni/openssl
fi
TARGET=distdir
;;
macos)
# this causes a false positive in ip-packet.c since Xcode 8.3
CFLAGS="$CFLAGS -Wno-address-of-packed-member"
# use the same options as in the Homebrew Formula
CONFIG="--disable-defaults --enable-charon --enable-cmd --enable-constraints
--enable-curl --enable-eap-gtc --enable-eap-identity
--enable-eap-md5 --enable-eap-mschapv2 --enable-ikev1 --enable-ikev2
--enable-kernel-libipsec --enable-kernel-pfkey
--enable-eap-md5 --enable-eap-mschapv2 --enable-farp --enable-ikev1
--enable-ikev2 --enable-kernel-libipsec --enable-kernel-pfkey
--enable-kernel-pfroute --enable-nonce --enable-openssl
--enable-osx-attr --enable-pem --enable-pgp --enable-pkcs1
--enable-pkcs8 --enable-pki --enable-pubkey --enable-revocation
--enable-scepclient --enable-socket-default --enable-sshkey
--enable-stroke --enable-swanctl --enable-unity --enable-updown
--enable-x509 --enable-xauth-generic"
DEPS="bison gettext openssl curl"
DEPS="automake autoconf libtool bison gettext openssl curl"
BREW_PREFIX=$(brew --prefix)
export PATH=$BREW_PREFIX/opt/bison/bin:$PATH
export ACLOCAL_PATH=$BREW_PREFIX/opt/gettext/share/aclocal:$ACLOCAL_PATH
@ -124,6 +263,27 @@ osx)
export CPPFLAGS
export LDFLAGS
;;
freebsd)
# use the options of the FreeBSD port (including options), except smp,
# which requires a patch but is deprecated anyway, only using the builtin
# printf hooks
CONFIG="--enable-kernel-pfkey --enable-kernel-pfroute --disable-scripts
--disable-kernel-netlink --enable-openssl --enable-eap-identity
--enable-eap-md5 --enable-eap-tls --enable-eap-mschapv2
--enable-eap-peap --enable-eap-ttls --enable-md4 --enable-blowfish
--enable-addrblock --enable-whitelist --enable-cmd --enable-curl
--enable-eap-aka --enable-eap-aka-3gpp2 --enable-eap-dynamic
--enable-eap-radius --enable-eap-sim --enable-eap-sim-file
--enable-gcm --enable-ipseckey --enable-kernel-libipsec
--enable-load-tester --enable-ldap --enable-mediation
--enable-mysql --enable-sqlite --enable-tpm --enable-tss-tss2
--enable-unbound --enable-unity --enable-xauth-eap --enable-xauth-pam
--with-printf-hooks=builtin --enable-attr-sql --enable-sql
--enable-farp"
DEPS="git gmp openldap-client libxml2 mysql80-client sqlite3 unbound ldns tpm2-tss"
export GPERF=/usr/local/bin/gperf
export LEX=/usr/local/bin/flex
;;
fuzzing)
CFLAGS="$CFLAGS -DNO_CHECK_MEMWIPE"
CONFIG="--enable-fuzzing --enable-static --disable-shared --disable-scripts
@ -134,7 +294,7 @@ fuzzing)
if test -z "$1"; then
if test -z "$FUZZING_CORPORA"; then
git clone --depth 1 https://github.com/strongswan/fuzzing-corpora.git fuzzing-corpora
export FUZZING_CORPORA=$TRAVIS_BUILD_DIR/fuzzing-corpora
export FUZZING_CORPORA=$BUILD_DIR/fuzzing-corpora
fi
# these are about the same as those on OSS-Fuzz (except for the
# symbolize options and strip_path_prefix)
@ -146,6 +306,17 @@ fuzzing)
symbolize=1:handle_segv=1:fast_unwind_on_fatal=0:external_symbolizer_path=/usr/bin/llvm-symbolizer-3.5
fi
;;
nm|nm-no-glib)
DEPS="gnome-common libsecret-1-dev libgtk-3-dev libnm-dev libnma-dev"
if test "$TEST" = "nm"; then
DEPS="$DEPS libnm-glib-vpn-dev libnm-gtk-dev"
else
CONFIG="$CONFIG --without-libnm-glib"
fi
cd src/frontends/gnome
# don't run ./configure with ./autogen.sh
export NOCONFIGURE=1
;;
dist)
TARGET=distcheck
;;
@ -154,32 +325,102 @@ apidoc)
CONFIG="--disable-defaults"
TARGET=apidoc
;;
lgtm)
if [ -z "$LGTM_PROJECT" -o -z "$LGTM_TOKEN" ]; then
echo "The LGTM_PROJECT and LGTM_TOKEN environment variables" \
"are required to run this test"
exit 0
fi
DEPS="jq"
if test -z "$1"; then
base=$COMMIT_BASE
# after rebases or for new/duplicate branches, the passed base commit
# ID might not be valid
git rev-parse -q --verify $base^{commit}
if [ $? != 0 ]; then
# this will always compare against master, while via base we
# otherwise only contains "new" commits
base=$(git merge-base origin/master ${COMMIT_ID})
fi
base=$(git rev-parse $base)
echo "Starting code review for $COMMIT_ID (base $base) on lgtm.com"
git diff --binary $base > lgtm.patch || exit $?
curl -s -X POST --data-binary @lgtm.patch \
"https://lgtm.com/api/v1.0/codereviews/${LGTM_PROJECT}?base=${base}&external-id=${BUILD_NUMBER}" \
-H 'Content-Type: application/octet-stream' \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res || exit $?
lgtm_check_url=$(jq -r '."task-result-url"' lgtm.res)
if [ -z "$lgtm_check_url" -o "$lgtm_check_url" = "null" ]; then
cat lgtm.res
exit 1
fi
lgtm_url=$(jq -r '."task-result"."results-url"' lgtm.res)
echo "Progress and full results: ${lgtm_url}"
echo -n "Waiting for completion: "
lgtm_status=pending
while [ "$lgtm_status" = "pending" ]; do
sleep 15
curl -s -X GET "${lgtm_check_url}" \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res
if [ $? != 0 ]; then
echo -n "-"
continue
fi
echo -n "."
lgtm_status=$(jq -r '.status' lgtm.res)
done
echo ""
if [ "$lgtm_status" != "success" ]; then
lgtm_message=$(jq -r '.["status-message"]' lgtm.res)
echo "Code review failed: ${lgtm_message}"
exit 1
fi
lgtm_new=$(jq -r '.languages[].new' lgtm.res | awk '{t+=$1} END {print t}')
lgtm_fixed=$(jq -r '.languages[].fixed' lgtm.res | awk '{t+=$1} END {print t}')
echo -n "Code review complete: "
printf "%b\n" "\e[1;31m${lgtm_new}\e[0m new alerts, \e[1;32m${lgtm_fixed}\e[0m fixed"
exit $lgtm_new
fi
;;
*)
echo "$0: unknown test $TEST" >&2
exit 1
;;
esac
if test "$1" = "deps"; then
case "$TRAVIS_OS_NAME" in
case "$1" in
deps)
case "$OS_NAME" in
linux)
sudo apt-get update -qq && \
sudo apt-get install -qq bison flex gperf gettext $DEPS
;;
osx)
macos)
brew update && \
# workaround for issue #6352
brew uninstall --force libtool && brew install libtool && \
brew install $DEPS
;;
freebsd)
pkg install -y automake autoconf libtool pkgconf && \
pkg install -y bison flex gperf gettext $DEPS
;;
esac
exit $?
fi
if test "$1" = "pydeps"; then
test -z "$PYDEPS" || sudo pip -q install $PYDEPS
;;
pydeps)
test -z "$PYDEPS" || pip3 -q install --user $PYDEPS
exit $?
fi
;;
build-deps)
exit
;;
*)
;;
esac
CONFIG="$CONFIG
--disable-dependency-tracking
@ -202,7 +443,16 @@ apidoc)
esac
echo "$ make $TARGET"
make -j4 $TARGET || exit $?
case "$TEST" in
sonarcloud)
# without target, coverage is currently not supported anyway because
# sonarqube only supports gcov, not lcov
build-wrapper-linux-x86-64 --out-dir bw-output make -j4 || exit $?
;;
*)
make -j4 $TARGET || exit $?
;;
esac
case "$TEST" in
apidoc)
@ -210,7 +460,36 @@ apidoc)
cat make.warnings
exit 1
fi
rm make.warnings
;;
sonarcloud)
sonar-scanner \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectKey=${SONAR_PROJECT} \
-Dsonar.organization=${SONAR_ORGANIZATION} \
-Dsonar.login=${SONAR_TOKEN} \
-Dsonar.projectVersion=$(git describe)+${BUILD_NUMBER} \
-Dsonar.sources=. \
-Dsonar.cfamily.threads=2 \
-Dsonar.cfamily.cache.enabled=true \
-Dsonar.cfamily.cache.path=$HOME/.sonar-cache \
-Dsonar.cfamily.build-wrapper-output=bw-output || exit $?
rm -r bw-output .scannerwork
;;
android)
rm -r strongswan-*
cd src/frontends/android
echo "$ ./gradlew build"
NDK_CCACHE=ccache ./gradlew build || exit $?
;;
*)
;;
esac
# ensure there are no unignored build artifacts (or other changes) in the Git repo
unclean="$(git status --porcelain)"
if test -n "$unclean"; then
echo "Unignored build artifacts or other changes:"
echo "$unclean"
exit 1
fi

View File

@ -260,8 +260,6 @@ int main(int argc, char *argv[])
printf(" <p>\n");
printf(" <hr/>\n");
printf(" <em>&copy; 2008\n");
printf(" <a href=\"http://ita.hsr.ch?&L=1\" target=\"popup\">\n");
printf(" ITA Institute for Internet Technologies and Applications</a> -\n");
printf(" <a href=\"http://www.hsr.ch/?&L=1\" target=\"popup\">\n");
printf(" HSR Hochschule f&uuml;r Technik Rapperswil</a>\n");
printf(" </em>\n");

View File

@ -1,4 +1,8 @@
/*
* Copyright (C) 2020 Pascal Knecht
* Copyright (C) 2020 Tobias Brunner
* HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
@ -33,8 +37,28 @@
static void usage(FILE *out, char *cmd)
{
fprintf(out, "usage:\n");
fprintf(out, " %s --connect <address> --port <port> [--key <key] [--cert <file>]+ [--times <n>]\n", cmd);
fprintf(out, " %s --listen <address> --port <port> --key <key> [--cert <file>]+ [--times <n>]\n", cmd);
fprintf(out, " %s --connect <address> --port <port> [--key <key] [--cert <file>] [--cacert <file>]+ [--times <n>]\n", cmd);
fprintf(out, " %s --listen <address> --port <port> --key <key> --cert <file> [--cacert <file>]+ [--auth-optional] [--times <n>]\n", cmd);
fprintf(out, "\n");
fprintf(out, "options:\n");
fprintf(out, " --help print help and exit\n");
fprintf(out, " --connect <address> connect to a server on dns name or ip address\n");
fprintf(out, " --listen <address> listen on dns name or ip address\n");
fprintf(out, " --port <port> specify the port to use\n");
fprintf(out, " --cert <file> certificate to authenticate itself\n");
fprintf(out, " --key <file> private key to authenticate itself\n");
fprintf(out, " --cacert <file> certificate to verify other peer\n");
fprintf(out, " --auth-optional don't enforce client authentication\n");
fprintf(out, " --times <n> specify the amount of repeated connection establishments\n");
fprintf(out, " --ipv4 use IPv4\n");
fprintf(out, " --ipv6 use IPv6\n");
fprintf(out, " --min-version <version> specify the minimum TLS version, supported versions:\n");
fprintf(out, " 1.0 (default), 1.1, 1.2 and 1.3\n");
fprintf(out, " --max-version <version> specify the maximum TLS version, supported versions:\n");
fprintf(out, " 1.0, 1.1, 1.2 and 1.3 (default)\n");
fprintf(out, " --version <version> set one specific TLS version to use, supported versions:\n");
fprintf(out, " 1.0, 1.1, 1.2 and 1.3\n");
fprintf(out, " --debug <debug level> set debug level, default is 1\n");
}
/**
@ -85,14 +109,17 @@ static identification_t *find_client_id()
* Client routine
*/
static int run_client(host_t *host, identification_t *server,
identification_t *client, int times, tls_cache_t *cache)
identification_t *client, int times, tls_cache_t *cache,
tls_version_t min_version, tls_version_t max_version,
tls_flag_t flags)
{
tls_socket_t *tls;
int fd, res;
while (times == -1 || times-- > 0)
{
fd = socket(AF_INET, SOCK_STREAM, 0);
DBG2(DBG_TLS, "connecting to %#H", host);
fd = socket(host->get_family(host), SOCK_STREAM, 0);
if (fd == -1)
{
DBG1(DBG_TLS, "opening socket failed: %s", strerror(errno));
@ -105,7 +132,8 @@ static int run_client(host_t *host, identification_t *server,
close(fd);
return 1;
}
tls = tls_socket_create(FALSE, server, client, fd, cache, TLS_1_2, TRUE);
tls = tls_socket_create(FALSE, server, client, fd, cache, min_version,
max_version, flags);
if (!tls)
{
close(fd);
@ -125,8 +153,9 @@ static int run_client(host_t *host, identification_t *server,
/**
* Server routine
*/
static int serve(host_t *host, identification_t *server,
int times, tls_cache_t *cache)
static int serve(host_t *host, identification_t *server, identification_t *client,
int times, tls_cache_t *cache, tls_version_t min_version,
tls_version_t max_version, tls_flag_t flags)
{
tls_socket_t *tls;
int fd, cfd;
@ -162,7 +191,8 @@ static int serve(host_t *host, identification_t *server,
}
DBG1(DBG_TLS, "%#H connected", host);
tls = tls_socket_create(TRUE, server, NULL, cfd, cache, TLS_1_2, TRUE);
tls = tls_socket_create(TRUE, server, client, cfd, cache, min_version,
max_version, flags);
if (!tls)
{
close(fd);
@ -207,8 +237,8 @@ static bool load_key(char *filename)
{
private_key_t *key;
key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
BUILD_FROM_FILE, filename, BUILD_END);
key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
BUILD_FROM_FILE, filename, BUILD_END);
if (!key)
{
DBG1(DBG_TLS, "loading key from '%s' failed", filename);
@ -251,11 +281,14 @@ static void cleanup()
*/
static void init()
{
char *plugins;
library_init(NULL, "tls_test");
dbg = dbg_tls;
lib->plugins->load(lib->plugins, PLUGINS);
plugins = getenv("PLUGINS") ?: PLUGINS;
lib->plugins->load(lib->plugins, plugins);
creds = mem_cred_create();
lib->credmgr->add_set(lib->credmgr, &creds->set);
@ -267,8 +300,10 @@ int main(int argc, char *argv[])
{
char *address = NULL;
bool listen = FALSE;
int port = 0, times = -1, res;
identification_t *server, *client;
int port = 0, times = -1, res, family = AF_UNSPEC;
identification_t *server, *client = NULL;
tls_version_t min_version = TLS_SUPPORTED_MIN, max_version = TLS_SUPPORTED_MAX;
tls_flag_t flags = TLS_FLAG_ENCRYPTION_OPTIONAL;
tls_cache_t *cache;
host_t *host;
@ -277,14 +312,21 @@ int main(int argc, char *argv[])
while (TRUE)
{
struct option long_opts[] = {
{"help", no_argument, NULL, 'h' },
{"connect", required_argument, NULL, 'c' },
{"listen", required_argument, NULL, 'l' },
{"port", required_argument, NULL, 'p' },
{"cert", required_argument, NULL, 'x' },
{"key", required_argument, NULL, 'k' },
{"times", required_argument, NULL, 't' },
{"debug", required_argument, NULL, 'd' },
{"help", no_argument, NULL, 'h' },
{"connect", required_argument, NULL, 'c' },
{"listen", required_argument, NULL, 'l' },
{"port", required_argument, NULL, 'p' },
{"cert", required_argument, NULL, 'x' },
{"key", required_argument, NULL, 'k' },
{"cacert", required_argument, NULL, 'f' },
{"times", required_argument, NULL, 't' },
{"ipv4", no_argument, NULL, '4' },
{"ipv6", no_argument, NULL, '6' },
{"min-version", required_argument, NULL, 'm' },
{"max-version", required_argument, NULL, 'M' },
{"version", required_argument, NULL, 'v' },
{"auth-optional", no_argument, NULL, 'n' },
{"debug", required_argument, NULL, 'd' },
{0,0,0,0 }
};
switch (getopt_long(argc, argv, "", long_opts, NULL))
@ -306,6 +348,13 @@ int main(int argc, char *argv[])
return 1;
}
continue;
case 'f':
if (!load_certificate(optarg))
{
return 1;
}
client = identification_create_from_encoding(ID_ANY, chunk_empty);
continue;
case 'l':
listen = TRUE;
/* fall */
@ -326,6 +375,40 @@ int main(int argc, char *argv[])
case 'd':
tls_level = atoi(optarg);
continue;
case '4':
family = AF_INET;
continue;
case '6':
family = AF_INET6;
continue;
case 'm':
if (!enum_from_name(tls_numeric_version_names, optarg,
&min_version))
{
fprintf(stderr, "unknown minimum TLS version: %s\n", optarg);
return 1;
}
continue;
case 'M':
if (!enum_from_name(tls_numeric_version_names, optarg,
&max_version))
{
fprintf(stderr, "unknown maximum TLS version: %s\n", optarg);
return 1;
}
continue;
case 'v':
if (!enum_from_name(tls_numeric_version_names, optarg,
&min_version))
{
fprintf(stderr, "unknown TLS version: %s\n", optarg);
return 1;
}
max_version = min_version;
continue;
case 'n':
flags |= TLS_FLAG_CLIENT_AUTH_OPTIONAL;
continue;
default:
usage(stderr, argv[0]);
return 1;
@ -337,7 +420,7 @@ int main(int argc, char *argv[])
usage(stderr, argv[0]);
return 1;
}
host = host_create_from_dns(address, 0, port);
host = host_create_from_dns(address, family, port);
if (!host)
{
DBG1(DBG_TLS, "resolving hostname %s failed", address);
@ -347,12 +430,15 @@ int main(int argc, char *argv[])
cache = tls_cache_create(100, 30);
if (listen)
{
res = serve(host, server, times, cache);
res = serve(host, server, client, times, cache, min_version,
max_version, flags);
}
else
{
DESTROY_IF(client);
client = find_client_id();
res = run_client(host, server, client, times, cache);
res = run_client(host, server, client, times, cache, min_version,
max_version, flags);
DESTROY_IF(client);
}
cache->destroy(cache);

42
sonar-project.properties Normal file
View File

@ -0,0 +1,42 @@
# exclude these files completely
sonar.exclusions=\
src/manager/templates/static/jquery.js, \
src/include/linux/**, \
src/frontends/**, \
**/data.sql, \
**/test.sql, \
**/tables.sql, \
**/ipsec.sql
# don't report duplications in these files
sonar.cpd.exclusions=\
src/libstrongswan/crypto/proposal/proposal_keywords_static.c, \
src/libstrongswan/settings/settings_parser.*, \
src/libstrongswan/settings/settings_lexer.c, \
src/starter/keywords.c, \
src/starter/parser/parser.*, \
src/starter/parser/lexer.c, \
src/stroke/stroke_keywords.c, \
**/suites/test_*.c, \
**/data.sql
# the following settings are officially only available via UI
# ignore issues in these generated files
sonar.issue.ignore.allfile=a1,a2,a3
sonar.issue.ignore.allfile.a1.fileRegexp=generated by flex
sonar.issue.ignore.allfile.a2.fileRegexp=made by GNU Bison
sonar.issue.ignore.allfile.a3.fileRegexp=produced by gperf
# ignore some rules
sonar.issue.ignore.multicriteria=m1,m2,m3,m4,m5
sonar.issue.ignore.multicriteria.m1.ruleKey=c:SingleDeclarationPerStatement
sonar.issue.ignore.multicriteria.m1.resourceKey=**/*
sonar.issue.ignore.multicriteria.m2.ruleKey=c:FunctionEllipsis
sonar.issue.ignore.multicriteria.m2.resourceKey=**/*
sonar.issue.ignore.multicriteria.m3.ruleKey=c:S936
sonar.issue.ignore.multicriteria.m3.resourceKey=**/*
sonar.issue.ignore.multicriteria.m4.ruleKey=c:S1172
sonar.issue.ignore.multicriteria.m4.resourceKey=**/*
sonar.issue.ignore.multicriteria.m5.ruleKey=plsql:SingleLineCommentsSyntaxCheck
sonar.issue.ignore.multicriteria.m5.resourceKey=**/*

View File

@ -42,6 +42,9 @@ endif
if USE_LIBCHARON
SUBDIRS += libcharon
if USE_KERNEL_NETLINK
SUBDIRS += xfrmi
endif
endif
if USE_FILE_CONFIG
@ -88,10 +91,6 @@ if USE_CONFTEST
SUBDIRS += conftest
endif
if USE_DUMM
SUBDIRS += dumm
endif
if USE_FAST
SUBDIRS += libfast
endif

View File

@ -58,14 +58,14 @@ static const char *copyright[] = {
NULL,
};
char usage[] = "Usage: ipsec _copyright";
struct option opts[] = {
static const char usage[] = "Usage: ipsec _copyright";
static const struct option opts[] = {
{"help", 0, NULL, 'h',},
{"version", 0, NULL, 'v',},
{0, 0, NULL, 0, },
};
char me[] = "ipsec _copyright"; /* for messages */
static const char me[] = "ipsec _copyright"; /* for messages */
int
main(int argc, char *argv[])
@ -84,11 +84,9 @@ main(int argc, char *argv[])
case 'h': /* help */
printf("%s\n", usage);
exit(0);
break;
case 'v': /* version */
printf("%s strongSwan "VERSION"\n", me);
exit(0);
break;
case '?':
default:
errflg = 1;

View File

@ -43,7 +43,7 @@
# is the name of the ipsec interface to be used.
#
# PLUTO_REQID
# is the requid of the AH|ESP policy
# is the reqid of the AH|ESP policy
#
# PLUTO_PROTO
# is the negotiated IPsec protocol, ah|esp
@ -119,6 +119,12 @@
# PLUTO_MARK_OUT
# is an optional XFRM mark set on the outbound IPsec SA
#
# PLUTO_IF_ID_IN
# is an optional XFRM interface ID set on the inbound IPsec SA
#
# PLUTO_IF_ID_OUT
# is an optional XFRM interface ID set on the outbound IPsec SA
#
# PLUTO_UDP_ENC
# contains the remote UDP port in the case of ESP_IN_UDP
# encapsulation

View File

@ -134,14 +134,10 @@ static int run()
break;
}
case SIGINT:
{
DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down");
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
return 0;
}
case SIGTERM:
{
DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down");
DBG1(DBG_DMN, "%s received, shutting down",
sig == SIGINT ? "SIGINT" : "SIGTERM");
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
return 0;
}
@ -174,6 +170,7 @@ static bool lookup_uid_gid()
return TRUE;
}
#ifndef DISABLE_SIGNAL_HANDLER
/**
* Handle SIGSEGV/SIGILL signals raised by threads
*/
@ -189,6 +186,7 @@ static void segv_handler(int signal)
DBG1(DBG_DMN, "killing ourself, received critical signal");
abort();
}
#endif /* DISABLE_SIGNAL_HANDLER */
/**
* Print command line usage and exit
@ -348,6 +346,9 @@ int main(int argc, char *argv[])
{
exit(SS_RC_INITIALIZATION_FAILED);
}
/* register this again after loading plugins to avoid issues with libraries
* that register atexit() handlers */
atexit(libcharon_deinit);
if (!lib->caps->drop(lib->caps))
{
exit(SS_RC_INITIALIZATION_FAILED);
@ -358,9 +359,6 @@ int main(int argc, char *argv[])
creds = cmd_creds_create();
atexit(cleanup_creds);
/* handle all arguments */
handle_arguments(argc, argv, FALSE);
if (uname(&utsname) != 0)
{
memset(&utsname, 0, sizeof(utsname));
@ -369,18 +367,26 @@ int main(int argc, char *argv[])
VERSION, utsname.sysname, utsname.release, utsname.machine);
lib->plugins->status(lib->plugins, LEVEL_CTRL);
/* add handler for SEGV and ILL,
* INT, TERM and HUP are handled by sigwaitinfo() in run() */
action.sa_handler = segv_handler;
/* handle all arguments */
handle_arguments(argc, argv, FALSE);
/* add handler for fatal signals,
* INT, TERM, HUP and USR1 are handled by sigwaitinfo() in run() */
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGINT);
sigaddset(&action.sa_mask, SIGTERM);
sigaddset(&action.sa_mask, SIGHUP);
sigaddset(&action.sa_mask, SIGUSR1);
/* optionally let the external system handle fatal signals */
#ifndef DISABLE_SIGNAL_HANDLER
action.sa_handler = segv_handler;
sigaction(SIGSEGV, &action, NULL);
sigaction(SIGILL, &action, NULL);
sigaction(SIGBUS, &action, NULL);
#endif /* DISABLE_SIGNAL_HANDLER */
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);

View File

@ -142,9 +142,13 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
{
ike_cfg_t *ike_cfg;
peer_cfg_t *peer_cfg;
uint16_t local_port, remote_port = IKEV2_UDP_PORT;
ike_version_t version = IKE_ANY;
proposal_t *proposal;
ike_cfg_create_t ike = {
.local = "0.0.0.0",
.remote = this->host,
.remote_port = IKEV2_UDP_PORT,
.fragmentation = FRAGMENTATION_YES,
};
peer_cfg_create_t peer = {
.cert_policy = CERT_SEND_IF_ASKED,
.unique = UNIQUE_REPLACE,
@ -161,7 +165,7 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
case PROF_V2_PUB:
case PROF_V2_EAP:
case PROF_V2_PUB_EAP:
version = IKEV2;
ike.version = IKEV2;
break;
case PROF_V1_PUB_AM:
case PROF_V1_XAUTH_AM:
@ -173,17 +177,16 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
case PROF_V1_XAUTH:
case PROF_V1_XAUTH_PSK:
case PROF_V1_HYBRID:
version = IKEV1;
ike.version = IKEV1;
break;
}
local_port = charon->socket->get_port(charon->socket, FALSE);
if (local_port != IKEV2_UDP_PORT)
ike.local_port = charon->socket->get_port(charon->socket, FALSE);
if (ike.local_port != IKEV2_UDP_PORT)
{
remote_port = IKEV2_NATT_PORT;
ike.remote_port = IKEV2_NATT_PORT;
}
ike_cfg = ike_cfg_create(version, TRUE, FALSE, "0.0.0.0", local_port,
this->host, remote_port, FRAGMENTATION_NO, 0);
ike_cfg = ike_cfg_create(&ike);
if (this->ike_proposals->get_count(this->ike_proposals))
{
while (this->ike_proposals->remove_first(this->ike_proposals,
@ -359,9 +362,8 @@ static child_cfg_t* create_child_cfg(private_cmd_connection_t *this,
}
else
{
child_cfg->add_proposal(child_cfg, proposal_create_default_aead(PROTO_ESP));
child_cfg->add_proposal(child_cfg, proposal_create_default(PROTO_ESP));
child_cfg->add_proposal(child_cfg,
proposal_create_default_aead(PROTO_ESP));
}
while (this->local_ts->remove_first(this->local_ts, (void**)&ts) == SUCCESS)
{

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