rpmbuilder/rpms/stalwart/resources/scripts/postinstall.sh
Ben Vincent 6813eb84ce
All checks were successful
Build / build-8 (pull_request) Successful in 1m51s
Build / build-9 (pull_request) Successful in 1m59s
feat: add default settings to stalwart
- bump release
- add default admin user/pass
- change http service to listen on all interfaces
2025-10-19 20:44:04 +11:00

59 lines
1.2 KiB
Bash

#!/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