2 KiB
2 KiB
mailout
This is a simple binary to handle your self hosted mail notification-sending machines.
this is not intended for human users
The premise is as follow:
- you authenticate users with dovecot
- you sign emails with opendkim
- you use postfix (might work in other cases but havent tried)
The plan is basically:
- you have one table to handle your users and their passwords
- you have one for the DKIM keys you use
- you have a view to expose the relevant key to use for opendkim
Warning
I halfed assed that shit on an afternoon to suit my own needs, improvements will follow.
Features
-
Create mail users
-
Deletes them
-
Update passwords
-
Create DKIM keys
-
Delete them
-
Publish them to a DNS provider (currently only OVH)
-
Unpublish them to a DNS provider (currently only OVH)
Requirements
- Postgres with a user
- Optionally an OVH account
Dovecot
For authentication, you want to change your /etc/dovecot/dovecot-sql.conf.ext
to
driver = pgsql
connect = host=YOURHOST port=5432 user=YOURUSER password=APASSWORD dbname=DBNAME
password_query = SELECT password, username AS user FROM users WHERE username = '%n' AND domain = '%d'
user_query = SELECT maildir, 1000 AS uid, 1000 AS gid FROM users WHERE username = '%n' AND domain = '%d' AND active = '1'
OpenDKIM
You want to change the SigningTable
and KeyTable
settings in opendkim.conf
to
SigningTable dsn:pgsql://USER:PASSWORD@HOST/DATABASE/table=signing_table?keycol=domain_name?datacol=id
KeyTable dsn:pgsql://USER:PASSWORD@HOST/DATABASE/table=dkimkeys?keycol=id?datacol=domain_name,selector,private_key
Then you should be good to go, fill yourself a config file like that
postgres:
hostname: localhost
port: 5432
database: vmail
user: postgres
password: postgres123
sslmode: disable
providers:
ovh:
application_key: <CHANGEME>
application_secret: <CHANGEME>
consumer_key: <CHANGEME>
endpoint: ovh-eu
pointing to your DB and you're good