Commit Graph

17819 Commits

Author SHA1 Message Date
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