#!/usr/bin/env bash # Create default configuration if it doesn't exist if [ ! -f /opt/stalwart/etc/config.toml ]; then cat > /opt/stalwart/etc/config.toml << 'EOF' # Stalwart Mail Server Configuration # This is a minimal configuration file. Please customize according to your needs. # Full documentation: https://stalw.art/docs/ [server] hostname = "localhost" [server.listener.smtp] bind = ["127.0.0.1:25"] protocol = "smtp" [server.listener.submission] bind = ["127.0.0.1:587"] protocol = "smtp" [server.listener.imap] bind = ["127.0.0.1:143"] protocol = "imap" [server.listener.http] bind = ["[::]:8080"] protocol = "http" [storage] data = "sqlite" fts = "sqlite" blob = "fs" lookup = "sqlite" directory = "internal" [store."sqlite"] type = "sqlite" path = "/var/lib/stalwart/stalwart.db" [store."fs"] type = "fs" path = "/var/lib/stalwart/blobs" [directory."internal"] type = "internal" store = "sqlite" [authentication.fallback-admin] user = "admin" secret = "$6$PAEtTGE/jbt9B/FQ$lYXn/whSh7rzegMdA6W8vuw2E/3IDFjpb0edXRqrl1d8i2KQF6Qm.ESmZ3j5jIHCTPSIH3JYBvIgvIbk9sH3p1" EOF chown stalwart:stalwart /opt/stalwart/etc/config.toml chmod 600 /opt/stalwart/etc/config.toml fi # Reload systemd systemctl daemon-reload