Installer: maddy
diff --git a/apps/maddy/install.yaml b/apps/maddy/install.yaml
index 389bd31..023085f 100644
--- a/apps/maddy/install.yaml
+++ b/apps/maddy/install.yaml
@@ -16,19 +16,19 @@
ports:
- port: 25
protocol: TCP
- name: a
+ name: smtp
- port: 143
protocol: TCP
- name: b
+ name: imap
- port: 993
protocol: TCP
- name: c
+ name: imaps
- port: 587
protocol: TCP
- name: d
+ name: submission
- port: 465
protocol: TCP
- name: e
+ name: smtps
---
apiVersion: v1
kind: Service
diff --git a/apps/maddy/web/Makefile b/apps/maddy/web/Makefile
index 7c054fc..2054935 100644
--- a/apps/maddy/web/Makefile
+++ b/apps/maddy/web/Makefile
@@ -5,7 +5,7 @@
go build -o maddy-web *.go
image: build
- docker build --tag=giolekva/maddy-web:latest .
+ docker build --tag=giolekva/maddy-web:latest . --platform=linux/arm64
push: image
docker push giolekva/maddy-web:latest
diff --git a/apps/maddy/web/main.go b/apps/maddy/web/main.go
index d4bced0..1e823a1 100644
--- a/apps/maddy/web/main.go
+++ b/apps/maddy/web/main.go
@@ -10,11 +10,13 @@
"io/ioutil"
"log"
"net/http"
+ "os"
"os/exec"
)
var port = flag.Int("port", 8080, "Port to listen on.")
var maddyConfig = flag.String("maddy-config", "", "Path to the Maddy configuration file.")
+var exportDKIM = flag.String("export-dkim", "", "Path to the dkim dns configuration to expose.")
//go:embed templates/*
var tmpls embed.FS
@@ -108,6 +110,19 @@
http.Redirect(w, r, "/", http.StatusSeeOther)
}
+func (h *MaddyHandler) handleDKIM(w http.ResponseWriter, r *http.Request) {
+ d, err := os.Open(*exportDKIM)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ defer d.Close()
+ if _, err := io.Copy(w, d); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}
+
func main() {
flag.Parse()
t, err := ParseTemplates(tmpls)
@@ -123,6 +138,9 @@
}
http.HandleFunc("/", handler.handleListAccounts)
http.HandleFunc("/create", handler.handleCreateAccount)
+ if *exportDKIM != "" {
+ http.HandleFunc("/dkim", handler.handleDKIM)
+ }
fmt.Printf("Starting HTTP server on port: %d\n", *port)
fmt.Printf("Maddy config: %s\n", *maddyConfig)
if cfg, err := ioutil.ReadFile(*maddyConfig); err != nil {