1
0
This repository has been archived on 2022-04-16. You can view files and clone it, but cannot push or open issues or pull requests.
accounts/README.md

3.0 KiB

accounts

A self-service web application for Mail-in-a-box.
We run it here: https://accounts.socialnerds.org

It is a very simple web application for users to manage their Mail-in-a-box account. I wrote this as a python/bottlepy learning project and to service users at my own Mail-in-a-box. There might be more features in the future.

Features

  • Login with Mail-in-a-box account
  • Change password
  • Manage email aliases
  • Delete own account (softdelete)

Installation

You need python installed (v3 or v2). Needed modules: requests, configparser, bottle(or just download bottlepy like below)

git clone git@socialg.it:socialnerds.org/accounts.git
cd accounts
wget https://raw.githubusercontent.com/bottlepy/bottle/0.12.10/bottle.py

Configure your app by renaming app.conf.sample into app.conf and edit accordingly.
Start it with:

python3 app.py

You should be able to see the login page at http://localhost:8000.

Deployment

If you want to host this somewhere more prominent following links could help: (someday i might write up some real documentation)

This is what i did on an Ubuntu 16.04 server with apache2:

I enabled following Apache modules (for future instance balancing plans):

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html
a2enmod xml2enc

Apache vhost config:

<VirtualHost *:80>
    DocumentRoot /var/www/accounts/static
    ServerAdmin admin@domain.tld
    ServerName accounts.domain.tld

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/accounts_access.log combined

    Redirect permanent / https://accounts.domain.tld/
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost _default_:443>

	ServerAdmin admin@domain.tld
	ServerName accounts.domain.tld
	DocumentRoot /var/www/accounts/static

  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

	ErrorLog ${APACHE_LOG_DIR}/accounts_ssl_error.log
	LogLevel warn
	CustomLog ${APACHE_LOG_DIR}/accounts_ssl_access.log combined

	SSLEngine on
  SSLCertificateFile /path/to/fullchain.pem
  SSLCertificateKeyFile /path/to/key.pem

  ProxyPreserveHost On
  ProxyPass / http://localhost:8000/
  ProxyPassReverse / http://localhost:8000/

</VirtualHost>
</IfModule>

Unit file for systemd. /lib/systemd/system/accounts.service
Enable service with sudo systemctl enable accounts.service

[Unit]
Description=Accounts App
After=multi-user.target

[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/var/www/accounts
ExecStart=/usr/bin/python3 /var/www/accounts/app.py
StandardOutput=syslog
StandardError=syslog
Restart=always
RestartSec=2

[Install]
WantedBy=multi-user.target