Skip to main content

Native Python interface for strongSwan's VICI protocol

Project description

About

The strongSwan VICI protocol allows external applications to monitor, configure and control the IKE daemon charon. This Python package provides a native client side implementation of the VICI protocol, well suited to script automated tasks in a reliable way.

Basic Usage

>>> import vici
>>> s = vici.Session()
>>> s.version()
OrderedDict([('daemon', b'charon'), ('version', b'5.4.0'),
('sysname', b'Linux'), ('release', b'3.13.0-27-generic'), ('machine', b'x86_64')])
>>> s.load_pool({"p1": {"addrs": "10.0.0.0/24"}})
OrderedDict([('success', b'yes')])
>>> s.get_pools()
OrderedDict([('p1', OrderedDict([('base', b'10.0.0.0'), ('size', b'254'),
('online', b'0'), ('offline', b'0')]))])

Event Handling

Either use the convenient decorators provided by EventListener or directly call listen() on a Session object to loop over received events and dispatch them manually.

>>> import vici
>>> s = vici.Session()
>>> l = vici.EventListener(s)
>>> @l.on_events(['ike-updown', 'ike-rekey'])
... def ike_events(name, data):
...   """Handle event with given 'name' and 'data'."""
...   print(name, data)
...
>>> @l.on_events(['child-updown', 'child-rekey'])
... def child_events(name, data):
...   print(name, data)
...
>>> l.listen()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vici-6.0.3.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vici-6.0.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file vici-6.0.3.tar.gz.

File metadata

  • Download URL: vici-6.0.3.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for vici-6.0.3.tar.gz
Algorithm Hash digest
SHA256 ec926e7a29b6ea9112fe406d1851c3c46143ac625e28089e3d4efce4eac88e56
MD5 6c2cadfccf1d257e79c4aa3e00674359
BLAKE2b-256 578388b626e3f62dc986cd7ce2fa9fb37d9b3259fbc7a3864a51b98e5c516ec7

See more details on using hashes here.

File details

Details for the file vici-6.0.3-py3-none-any.whl.

File metadata

  • Download URL: vici-6.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for vici-6.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 734f52b57e329fbd58f3bffd1305d6546be174aeb35bc4a2ef45c257e95ad924
MD5 58ecf75598ad4b46cfb07f0ad7b5ac43
BLAKE2b-256 e889241f45ca169e43bc0104a3696f020c11eebcb195c2c9631b798c026de469

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page