Skip to main content

Create a manual authentication file for the Guacamole remote access gateway from a simple configuration file.

Project description

Usermapper

Create a complex Guacamole manual authentication file, saved as /etc/guacamole/user-mapping.xml, from a simple confuration file. This is an opinionated script designed to support training labs. It assumes every user will have access to the same set of devices in the lab.

Installation

This is a Python program. Install from Github:

$ pip install git+https://github.com/blinklet/usermapper.git@v0.3#egg=usermapper

Usage

Create a configuration file that describes the users and devices in your lab. Then run the usermapper program. To see an example of the configuration file format, look at the example-config.yaml file in this repository, or see the next section.

The usermapper program accepts two optional arguments that allow the user to specify the input file and the output file. See the command syntax below:

$ python3 -m usermapper [-i <input filename>] [-o <output filename>]

For example:

$ python3 -m usermapper -i test.yaml -o /tmp/guac/map.xml

To use default filenames, where the configuration script is named config.yaml and the output file will be named user-mapping.xml and both files are in the current directory, run the script without arguments as follows:

$ python3 -m usermapper

Configuration file format

The configuration file is written using the YAML data file standard. The file name must end with the ".yaml" extension.

The configuration file consists of two main blocks: a users block and a devices block. You may have one or more types of users and one or more types of devices.

The username_suffix, device name_suffix, and device hostname_suffix must be a number with or without leading zeros, enclosed in quotes. We generate names by combining the corresponding name prefix and a different name suffix with a length equal to the length of the suffix string and starting at the number specified in the suffix.

If a user type's password is "random", each user of the same type will be assigned a unique random password. If you specify a specific user password, each user in the same user type will have the same password.

You may also add additional device parameters from the list of Guacamole configuration parameters.

Example config file

See the example below, which specifies trainers and students user types, and servers and routers device types:

users:

    trainers:
        quantity: 1
        username_prefix: trainer
        username_suffix: '01'
        password: s7T6yxOC100

    students:
        quantity: 8
        username_prefix: training
        username_suffix: '01'
        password: random

devices:

    servers:
        quantity: 11
        name_prefix: PC
        name_suffix: '09'
        hostname_prefix: '10.0.10.'
        hostname_suffix: '109'
        parameters:
            protocol: ssh
            hostname: ~
            port: 22
            username: root
            password: root
            color-scheme: white-black
            enable-sftp: 'true'
            sftp-root-directory: '/'

    routers:
        quantity: 4
        name_prefix: R
        name_suffix: '01'
        hostname_prefix: '10.0.10.'
        hostname_suffix: '1'
        parameters:
            protocol: ssh
            hostname: ~
            port: 22
            username: admin
            password: admin
            color-scheme: white-black
            enable-sftp: 'true'
            sftp-root-directory: '/files/'

Project details


Release history Release notifications | RSS feed

This version

0.3

Download files

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

Source Distribution

usermapper-0.3.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

usermapper-0.3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file usermapper-0.3.tar.gz.

File metadata

  • Download URL: usermapper-0.3.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for usermapper-0.3.tar.gz
Algorithm Hash digest
SHA256 6ee2b32825723faa691f264b040512c661f2009f8d075e9ea92fc0ea4738f0d2
MD5 d8019a583247b5cebe61d7e5c4a2c96c
BLAKE2b-256 93d297bac5a5c2a42f35a12132ed8eaf886de2c08f3136a049ef19688aaf0ea8

See more details on using hashes here.

File details

Details for the file usermapper-0.3-py3-none-any.whl.

File metadata

  • Download URL: usermapper-0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for usermapper-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 65fa12c6cac8bcec4135d78722396c5a8fb95646991845b30148d3cc0c4d2358
MD5 0c5c4c2944ce3975ae5af92c6770e039
BLAKE2b-256 569f2351f4223517b686c0c9d2a75826fdc0f00bfa62d3b8cc35976f1aaea875

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