fix packaging
This commit is contained in:
214
pymodmilter/docs/pymodmilter.conf.example
Normal file
214
pymodmilter/docs/pymodmilter.conf.example
Normal file
@@ -0,0 +1,214 @@
|
||||
# This is an example /etc/pymodmilter.conf file.
|
||||
# Copy it into place before use.
|
||||
#
|
||||
# The file is in JSON format.
|
||||
#
|
||||
# The global option 'log' can be overriden per rule or per modification.
|
||||
#
|
||||
{
|
||||
# Section: global
|
||||
# Notes: Global options.
|
||||
#
|
||||
"global": {
|
||||
# Option: socket
|
||||
# Type: String
|
||||
# Notes: The socket used to communicate with the MTA.
|
||||
#
|
||||
# Examples:
|
||||
# unix:/path/to/socket a named pipe
|
||||
# inet:8899 listen on ANY interface
|
||||
# inet:8899@localhost listen on a specific interface
|
||||
# inet6:8899 listen on ANY interface
|
||||
# inet6:8899@[2001:db8:1234::1] listen on a specific interface
|
||||
# Value: [ SOCKET ]
|
||||
"socket": "inet:8898@127.0.0.1",
|
||||
|
||||
# Option: local_addrs
|
||||
# Type: List
|
||||
# Notes: A list of local hosts and networks.
|
||||
# Value: [ LIST ]
|
||||
#
|
||||
"local_addrs": ["::1/128", "127.0.0.0/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
|
||||
|
||||
# Option: loglevel
|
||||
# Type: String
|
||||
# Notes: Set loglevel for rules and actions.
|
||||
# Value: [ error | warning | info | debug ]
|
||||
#
|
||||
"loglevel": "info",
|
||||
|
||||
# Option: pretend
|
||||
# Type: Bool
|
||||
# Notes: Just pretend to do the actions, for test purposes.
|
||||
# Value: [ true | false ]
|
||||
#
|
||||
"pretend": true
|
||||
},
|
||||
|
||||
# Section: rules
|
||||
# Notes: Rules and related actions.
|
||||
#
|
||||
"rules": [
|
||||
{
|
||||
# Option: name
|
||||
# Type: String
|
||||
# Notes: Name of the rule.
|
||||
# Value: [ NAME ]
|
||||
#
|
||||
"name": "myrule",
|
||||
|
||||
# Section: conditions
|
||||
# Notes: Optional conditions to process the rule.
|
||||
# If multiple conditions are set, they all
|
||||
# have to be true to process the rule.
|
||||
#
|
||||
"conditions": {
|
||||
# Option: local
|
||||
# Type: Bool
|
||||
# Notes: Condition wheter the senders host address is listed in local_addrs.
|
||||
# Value: [ true | false ]
|
||||
#
|
||||
"local": false,
|
||||
|
||||
# Option: hosts
|
||||
# Type: String
|
||||
# Notes: Condition wheter the senders host address is listed in this list.
|
||||
# Value: [ LIST ]
|
||||
#
|
||||
"hosts": [ "127.0.0.1" ],
|
||||
|
||||
# Option: envfrom
|
||||
# Type: String
|
||||
# Notes: Condition wheter the envelop-from address matches this regular expression.
|
||||
# Value: [ REGEX ]
|
||||
#
|
||||
"envfrom": "^.+@mypartner\\.com$",
|
||||
|
||||
# Option: envto
|
||||
# Type: String
|
||||
# Notes: Condition wheter the envelop-to address matches this regular expression.
|
||||
# Value: [ REGEX ]
|
||||
#
|
||||
"envto": "^postmaster@.+$"
|
||||
},
|
||||
|
||||
# Section: actions
|
||||
# Notes: Actions of the rule.
|
||||
#
|
||||
"actions": [
|
||||
{
|
||||
# Option: name
|
||||
# Type: String
|
||||
# Notes: Name of the modification.
|
||||
# Value: [ NAME ]
|
||||
#
|
||||
"name": "add_test_header",
|
||||
|
||||
# Option: type
|
||||
# Type: String
|
||||
# Notes: Type of the modification.
|
||||
# Value: [ add_header | del_header | mod_header ]
|
||||
#
|
||||
"type": "add_header",
|
||||
|
||||
# Option: header
|
||||
# Type: String
|
||||
# Notes: Name of the header.
|
||||
# Value: [ NAME ]
|
||||
#
|
||||
"header": "X-Test-Header",
|
||||
|
||||
# Option: value
|
||||
# Type: String
|
||||
# Notes: Value of the header.
|
||||
# Value: [ VALUE ]
|
||||
#
|
||||
"value": "true"
|
||||
}, {
|
||||
"name": "modify_subject",
|
||||
|
||||
"type": "mod_header",
|
||||
|
||||
# Option: header
|
||||
# Type: String
|
||||
# Notes: Regular expression to match against header lines (e.g. Subject: Test-Subject).
|
||||
# Value: [ REGEX ]
|
||||
#
|
||||
"header": "^Subject$",
|
||||
|
||||
# Option: search
|
||||
# Type: String
|
||||
# Notes: Regular expression to match against the headers value.
|
||||
# Values: [ VALUE ]
|
||||
#
|
||||
"search": "(?P<subject>.*)",
|
||||
|
||||
# Option: value
|
||||
# Type: String
|
||||
# Notes: New value of the header.
|
||||
# Values: [ VALUE ]
|
||||
"value": "[EXTERNAL] \\g<subject>"
|
||||
}, {
|
||||
"name": "delete_received_header",
|
||||
|
||||
"type": "del_header",
|
||||
|
||||
# Option: header
|
||||
# Type: String
|
||||
# Notes: Regular expression to match against header lines (e.g. Subject: Test-Subject).
|
||||
# Value: [ REGEX ]
|
||||
#
|
||||
"header": "^Received$"
|
||||
}, {
|
||||
"name": "add_disclaimer",
|
||||
|
||||
"type": "add_disclaimer",
|
||||
|
||||
# Option: action
|
||||
# Type: String
|
||||
# Notes: Action to perform with the disclaimer.
|
||||
# Value: [ append | prepend ]
|
||||
#
|
||||
"action": "prepend",
|
||||
|
||||
# Option: html_file
|
||||
# Type: String
|
||||
# Notes: Path to a file which contains the html representation of the disclaimer.
|
||||
# Value: [ FILE_PATH ]
|
||||
#
|
||||
"html_file": "/etc/pymodmilter/templates/disclaimer_html.template",
|
||||
|
||||
# Option: text_file
|
||||
# Type: String
|
||||
# Notes: Path to a file which contains the text representation of the disclaimer.
|
||||
# Value: [ FILE_PATH ]
|
||||
#
|
||||
"text_file": "/etc/pymodmilter/templates/disclaimer_text.template",
|
||||
|
||||
# Option: error_policy
|
||||
# Type: String
|
||||
# Notes: Set what should be done if the modification fails (e.g. no message body present).
|
||||
# Value: [ wrap | ignore | reject ]
|
||||
#
|
||||
"error_policy": "wrap"
|
||||
}, {
|
||||
"name": "store_message",
|
||||
|
||||
"type": "store",
|
||||
|
||||
# Option: storage_type
|
||||
# Type: String
|
||||
# Notes: The storage type used to store e-mails.
|
||||
# Value: [ file ]
|
||||
"storage_type": "file",
|
||||
|
||||
# Option: directory
|
||||
# Type: String
|
||||
# Notes: Directory used to store e-mails.
|
||||
# Value: [ file ]
|
||||
"directory": "/mnt/messages"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
9
pymodmilter/docs/templates/disclaimer_html.template
vendored
Normal file
9
pymodmilter/docs/templates/disclaimer_html.template
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<table style="border: 1px solid; background-color: #F8E898; border-color: #885800; font-family: Arial; font-size: 11pt;">
|
||||
<tr>
|
||||
<td>
|
||||
<span style="font-weight: bold; color: #905800;">CAUTION:</span> This email originated from outside the organization.
|
||||
Do not follow guidance, click links or open attachments unless you recognize the sender and know the content is safe.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/><br/>
|
||||
4
pymodmilter/docs/templates/disclaimer_text.template
vendored
Normal file
4
pymodmilter/docs/templates/disclaimer_text.template
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
CAUTION: This email originated from outside the organization. Do not follow guidance, click links or open attachments unless you recognize the sender and know the content is safe.
|
||||
|
||||
|
||||
8
pymodmilter/misc/openrc/pymodmilter.confd
Normal file
8
pymodmilter/misc/openrc/pymodmilter.confd
Normal file
@@ -0,0 +1,8 @@
|
||||
# /etc/conf.d/pymodmilter: config file for /etc/init.d/pymodmilter
|
||||
|
||||
# Start the daemon as the user. You can optionally append a group name here also.
|
||||
# USER="daemon"
|
||||
# USER="daemon:nobody"
|
||||
|
||||
# Optional parameters for pymodmilter
|
||||
# MILTER_OPTS=""
|
||||
46
pymodmilter/misc/openrc/pymodmilter.initd
Executable file
46
pymodmilter/misc/openrc/pymodmilter.initd
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
user=${USER:-daemon}
|
||||
milter_opts="${MILTER_OPTS:-}"
|
||||
|
||||
pidfile="/run/${RC_SVCNAME}.pid"
|
||||
command="/usr/bin/pymodmilter"
|
||||
command_args="${milter_opts}"
|
||||
command_background=true
|
||||
start_stop_daemon_args="--user ${user}"
|
||||
|
||||
extra_commands="configtest"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
before mta
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
OUTPUT=$( ${command} ${command_args} -t 2>&1 )
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
eerror "${SVCNAME} has detected an error in your configuration:"
|
||||
printf "%s\n" "${OUTPUT}"
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
configtest() {
|
||||
ebegin "Checking ${SVCNAME} configuration"
|
||||
checkconfig
|
||||
eend $?
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ "${RC_CMD}" != "restart" ]; then
|
||||
checkconfig || return $?
|
||||
fi
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
if [ "${RC_CMD}" != "restart" ]; then
|
||||
checkconfig || return $?
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user