Skip to main content

Airlock Gateway Configuration Script Engine

Project description

GitHub PyPI
GitHub PyPI

AirScript

AirScript is your scriptable Python interface to the Airlock Gateway configuration REST API, providing access to configuration objects, virtual hosts, mappings etc.

AirScript can be used interactively using its console which allows you to easily and quickly inspect and adjust an Airlock Gateway configuration using the REST API. It can also be used for more complex operations for which a script has previously been created, e.g. migrating an applications configuration from a test to a production environment.

Airlock Gateway is a web application firewall (WAF) and protects mission-critical, web-based applications and APIs from attacks and undesired visitors. As a central security instance, it examines every HTTP(S) request for attacks and thus blocks any attempt at data theft and manipulation.

Getting started

Installation

pip install pyAirscript

Documentation

The documentation has not yet been created and is forthcoming.

Setup

First, you need to create a config file with connection parameters for your Airlock Gateways. You can use samples/config.yaml as a template.

The API keys can be retrieved via Airlock Config Center - System Setup - System Admin.

The default location for the config file is "~/.airscript/config.yaml". Otherwise, you can specify its location on the command line:

airscript --config <path to config file>

Usage

usage: airscript.py [-h] [-c CONFIGFILE] [-i INIT] [-v] [-l LOGLEVEL] [-L LOGFILE] [-V] [path ...]

AirScript - the Airlock Gateay Configuration Script

positional arguments:
  path                  script to execute and its parameters

options:
  -h, --help            show this help message and exit
  -c CONFIGFILE, --config CONFIGFILE
                        path to config file (default: ~/.airscript/config.yaml)
  -i INIT, --init INIT  path to initialisation script(s), can be specified multiple times (default, in order: /etc/airscript/init.air, ~/.airscript.rc
  -v, --verbose         verbose output
  -l LOGLEVEL, --loglevel LOGLEVEL
                        log level, bitmask of fatal (1), critical (2), error (4), warning (8), info (16), verbose (32), trace (64), debug (128) (default: 31)
  -L LOGFILE, --logfile LOGFILE
                        log destination: stdout, stderr, or <filename> (default: None)
  -V, --version         get version information

Example sessions

Mapping: activate maintenance mode

Welcome to AirScript - the Airlock Gateay Configuration Script - Version 6
Loading gateway definitions
Connecting to 'test'
Fetching active config
Preloaded:
- gw: gateway 'test'
- c: current active config
AirScript is ready
>>> m=c.mappings(name='apollo')
>>> m
{74: {'id': 74, 'name': 'apollo', 'path': '/apollo/', 'labels': ['Sharepoint_2016', 'Sharepoint', 'Kerberos', 'Prod', 'Derived']}}
>>> print(m[74].attrs['enableMaintenancePage'])
False
>>> m[74].attrs['enableMaintenancePage']=True
>>> c.sync()
>>> c.activate( comment="Apollo: maintenance page activated" )

Virtual host: change IP

Welcome to AirScript - the Airlock Gateay Configuration Script - Version 6
Loading gateway definitions
Connecting to 'test'
Fetching active config
Preloaded:
- gw: gateway 'test'
- c: current active config
AirScript is ready
>>> c
{'id': '68', 'comment': 'example app', 'type': 'CURRENTLY_ACTIVE'}
>>> c.vhosts()
{'66': {'id': '66', 'name': 'example.com:8500 (docker registry)', 'ipv4': '10.1.7.3/24'}, '7': {'id': '7', 'name': "test.example.com:443", 'ipv4': '10.1.7.34/24'}}
>>> vh=c.vhosts('7')
>>> pp(vh)
{'7': {'id': '7', 'name': "cuenca.zuska.marmira.com:443 (Let's Encrypt)", 'ipv4': '10.89.7.29/24'}}
>>> pp(vh['7'].attrs)
{'aliasNames': [],
 'defaultRedirect': '/',
 'downloadPdfsAsAttachmentsEnforced': False,
 'encodedSlashesAllowed': False,
 'expertSettings': {'apache': {'enabled': False, 'settings': ''},
                    'securityGate': {'enabled': False, 'settings': ''}},
 'hostName': 'cuenca.zuska.marmira.com',
 'keepAliveTimeout': 10,
 'name': "cuenca.zuska.marmira.com:443 (Let's Encrypt)",
 'networkInterface': {'externalLogicalInterfaceName': 'EXT0',
                      'http': {'enabled': True,
                               'httpsRedirectEnforced': False,
                               'port': 80},
                      'https': {'enabled': True,
                                'http2Allowed': False,
                                'port': 443},
                      'ipV4Address': '10.89.7.29/24',
                      'ipV6Address': ''},
 'pathRedirects': [],
 'serverAdmin': '',
 'session': {'cookieDomain': '', 'cookiePath': '/'},
 'showMaintenancePage': False,
 'tenant': '',
 'tls': {'caCertificatesForChainAndOcspValidation': [],
         'caCertificatesForClientCertificateSelection': [],
         'chainVerificationDepth': 1,
         'cipherSuite': 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256',     
         'cipherSuiteMode': 'DEFAULT',
         'clientCertificateAuthentication': 'NOT_REQUIRED',
         'letsEncryptEnabled': False,
         'ocspStaplingEnabled': False,
         'ocspValidationEnforced': False,
         'protocol': 'all -SSLv3 -TLSv1 -TLSv1.1',
         'protocolMode': 'DEFAULT'}}
>>> vh['7'].set( 'networkInterface.ipV4Address', '10.1.8.12/24' )
>>> c.sync()
>>> c.save( comment="Changed test.example.com IP address" )

This creates a new but yet inactive configuration. It can be manually activated in the Airlock Config Center.

Getting support

AirScript is not part of the official Airlock product delivery. Airlock support will be unable to accept or answer tickets.

If you encounter an error, the author welcomes pull requests with fixes. Alternatively, an issue may be created on the GitHub issue tracker. Please note that there is no guaranteed response time and any support is best effort.

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

pyairscript-0.3.1.tar.gz (78.6 kB view details)

Uploaded Source

Built Distribution

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

pyAirscript-0.3.1-py3-none-any.whl (125.9 kB view details)

Uploaded Python 3

File details

Details for the file pyairscript-0.3.1.tar.gz.

File metadata

  • Download URL: pyairscript-0.3.1.tar.gz
  • Upload date:
  • Size: 78.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for pyairscript-0.3.1.tar.gz
Algorithm Hash digest
SHA256 26217858aad53211c427e1da33798e03ab56f15eba25d6490640771e2ee1b4b3
MD5 302dc28839603821c4a92e23ff510b73
BLAKE2b-256 ee90614656957e3698a3f2680e1bab94389563f9f3c10df2292e393e97b42a5a

See more details on using hashes here.

File details

Details for the file pyAirscript-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pyAirscript-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 125.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for pyAirscript-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8eff14e666845ece07c89b68706d92c1e37a656d6bfd7e47c6fafbcf68bd0dee
MD5 c12ee0b474b8e07bb830c85aec7cc4a0
BLAKE2b-256 46f1601fd3ce8883dd829337922e137de273f680a029a8e89933c5a3540c41db

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