-
Notifications
You must be signed in to change notification settings - Fork 216
/
amavisd
149 lines (119 loc) · 5.57 KB
/
amavisd
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
# Author: Zhang Huangbin (zhb _at_ iredmail.org)
#---------------------------------------------------------------------
# This file is part of iRedMail, which is an open source mail server
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
#
# iRedMail is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iRedMail is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------
# Warning: Please source 'conf/postfix' first.
export SYS_USER_AMAVISD='amavis'
export SYS_GROUP_AMAVISD='amavis'
export AMAVISD_QUARANTINE_PORT='9998'
export AMAVISD_LOGFILE='/var/log/amavisd.log'
export AMAVISD_LOGROTATE_FILE="${LOGROTATE_DIR}/amavisd"
export AMAVISD_DKIM_SELECTOR='dkim'
export AMAVISD_RC_SCRIPT_NAME='amavisd'
export AMAVISD_SPOOL_DIR='/var/spool/amavisd'
export AMAVISD_DKIM_DIR="${AMAVISD_DKIM_DIR:=/var/lib/dkim}"
# Network ports
export AMAVISD_SMTP_PORT='10024'
export AMAVISD_ORIGINATING_PORT='10026'
export AMAVISD_MLMMJ_PORT='10027'
export AMAVISD_QUARANTINE_PORT='9998'
# Database used to store incoming & outgoing email related information.
export AMAVISD_DB_NAME='amavisd'
export AMAVISD_DB_USER='amavisd'
# Altermime.
export CMD_ALTERMIME='/usr/bin/altermime'
export DISCLAIMER_DIR="${POSTFIX_ROOTDIR}/disclaimer"
if [ X"${DISTRO}" == X'RHEL' ]; then
export AMAVISD_BIN='/usr/sbin/amavisd'
export AMAVISD_LDAP_SCHEMA_NAME='amavisd-new.schema'
export AMAVISD_VAR_RUN_DIR='/var/run/amavisd'
export AMAVISD_CONF='/etc/amavisd/amavisd.conf'
elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
if [[ X"${DISTRO_CODENAME}" == X"bookworm" ]] || [[ X"${DISTRO_CODENAME}" == X'noble' ]]; then
export AMAVISD_BIN='/usr/sbin/amavisd'
else
export AMAVISD_BIN='/usr/sbin/amavisd-new'
fi
export AMAVISD_CONF_DIR='/etc/amavis/conf.d'
export AMAVISD_CONF='/etc/amavis/conf.d/50-user'
export AMAVISD_RC_SCRIPT_NAME='amavis'
export AMAVISD_LDAP_SCHEMA_NAME='amavis.schema'
export AMAVISD_SPOOL_DIR='/var/lib/amavis'
export AMAVISD_VAR_RUN_DIR='/var/run/amavis'
elif [ X"${DISTRO}" == X'FREEBSD' ]; then
# Override global setting: user/group.
export SYS_USER_AMAVISD='vscan'
export SYS_GROUP_AMAVISD='vscan'
export AMAVISD_BIN='/usr/local/sbin/amavisd'
export AMAVISD_CONF='/usr/local/etc/amavisd.conf'
export AMAVISD_LDAP_SCHEMA_NAME='amavisd-new.schema'
export AMAVISD_SPOOL_DIR='/var/amavis'
export AMAVISD_VAR_RUN_DIR="${AMAVISD_SPOOL_DIR}/var"
# Override location of command 'altermime'
export CMD_ALTERMIME='/usr/local/bin/altermime'
elif [ X"${DISTRO}" == X'OPENBSD' ]; then
export SYS_USER_AMAVISD='_vscan'
export SYS_GROUP_AMAVISD='_vscan'
export AMAVISD_BIN='/usr/local/sbin/amavisd'
export AMAVISD_CONF='/etc/amavisd.conf'
export AMAVISD_LDAP_SCHEMA_NAME='amavisd.schema'
export AMAVISD_SPOOL_DIR='/var/amavisd'
export AMAVISD_VAR_RUN_DIR="${AMAVISD_SPOOL_DIR}"
# Override location of command 'altermime'
export CMD_ALTERMIME='/usr/local/bin/altermime'
fi
export CRON_FILE_AMAVISD="${CRON_SPOOL_DIR}/${SYS_USER_AMAVISD}"
export AMAVISD_DB_DIR="${AMAVISD_SPOOL_DIR}/db"
export AMAVISD_QUARANTINE_DIR="${AMAVISD_SPOOL_DIR}/quarantine"
export AMAVISD_TEMP_DIR="${AMAVISD_SPOOL_DIR}/tmp"
if [ X"${DISTRO}" == X'RHEL' ]; then
export AMAVISD_VIRUSMAILS_DIR="${AMAVISD_QUARANTINE_DIR}"
elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
export AMAVISD_VIRUSMAILS_DIR="${AMAVISD_SPOOL_DIR}/virusmails"
elif [ X"${DISTRO}" == X'FREEBSD' ]; then
export AMAVISD_VIRUSMAILS_DIR='/var/virusmails'
elif [ X"${DISTRO}" == X'OPENBSD' ]; then
export AMAVISD_VIRUSMAILS_DIR='/var/virusmails'
fi
export AMAVISD_LOCK_FILE="${AMAVISD_VAR_RUN_DIR}/amavisd.lock"
export AMAVISD_PID_FILE="${AMAVISD_VAR_RUN_DIR}/amavisd.pid"
export AMAVISD_SOCKET_FILE="${AMAVISD_VAR_RUN_DIR}/amavisd.socket"
export AMAVISD_DB_MYSQL_TMPL="${SAMPLE_DIR}/amavisd/amavisd.mysql"
export AMAVISD_DB_PGSQL_TMPL="${SAMPLE_DIR}/amavisd/amavisd.pgsql"
# Value of Postfix parameter `content_filter=`.
export AMAVISD_CONTENT_FILTER_ORIGINATING="smtp-amavis:[${SMTP_SERVER}]:${AMAVISD_ORIGINATING_PORT}"
# mynetworks, inet_acl
export AMAVISD_MYNETWORKS='127.0.0.0/8'
export AMAVISD_INET_ACL='127.0.0.1 [::1]'
if [ X"${LOCAL_ADDRESS}" != X'127.0.0.1' ]; then
export AMAVISD_MYNETWORKS="${AMAVISD_MYNETWORKS},${LOCAL_ADDRESS}"
export AMAVISD_INET_ACL="${AMAVISD_INET_ACL} ${LOCAL_ADDRESS}"
fi
# Num of pre-forked children.
# Try to set it to memory size (in GB)
export AMAVISD_MAX_SERVERS='2'
if [ X"${KERNEL_NAME}" == X'LINUX' ]; then
_mem_size_gb="$(free -g | grep '^Mem:' | awk '{print $2}')"
export AMAVISD_MAX_SERVERS="$((${_mem_size_gb} + 1))"
elif [ X"${KERNEL_NAME}" == X'FREEBSD' ]; then
_mem_size="$(sysctl hw.realmem | awk '{print $2}')"
export AMAVISD_MAX_SERVERS="$((${_mem_size} / 1024 / 1024 / 1024 + 1))"
elif [ X"${KERNEL_NAME}" == X'OPENBSD' ]; then
_mem_size="$(sysctl hw.physmem | awk -F'=' '{print $2}')"
export AMAVISD_MAX_SERVERS="$((${_mem_size} / 1024 / 1024 / 1024 + 1))"
fi