Skip to main content

Module connection_env

Module connection_env 

Source
Expand description

What a command gets of a connection (decisions 184, 190-192): PREFIX_* variables, and the files its tools read (curl’s -K config, an SSH key and config, Postgres’s .pgpass, a MySQL option file), written in the attempt’s folder.

A secret goes into its tool’s file and into a variable for scripts; a URL variable never holds a password (psql "$DB_URL" puts none on a command line). What a command gets verifies TLS as the Python clients do (decision 191): SQL’s sslmode=verify-full, Mongo’s tls=true, SSH only its known_hosts. Only prefixed names (decision 192).

Structs§

View
A connection as a command gets it, before it is written.

Functions§

default_dir
Where a worker writes its commands’ connection files when [worker] connection_dir isn’t set (decision 201): in memory, under shm (/dev/shm) when it is a folder, in a folder of the user’s own named after the data directory (so workers of one user sharing an ID, a standalone’s and a worker’s, never sweep each other’s); else the data directory.
folder
The folder of the connection given as prefix in an attempt’s folder.
prepare
Makes dir (a worker’s connection folder) and the folder holding it, mode 0700, before the worker starts (decision 201), and checks the whole path. In a folder others can write in (/dev/shm), another user could have made a folder on it first, or a link, and swap what is below: the secrets would go where they can read them. So every folder on the path must be the user’s or root’s, closed to others’ writes unless sticky (/dev/shm, /tmp), and to group writes unless the group is the user’s own; a link on it must be root’s (/var/run); the last two folders the user’s alone, mode 0700.
view
The view of a connection of type kind (a @connection function’s: None), its values rendered and shown as plain JSON, its files to go in dir.
write
Writes view’s files in dir (mode 0700; each file 0600), and gives its variables, named PREFIX_....