fix packaging

This commit is contained in:
2020-11-17 10:37:31 +01:00
parent 702d22f9aa
commit 8c07c02102
6 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,180 @@
# This is an example /etc/pyquarantine/pyquarantine.conf file.
# Copy it into place before use.
#
# Comments: use '#' for comment lines and ';' (following a space) for inline comments.
#
# If an option is not present in a quarantine section, it will be read from
# the global section.
#
[global]
# Option: quarantines
# Notes: Set active quarantines (comma-separated).
# Each active quarantine must have a section with the same name below.
# The quarantine name 'global' is forbidden and will be ignored.
# Quarantine names must be unique.
# Values: [ ACTIVE ]
#
quarantines = spam
# Option: quarantine_action_precedence
# Notes: Set if the action of the first or the last matching quarantine should
# be used if multiple recipients match multiple quarantines. If an original
# email is delivered to at least one recipient due to whitelisting, the
# email will always be accepted.
# Values: [ first | last ]
#
preferred_quarantine_action = last
[spam]
# Option: host_whitelist
# Notes: Set a list of host and network addresses to be ignored by this quarantine.
# All the common host/network notations are supported, including IPv6.
# Value: [ HOST ]
#
host_whitelist = 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
# Option: regex
# Notes: Set the case insensitive regular expression to match against email headers.
# If the regex matches any of the email headers, the email
# will be processed by this quarantine.
# Values: [ REGEX ]
#
regex = ^X-Spam-Flag: YES
# Option: smtp_host
# Notes: Set the SMTP host. It will be used to (re-)inject emails.
# Values: [ HOSTNAME | IP_ADDRESS ]
#
smtp_host = 127.0.0.1
# Option: smtp_port
# Notes: Set the SMTP port.
# Values: [ PORT ]
#
smtp_port = 25
# Option: storage_type
# Notes: Set the storage type.
# Values: [ file | none ]
#
storage_type = file
# Option: storage_directory
# Notes: Set the directory to store quarantined emails.
# This option is needed by quarantine type 'file'.
# Values: [ DIRECTORY ]
#
storage_directory = /var/lib/pyquarantine/spam
# Option: action
# Notes: Set the milter action to perform if email is processed by this quarantine.
# Values: [ accept | discard | reject ]
#
action = discard
# Option: reject_reason
# Notes: Optionally set the reason to return if action is set to reject.
# Values: [ REASON ]
#
reject_reason = Message rejected
# Option: notification
# Notes: Set the notification type.
# Values: [ email | none ]
#
notification_type = email
# Option: notification_email_smtp_host
# Notes: Set the SMTP host. It will be used to send notification e-mails.
# Values: [ HOSTNAME | IP_ADDRESS ]
#
notification_email_smtp_host = 127.0.0.1
# Option: notification_email_smtp_port
# Notes: Set the SMTP port.
# Values: [ PORT ]
#
notification_email_smtp_port = 25
# Option: notification_email_envelope_from
# Notes: Set the envelope-from address used when sending notification emails.
# This option is needed by notification type 'email'.
# Values: [ ENVELOPE_FROM_ADDRESS ]
#
notification_email_envelope_from = notification@domain.tld
# Option: notification_email_from
# Notes: Set the from header used when sending notification emails.
# This option is needed by notification type 'email'.
# Values: [ FROM_HEADER ]
#
notification_email_from = Notification <notification@domain.tld>
# Option: notification_email_usbject
# Notes: Set the subject used when sending notification emails.
# This option is needed by notification type 'email'.
# Values: [ SUBJECT ]
#
notification_email_subject = Spam Quarantine Notification
# Option: notification_email_template
# Notes: Set the template used when sending notification emails.
# A relative path to this config file can be used.
# This option is needed by notification type 'email'.
# Values: [ TEMPLATE_PATH ]
#
notification_email_template = templates/notification.template
# Option: notification_email_strip_images
# Notes: Optionally enable this option to strip img tags from emails.
# Values: [ TRUE | ON | YES | FALSE | OFF | NO ]
#
notification_email_strip_images = False
# Option: notification_email_replacement_img
# Notes: Optionally set the path to a replacement image for img tags within emails.
# A relative path to this config file can be used.
# Values: [ IMAGE_PATH ]
#
notification_email_replacement_img = templates/removed.png
# Option: notification_email_embedded_imgs
# Notes: Set a list of paths to images to embed in e-mails (comma-separated).
# Relative paths to this config file can be used.
# This option is needed by notification type 'email'.
# Values: [ IMAGE_PATH ]
#
notification_email_embedded_imgs = templates/logo.png
# Option: notification_email_parser_lib
# Notes: Optionally set the parser library used to parse
# the text part of emails.
# Values: [ lxml | html.parser ]
#
notification_email_parser_lib = lxml
# Option: whitelist_type
# Notes: Set the whitelist type.
# Values: [ db | none ]
#
whitelist_type = db
# Option: whitelist_db_connection
# Notes: Set the connection string to connect to the database.
# The configured user must have read/write access to
# the whitelist_db_table configured below.
# This option is needed by whitelist type 'db'.
# Values: [ DB_CONNECTION_STRING | none ]
#
whitelist_db_connection = mysql://user:password@localhost/database
# Option: whitelist_db_table
# Notes: Set the database table name.
# This option is needed by whitelist type 'db'.
# Values: [ DATABASE_TABLE]
#
whitelist_db_table = whitelist

View File

@@ -0,0 +1,33 @@
<html>
<body>
<h1>Quarantine notification</h1>
<table>
<tr>
<td><b>Envelope-From:</b></td>
<td>{EMAIL_ENVELOPE_FROM}</td>
</tr>
<tr>
<td><b>From:</b></td>
<td>{EMAIL_FROM}</td>
</tr>
<tr>
<td><b>Envelope-To:</b></td>
<td>{EMAIL_ENVELOPE_TO}</td>
</tr>
<tr>
<td><b>To:</b></td>
<td>{EMAIL_TO}</td>
</tr>
<tr>
<td><b>Subject:</b></td>
<td>{EMAIL_SUBJECT}</td>
</tr>
<tr>
<td><b>Quarantine ID:</b></td>
<td>{EMAIL_QUARANTINE_ID}</td>
</tr>
</table><br/>
<h2>Preview of the original e-mail</h2>
{EMAIL_HTML_TEXT}
</body>
</html>

BIN
pyquarantine/docs/templates/removed.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,17 @@
# /etc/conf.d/pyquarantine-milter: config file for /etc/init.d/pyquarantine-milter
# Set 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
SOCKET="inet:8899@127.0.0.1"
# Start the daemon as the user. You can optionally append a group name here also.
# USER="daemon"
# USER="daemon:nobody"
# Optional parameters for pyquarantine-milter
# MILTER_OPTS=""

View File

@@ -0,0 +1,50 @@
#!/sbin/openrc-run
user=${USER:-daemon}
socket="${SOCKET:-}"
milter_opts="${MILTER_OPTS:-}"
pidfile="/run/${RC_SVCNAME}.pid"
command="/usr/bin/pyquarantine-milter"
command_args="-s ${socket} ${milter_opts}"
command_background=true
start_stop_daemon_args="--user ${user}"
extra_commands="configtest"
depend() {
need net
before mta
}
checkconfig() {
if [ -z "${socket}" ]; then
eerror "No socket specified in config!"
fi
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
}