Commit Graph

360 Commits

Author SHA1 Message Date
Andreas Steffen a09a905e1d vici: Suppress trailing nul character 2021-07-06 12:06:23 +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
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 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 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 d79cefc3fc vici: Expose ike-update event 2021-01-18 11:34:40 +01:00
Tobias Brunner a6f0e19bf5 Fixed some typos, courtesy of codespell 2020-11-04 10:06:46 +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 6839256773 vici: Support all defined key types
References #3586.
2020-10-27 11:17:21 +01: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 61af9a3478 vici: Fix typos in comments 2020-07-23 14:50:17 +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 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 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 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
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
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
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 f78dfb7e28 vici: Options are optional in get_pools() of Python bindings
Fixes #3319.
2020-02-03 10:52:31 +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 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 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 ae9b748a77 vici: Log certificate constraints for loaded configs 2019-12-06 10:07:47 +01:00
Martin Willi 3c71a3201f vici: Introduce a ca_id option identity based CA certificate constraints 2019-12-06 10:07:46 +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
Tobias Brunner ad14f3a60d vici: Remove obsolete certificate registration for hash-and-URL 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
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
Andreas Steffen c738704ab6 vici: List drbgs in get_algorithms 2019-10-16 16:46:24 +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 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 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 02b348403a Fixed some typos, courtesy of codespell 2019-04-29 15:09:20 +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 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