Package: usermapper
UsermapperCreate a complex Guacamole manual authentication file, saved as/etc/guacamole/user-mapping.xml, from a simple confuration file. This is anopinionatedscript designed to support training labs. It assumes every user will have access to the same set of devices in the lab.InstallationThis is a Python program. Install from Github:$ pip install git+https://github.com/blinklet/usermapper.git@v0.3#egg=usermapperUsageCreate 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 theexample-config.yamlfile 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.xmlTo use default filenames, where the configuration script is namedconfig.yamland the output file will be nameduser-mapping.xmland both files are in the current directory, run the script without arguments as follows:$ python3 -m usermapperConfiguration file formatThe configuration file is written using theYAML data file standard. The file name must end with the ".yaml" extension.The configuration file consists of two main blocks: ausersblock and adevicesblock. You may have one or more types of users and one or more types of devices.Theusername_suffix, devicename_suffix, and devicehostname_suffixmust 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'spasswordis "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 thelist of Guacamole configuration parameters.Example config fileSee the example below, which specifiestrainersandstudentsuser types, andserversandroutersdevice 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/'