-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (77 loc) · 2.56 KB
/
Makefile
File metadata and controls
101 lines (77 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
## dcape-app-mailserver Makefile
## This file extends Makefile.app from dcape
#:
SHELL = /bin/bash
CFG ?= .env
CFG_BAK ?= $(CFG).bak
#- Docker repo & image name without version
IMAGE ?= ghcr.io/docker-mailserver/docker-mailserver
#- ver
IMAGE_VER ?= 13.1.0
# ------------------------------------------------------------------------------
# app custom config
# Owerwrite for setup
APP_SITE ?= mail.dev.test
#- app root
APP_ROOT ?= $(PWD)
#- External SMTP port
SMTP_LISTEN ?= 25
#- Max message size
POSTFIX_MESSAGE_SIZE_LIMIT ?= 52428800
#- Relay setup
RELAY_HOST ?=
#- Relay setup
RELAY_PORT ?=
#- Relay setup
RELAY_USER ?=
#- Relay setup
RELAY_PASSWORD ?=
#- SSL type
#-empty => SSL disabled
#-letsencrypt => Enables Let's Encrypt certificates
SSL_TYPE ?= letsencrypt
# Copy from image to persist dir (always)
PERSIST_FILES = .git .env Makefile docker-compose.yml
# Keep persistent dir on deploy
APP_ROOT_OPTS = keep
# ------------------------------------------------------------------------------
# if exists - load old values
-include $(CFG_BAK)
export
-include $(CFG)
export
# ------------------------------------------------------------------------------
# Find and include DCAPE_ROOT/Makefile
DCAPE_COMPOSE ?= dcape-compose
DCAPE_ROOT ?= $(shell docker inspect -f "{{.Config.Labels.dcape_root}}" $(DCAPE_COMPOSE))
ifeq ($(shell test -e $(DCAPE_ROOT)/Makefile.app && echo -n yes),yes)
include $(DCAPE_ROOT)/Makefile.app
else
include /opt/dcape/Makefile.app
endif
# ------------------------------------------------------------------------------
user-add:
docker run --rm \
-e MAIL_USER=$(USER_EMAIL) \
-e MAIL_PASS=$(USER_PASS) \
-ti $$IMAGE:$$IMAGE_VER \
/bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> $(APP_ROOT)/config/postfix-accounts.cf
# ------------------------------------------------------------------------------
dkim-add:
docker run --rm \
-v $(DATA_PATH)/config:/tmp/docker-mailserver \
-ti $$IMAGE:$$IMAGE_VER generate-dkim-config
dkim: CMD=exec app setup config dkim domain '$(DOMAIN)'
dkim: dc
IP ?= 1.1.1.1
## make ban IP=1.1.1.1[/24]
ban:
@echo -n "$(IP): "
@docker exec $(APP_TAG)-app-1 setup fail2ban ban "$(IP)"
BAN_APP ?= custom
## make app-ban IP=1.1.1.0[/24] BAN_APP=postfix
app-ban:
docker exec $(APP_TAG)-app-1 fail2ban-client set $(BAN_APP) banip "$(IP)"
## make app-unban IP=1.1.1.0[/24] BAN_APP=postfix
app-unban:
docker exec $(APP_TAG)-app-1 fail2ban-client set $(BAN_APP) unbanip "$(IP)"