The script also requires a TLS-capable mail server to be running. We have used this code with both Sendmail and Postfix. See below for the Postfix config required to enable TLS.
These scripts simplify the process of:
New user data is assumed to be in a Google Sheet. The function parse_rows in addusers.py handles parsing the spreadsheet data, you may need to modify it to work with your particular spreadsheet format.
During initial setup, run these commands to install the required dependencies:
# Possibly in a virtual environment
$ pip install -r requirements.txt
Copy the examplee_settings.ini to settings.ini and then fill the fields required in that file.
The mail server needs to have TLS enabled. If using postfix, add the following lines to /etc/postfix/main.cf:
smtpd_tls_cert_file = /path/to/cert/file
smtpd_tls_key_file = /path/to/key/file
smtpd_tls_security_level = may
If no certificate exists, one can be generated:
openssl req -new -x509 -nodes -out /etc/postfix/postfix.pem -keyout /etc/postfix/postfix.pem -days 3650