John-Mark Gurney 2049886425 | 2 years ago | |
---|---|---|
.gitignore | 2 years ago | |
README.md | 2 years ago | |
base_setup.sh | 2 years ago | |
board_conf.ucl | 2 years ago | |
board_script | 2 years ago | |
create_resource | 2 years ago | |
data.py | 2 years ago | |
hypercorn.log.conf | 2 years ago | |
hypercorn.syslog.conf | 2 years ago | |
keygen | 2 years ago | |
rc.conf.template | 2 years ago | |
settings.conf | 2 years ago | |
setup_lab.sh | 2 years ago | |
setup_resources.sh | 2 years ago | |
test.json | 2 years ago | |
test.start | 2 years ago | |
test.stop | 2 years ago | |
update_authkeys.sh | 2 years ago |
This is the configuration and setup information for the lab.
The file settings.conf
contains the various variables to use.
settings.conf
file exists, and the scripts like setting up the
jail, and deploying the ssh keys. Simply, where this repository is
located.These list the various resources used/allocated by the system. The directory contains directories where the name is the value of the resource. Directories are used because posix guarantees atomic create/delete of directories, ensuring that an error occures if the operation fails.
base_setup.sh
: Script to setup a base image w/ various defaults
board_conf.ucl
: UCL configuration file for the embedded lab daemon
board_script
: Script that is run by the daemon, that reserves and
releases the specific board. It allocates resources (such as local
IP address) and launches the jail, and when the board is released,
it frees up the various resources.
create_resource
: Script used by setup_resources.sh
to initalize
the various resources when this is first configured.
keygen
: Script for generating a new API key for the specified user.
This is used by the update_authkeys.sh
script.
rc.conf.template
: Template rc.conf
for jails.
setup_lab.sh
: Script to setup the machine for the first time to run
the lab.
setup_resources.sh
: Script to setup initial resources.
test.*
: File and script to test that board_script
does what is
expected.
update_authkeys.sh
: A script used to generate the authorized_keys
file. The input is a file with each line containing the user followed
by their ssh-key. It will restrict that key to run the keygen
script
to get the user an API key.
SNMP is used to control a PoE switch which provides power to various boards. NetSNMP is used. It requires a little bit of setup. First is to set the default version to 3. Despite v1 being more common, v3 provides better security.
~root/.snmp/snmp.conf
:
defVersion 3
NetSNMP will use a file .snmp/hosts/<hostname>.conf
to set various
parameters. For example:
defVersion 3
defSecurityName admin
defAuthPassphrase XXXYYYZZZ
defAuthType SHA
defPrivPassphrase WWWUUUVVV
defPrivType DES
defSecurityLevel authPriv
transport <ip address>
This segments where authentication credentials are stored, and allows using names w/o having to enter them into a DNS server.
The program vlanmang is used to maintain the configuration of the switch, most specifically what ports are connected to which VLAN.
The file data.py
contains the configuration information. It will
read the auth methods and passwords from the NetSNMP configuration
files setup in the previous section.
Setup vlanmang
:
ln -s ~lab/.local ~root
python3.8 -m venv venv
. ./venv/bin/activate
export TMPDIR=/var/tmp
pip install git+https://www.funkthat.com/gitea/jmg/vlanmang.git
Configure switches:
. ./venv/bin/activate
python -m vlanmang