prepare to merge with pyquarantine project
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
include LICENSE README.md
|
include LICENSE README.md
|
||||||
recursive-include pymodmilter/docs *
|
recursive-include pyquarantine/docs *
|
||||||
recursive-include pymodmilter/misc *
|
recursive-include pyquarantine/misc *
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -1,25 +1,27 @@
|
|||||||
# pymodmilter
|
# pyquarantine
|
||||||
A pymilter based sendmail/postfix pre-queue filter with the ability to add, remove and modify e-mail headers.
|
A pymilter based sendmail/postfix pre-queue filter with the ability to add, remove and modify e-mail headers.
|
||||||
The project is currently in beta status, but it is already used in a productive enterprise environment that processes about a million e-mails per month.
|
The project is currently in beta status, but it is already used in a productive enterprise environment that processes about a million e-mails per month.
|
||||||
|
|
||||||
The basic idea is to define rules with conditions and actions which are processed when all conditions are true.
|
The basic idea is to define rules with conditions and actions which are processed when all conditions are true.
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
Pymodmilter is depending on these python packages, but they are installed automatically if you are working with pip.
|
pyquarantine is depending on these python packages, but they are installed automatically if you are working with pip.
|
||||||
* [pymilter](https://pythonhosted.org/pymilter/)
|
* [jsonschema](https://github.com/Julian/jsonschema)
|
||||||
* [netaddr](https://github.com/drkjam/netaddr/)
|
* [pymilter](https://github.com/sdgathman/pymilter)
|
||||||
|
* [netaddr](https://github.com/drkjam/netaddr)
|
||||||
|
* [peewee](https://github.com/coleifer/peewee)
|
||||||
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/)
|
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
* Install pymodmilter with pip and copy the example config file.
|
* Install pyquarantine with pip and copy the example config file.
|
||||||
```sh
|
```sh
|
||||||
pip install pymodmilter
|
pip install pyquarantine
|
||||||
cp /etc/pymodmilter/pymodmilter.conf.example /etc/pymodmilter/pymodmilter.conf
|
cp /etc/pyquarantine/pyquarantine.conf.example /etc/pyquarantine/pyquarantine.conf
|
||||||
```
|
```
|
||||||
* Modify /etc/pymodmilter/pymodmilter.conf according to your needs.
|
* Modify /etc/pyquarantine/pyquarantine.conf according to your needs.
|
||||||
|
|
||||||
## Configuration options
|
## Configuration options
|
||||||
Pymodmilter uses a config file in JSON format. The config file has to be JSON valid with the exception of allowed comment lines starting with **#**. The options are described below.
|
pyquarantine uses a config file in JSON format. The config file has to be JSON valid with the exception of allowed comment lines starting with **#**. The options are described below.
|
||||||
Rules and actions are processed in the given order.
|
Rules and actions are processed in the given order.
|
||||||
|
|
||||||
### Global
|
### Global
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -27,9 +27,9 @@ __all__ = [
|
|||||||
"whitelist",
|
"whitelist",
|
||||||
"ModifyMilter"]
|
"ModifyMilter"]
|
||||||
|
|
||||||
__version__ = "1.2.0"
|
__version__ = "2.0.0"
|
||||||
|
|
||||||
from pymodmilter import _runtime_patches
|
from pyquarantine import _runtime_patches
|
||||||
|
|
||||||
import Milter
|
import Milter
|
||||||
import logging
|
import logging
|
||||||
@@ -44,9 +44,9 @@ from email.policy import SMTPUTF8
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from netaddr import IPNetwork, AddrFormatError
|
from netaddr import IPNetwork, AddrFormatError
|
||||||
|
|
||||||
from pymodmilter.base import CustomLogger, MilterMessage
|
from pyquarantine.base import CustomLogger, MilterMessage
|
||||||
from pymodmilter.base import replace_illegal_chars
|
from pyquarantine.base import replace_illegal_chars
|
||||||
from pymodmilter.rule import Rule
|
from pyquarantine.rule import Rule
|
||||||
|
|
||||||
|
|
||||||
class ModifyMilter(Milter.Base):
|
class ModifyMilter(Milter.Base):
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import encodings
|
import encodings
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = ["Action"]
|
__all__ = ["Action"]
|
||||||
|
|
||||||
from pymodmilter import modify, notify, storage
|
from pyquarantine import modify, notify, storage
|
||||||
from pymodmilter.conditions import Conditions
|
from pyquarantine.conditions import Conditions
|
||||||
|
|
||||||
|
|
||||||
class Action:
|
class Action:
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -20,8 +20,8 @@ import logging.handlers
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pymodmilter.config import get_milter_config
|
from pyquarantine.config import get_milter_config
|
||||||
from pymodmilter import __version__ as version
|
from pyquarantine import __version__ as version
|
||||||
|
|
||||||
|
|
||||||
def _get_quarantine(quarantines, name):
|
def _get_quarantine(quarantines, name):
|
||||||
@@ -316,7 +316,7 @@ def main():
|
|||||||
formatter_class=formatter_class)
|
formatter_class=formatter_class)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c", "--config", help="Config file to read.",
|
"-c", "--config", help="Config file to read.",
|
||||||
default="/etc/pymodmilter/pymodmilter.conf")
|
default="/etc/pyquarantine/pyquarantine.conf")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-d", "--debug",
|
"-d", "--debug",
|
||||||
help="Log debugging messages.",
|
help="Log debugging messages.",
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = ["Conditions"]
|
__all__ = ["Conditions"]
|
||||||
@@ -18,8 +18,8 @@ import logging
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from netaddr import IPAddress, IPNetwork, AddrFormatError
|
from netaddr import IPAddress, IPNetwork, AddrFormatError
|
||||||
from pymodmilter import CustomLogger
|
from pyquarantine import CustomLogger
|
||||||
from pymodmilter.whitelist import DatabaseWhitelist
|
from pyquarantine.whitelist import DatabaseWhitelist
|
||||||
|
|
||||||
|
|
||||||
class Conditions:
|
class Conditions:
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# This is an example /etc/pymodmilter.conf file.
|
# This is an example /etc/pyquarantine/pyquarantine.conf file.
|
||||||
# Copy it into place before use.
|
# Copy it into place before use.
|
||||||
#
|
#
|
||||||
# The file is in JSON format.
|
# The file is in JSON format.
|
||||||
@@ -176,14 +176,14 @@
|
|||||||
# Notes: Path to a file which contains the html representation of the disclaimer.
|
# Notes: Path to a file which contains the html representation of the disclaimer.
|
||||||
# Value: [ FILE_PATH ]
|
# Value: [ FILE_PATH ]
|
||||||
#
|
#
|
||||||
"html_template": "/etc/pymodmilter/templates/disclaimer_html.template",
|
"html_template": "/etc/pyquarantine/templates/disclaimer_html.template",
|
||||||
|
|
||||||
# Option: text_template
|
# Option: text_template
|
||||||
# Type: String
|
# Type: String
|
||||||
# Notes: Path to a file which contains the text representation of the disclaimer.
|
# Notes: Path to a file which contains the text representation of the disclaimer.
|
||||||
# Value: [ FILE_PATH ]
|
# Value: [ FILE_PATH ]
|
||||||
#
|
#
|
||||||
"text_template": "/etc/pymodmilter/templates/disclaimer_text.template",
|
"text_template": "/etc/pyquarantine/templates/disclaimer_text.template",
|
||||||
|
|
||||||
# Option: error_policy
|
# Option: error_policy
|
||||||
# Type: String
|
# Type: String
|
||||||
29
pyquarantine/docs/templates/notification.template
vendored
Normal file
29
pyquarantine/docs/templates/notification.template
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h1>Quarantine notification</h1>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><b>Envelope-From:</b></td>
|
||||||
|
<td>{ENVELOPE_FROM}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>From:</b></td>
|
||||||
|
<td>{FROM}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>Envelope-To:</b></td>
|
||||||
|
<td>{ENVELOPE_TO}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>To:</b></td>
|
||||||
|
<td>{TO}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>Subject:</b></td>
|
||||||
|
<td>{SUBJECT}</td>
|
||||||
|
</tr>
|
||||||
|
</table><br/>
|
||||||
|
<h2>Preview of the original e-mail</h2>
|
||||||
|
{HTML_TEXT}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
pyquarantine/docs/templates/removed.png
vendored
Normal file
BIN
pyquarantine/docs/templates/removed.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# /etc/conf.d/pymodmilter: config file for /etc/init.d/pymodmilter
|
# /etc/conf.d/pyquarantine: config file for /etc/init.d/pyquarantine
|
||||||
|
|
||||||
# Start the daemon as the user. You can optionally append a group name here also.
|
# Start the daemon as the user. You can optionally append a group name here also.
|
||||||
# USER="daemon"
|
# USER="daemon"
|
||||||
# USER="daemon:nobody"
|
# USER="daemon:nobody"
|
||||||
|
|
||||||
# Optional parameters for pymodmilter
|
# Optional parameters for pyquarantine
|
||||||
# MILTER_OPTS=""
|
# MILTER_OPTS=""
|
||||||
@@ -4,7 +4,7 @@ user=${USER:-daemon}
|
|||||||
milter_opts="${MILTER_OPTS:-}"
|
milter_opts="${MILTER_OPTS:-}"
|
||||||
|
|
||||||
pidfile="/run/${RC_SVCNAME}.pid"
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||||||
command="/usr/bin/pymodmilter"
|
command="/usr/bin/pyquarantine-milter"
|
||||||
command_args="${milter_opts}"
|
command_args="${milter_opts}"
|
||||||
command_background=true
|
command_background=true
|
||||||
command_user="${user}"
|
command_user="${user}"
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -30,8 +30,8 @@ from copy import copy
|
|||||||
from email.message import MIMEPart
|
from email.message import MIMEPart
|
||||||
from email.policy import SMTPUTF8
|
from email.policy import SMTPUTF8
|
||||||
|
|
||||||
from pymodmilter import replace_illegal_chars
|
from pyquarantine import replace_illegal_chars
|
||||||
from pymodmilter.base import CustomLogger
|
from pyquarantine.base import CustomLogger
|
||||||
|
|
||||||
|
|
||||||
class AddHeader:
|
class AddHeader:
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -30,8 +30,8 @@ from html import escape
|
|||||||
from os.path import basename
|
from os.path import basename
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from pymodmilter.base import CustomLogger
|
from pyquarantine.base import CustomLogger
|
||||||
from pymodmilter import mailer
|
from pyquarantine import mailer
|
||||||
|
|
||||||
|
|
||||||
class BaseNotification:
|
class BaseNotification:
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = ["Rule"]
|
__all__ = ["Rule"]
|
||||||
|
|
||||||
from pymodmilter.action import Action
|
from pyquarantine.action import Action
|
||||||
from pymodmilter.conditions import Conditions
|
from pyquarantine.conditions import Conditions
|
||||||
|
|
||||||
|
|
||||||
class Rule:
|
class Rule:
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = ["main"]
|
__all__ = ["main"]
|
||||||
@@ -20,25 +20,25 @@ import logging
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from pymodmilter import mailer
|
from pyquarantine import mailer
|
||||||
from pymodmilter import ModifyMilter
|
from pyquarantine import ModifyMilter
|
||||||
from pymodmilter import __version__ as version
|
from pyquarantine import __version__ as version
|
||||||
from pymodmilter.config import get_milter_config
|
from pyquarantine.config import get_milter_config
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
python_version = ".".join([str(v) for v in sys.version_info[0:3]])
|
python_version = ".".join([str(v) for v in sys.version_info[0:3]])
|
||||||
python_version = f"{python_version}-{sys.version_info[3]}"
|
python_version = f"{python_version}-{sys.version_info[3]}"
|
||||||
|
|
||||||
"Run PyMod-Milter."
|
"Run pyquarantine."
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="PyMod milter daemon",
|
description="pyquarantine-milter daemon",
|
||||||
formatter_class=lambda prog: argparse.HelpFormatter(
|
formatter_class=lambda prog: argparse.HelpFormatter(
|
||||||
prog, max_help_position=45, width=140))
|
prog, max_help_position=45, width=140))
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c", "--config", help="Config file to read.",
|
"-c", "--config", help="Config file to read.",
|
||||||
default="/etc/pymodmilter/pymodmilter.conf")
|
default="/etc/pyquarantine/pyquarantine.conf")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
@@ -125,10 +125,10 @@ def main():
|
|||||||
sysloghandler = logging.handlers.SysLogHandler(
|
sysloghandler = logging.handlers.SysLogHandler(
|
||||||
address="/dev/log", facility=logging.handlers.SysLogHandler.LOG_MAIL)
|
address="/dev/log", facility=logging.handlers.SysLogHandler.LOG_MAIL)
|
||||||
sysloghandler.setFormatter(
|
sysloghandler.setFormatter(
|
||||||
logging.Formatter("pymodmilter: %(message)s"))
|
logging.Formatter("pyquarantine: %(message)s"))
|
||||||
root_logger.addHandler(sysloghandler)
|
root_logger.addHandler(sysloghandler)
|
||||||
|
|
||||||
logger.info("pymodmilter starting")
|
logger.info("pyquarantine-milter starting")
|
||||||
|
|
||||||
# register milter factory class
|
# register milter factory class
|
||||||
Milter.factory = ModifyMilter
|
Milter.factory = ModifyMilter
|
||||||
@@ -139,13 +139,13 @@ def main():
|
|||||||
|
|
||||||
rc = 0
|
rc = 0
|
||||||
try:
|
try:
|
||||||
Milter.runmilter("pymodmilter", socketname=socket, timeout=600)
|
Milter.runmilter("pyquarantine", socketname=socket, timeout=600)
|
||||||
except Milter.milter.error as e:
|
except Milter.milter.error as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
rc = 255
|
rc = 255
|
||||||
|
|
||||||
mailer.queue.put(None)
|
mailer.queue.put(None)
|
||||||
logger.info("pymodmilter stopped")
|
logger.info("pyquarantine-milter stopped")
|
||||||
|
|
||||||
sys.exit(rc)
|
sys.exit(rc)
|
||||||
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -27,10 +27,10 @@ from datetime import datetime
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
from time import gmtime
|
from time import gmtime
|
||||||
|
|
||||||
from pymodmilter.base import CustomLogger
|
from pyquarantine.base import CustomLogger
|
||||||
from pymodmilter.conditions import Conditions
|
from pyquarantine.conditions import Conditions
|
||||||
from pymodmilter.config import ActionConfig
|
from pyquarantine.config import ActionConfig
|
||||||
from pymodmilter.notify import Notify
|
from pyquarantine.notify import Notify
|
||||||
|
|
||||||
|
|
||||||
class BaseMailStorage:
|
class BaseMailStorage:
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# PyMod-Milter is free software: you can redistribute it and/or modify
|
# pyquarantine is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# PyMod-Milter is distributed in the hope that it will be useful,
|
# pyquarantine is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with PyMod-Milter. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
version = attr: pymodmilter.__version__
|
version = attr: pyquarantine.__version__
|
||||||
|
|||||||
21
setup.py
21
setup.py
@@ -4,14 +4,14 @@ def read_file(fname):
|
|||||||
with open(fname, 'r') as f:
|
with open(fname, 'r') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
setup(name = "pymodmilter",
|
setup(name = "pyquarantine",
|
||||||
author = "Thomas Oettli",
|
author = "Thomas Oettli",
|
||||||
author_email = "spacefreak@noop.ch",
|
author_email = "spacefreak@noop.ch",
|
||||||
description = "A pymilter based sendmail/postfix pre-queue filter.",
|
description = "A pymilter based sendmail/postfix pre-queue filter.",
|
||||||
license = "GPL 3",
|
license = "GPL 3",
|
||||||
keywords = "header quarantine milter",
|
keywords = "header quarantine milter",
|
||||||
url = "https://github.com/spacefreak86/pymodmilter",
|
url = "https://github.com/spacefreak86/pyquarantine",
|
||||||
packages = ["pymodmilter"],
|
packages = ["pyquarantine"],
|
||||||
long_description = read_file("README.md"),
|
long_description = read_file("README.md"),
|
||||||
long_description_content_type = "text/markdown",
|
long_description_content_type = "text/markdown",
|
||||||
classifiers = [
|
classifiers = [
|
||||||
@@ -28,20 +28,23 @@ setup(name = "pymodmilter",
|
|||||||
include_package_data = True,
|
include_package_data = True,
|
||||||
entry_points = {
|
entry_points = {
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"pymodmilter=pymodmilter.run:main"
|
"pyquarantine-milter=pyquarantine.run:main",
|
||||||
|
"pyquarantine=pyquarantine.run:main",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
data_files = [
|
data_files = [
|
||||||
(
|
(
|
||||||
"/etc/pymodmilter",
|
"/etc/pyquarantine",
|
||||||
[
|
[
|
||||||
"pymodmilter/docs/pymodmilter.conf.example"
|
"pyquarantine/docs/pyquarantine.conf.example"
|
||||||
]
|
]
|
||||||
), (
|
), (
|
||||||
"/etc/pymodmilter/templates",
|
"/etc/pyquarantine/templates",
|
||||||
[
|
[
|
||||||
"pymodmilter/docs/templates/disclaimer_html.template",
|
"pyquarantine/docs/templates/disclaimer_html.template",
|
||||||
"pymodmilter/docs/templates/disclaimer_text.template"
|
"pyquarantine/docs/templates/disclaimer_text.template",
|
||||||
|
"pyquarantine/docs/templates/notification.template",
|
||||||
|
"pyquarantine/docs/templates/removed.png"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import pymodmilter.run
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(
|
|
||||||
pymodmilter.run.main()
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user