Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| abba014c5c | |||
| 807b1391b2 | |||
| dcb781c365 | |||
| 577a971f1a | |||
| 59296be0cf | |||
| 4e1fa3c8ff | |||
| 99899062bb |
@@ -1,3 +1,13 @@
|
|||||||
|
1.1.4 2019-11-22
|
||||||
|
- Make error logging more explicit to aid debugging
|
||||||
|
- Delete own_socketfile to resolve race condition where the permissions
|
||||||
|
change fails on a Unix socket because it hasn't been created yet (libmilter
|
||||||
|
will do this correctly on its own based on umask, the milter doesn't need
|
||||||
|
to do it) (LP: #1849712)
|
||||||
|
|
||||||
|
1.1.3 2019-10-06
|
||||||
|
- Fix sysv init so it works (LP: #1839487)
|
||||||
|
|
||||||
1.1.2 2019-09-23
|
1.1.2 2019-09-23
|
||||||
- Fix variable initialization so mailformed mails missing body From do not
|
- Fix variable initialization so mailformed mails missing body From do not
|
||||||
cause a traceback (LP: #1844161)
|
cause a traceback (LP: #1844161)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ an C compiler. Alternately, install these dependencies from distribution/OS
|
|||||||
packages and then pip install dkimpy_milter.
|
packages and then pip install dkimpy_milter.
|
||||||
|
|
||||||
The milter will work with either py3dns (DNS) or dnspython (dns), preferring
|
The milter will work with either py3dns (DNS) or dnspython (dns), preferring
|
||||||
dnspython is both are available. The dkimpy DKIM module also works with
|
dnspython if both are available. The dkimpy DKIM module also works with
|
||||||
either.
|
either.
|
||||||
|
|
||||||
|
|
||||||
@@ -84,9 +84,8 @@ MTA INTEGRATION
|
|||||||
|
|
||||||
Both a systemd unit file and a sysv init file are provided. Both make
|
Both a systemd unit file and a sysv init file are provided. Both make
|
||||||
assumptions about defaults being used, e.g. if a non-standard pidfile name is
|
assumptions about defaults being used, e.g. if a non-standard pidfile name is
|
||||||
used, they will need to be updated. The sysv init file is Debian specific and
|
used, they will need to be updated. The sysv init file uses start-stop-deamon
|
||||||
untested, since the developers are not using sysv init. Feedback/patches
|
from Debian. It is not portable to systems without that available.
|
||||||
welcome.
|
|
||||||
|
|
||||||
The dkimpy-milter drops priviledges after setup to the user/group specified in
|
The dkimpy-milter drops priviledges after setup to the user/group specified in
|
||||||
UserID. During initial setup, this system user needs to be manually created.
|
UserID. During initial setup, this system user needs to be manually created.
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ from dkimpy_milter.util import drop_privileges
|
|||||||
from dkimpy_milter.util import setExceptHook
|
from dkimpy_milter.util import setExceptHook
|
||||||
from dkimpy_milter.util import write_pid
|
from dkimpy_milter.util import write_pid
|
||||||
from dkimpy_milter.util import read_keyfile
|
from dkimpy_milter.util import read_keyfile
|
||||||
from dkimpy_milter.util import own_socketfile
|
|
||||||
from dkimpy_milter.util import fold
|
from dkimpy_milter.util import fold
|
||||||
|
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.0.1"
|
||||||
@@ -293,7 +292,7 @@ class dkimMilter(Milter.Base):
|
|||||||
except Exception as x:
|
except Exception as x:
|
||||||
self.dkim_comment = str(x)
|
self.dkim_comment = str(x)
|
||||||
if milterconfig.get('Syslog'):
|
if milterconfig.get('Syslog'):
|
||||||
syslog.syslog("check_dkim: {0}".format(x))
|
syslog.syslog("check_dkim: Internal program fault while verifying: {0}".format(x))
|
||||||
try:
|
try:
|
||||||
# i= is optional and dkimpy is fine if it's not provided
|
# i= is optional and dkimpy is fine if it's not provided
|
||||||
self.header_i = codecs.decode(d.signature_fields.get(b'i'), 'ascii')
|
self.header_i = codecs.decode(d.signature_fields.get(b'i'), 'ascii')
|
||||||
@@ -305,7 +304,7 @@ class dkimMilter(Milter.Base):
|
|||||||
except Exception as x:
|
except Exception as x:
|
||||||
self.dkim_comment = str(x)
|
self.dkim_comment = str(x)
|
||||||
if milterconfig.get('Syslog'):
|
if milterconfig.get('Syslog'):
|
||||||
syslog.syslog("check_dkim: {0}".format(x))
|
syslog.syslog("check_dkim: Internal proram fuault extracting header a or d: {0}".format(x))
|
||||||
self.header_d = None
|
self.header_d = None
|
||||||
if not self.header_a:
|
if not self.header_a:
|
||||||
self.header_a = 'rsa-sha256'
|
self.header_a = 'rsa-sha256'
|
||||||
@@ -401,7 +400,6 @@ def main():
|
|||||||
socketname = 'fd:3'
|
socketname = 'fd:3'
|
||||||
if socketname is None:
|
if socketname is None:
|
||||||
socketname = 'local:/var/run/dkimpy-milter/dkimpy-milter.sock'
|
socketname = 'local:/var/run/dkimpy-milter/dkimpy-milter.sock'
|
||||||
own_socketfile(milterconfig, socketname)
|
|
||||||
drop_privileges(milterconfig)
|
drop_privileges(milterconfig)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if milterconfig.get('Syslog'):
|
if milterconfig.get('Syslog'):
|
||||||
|
|||||||
@@ -149,27 +149,6 @@ def write_pid(milterconfig):
|
|||||||
return pid
|
return pid
|
||||||
|
|
||||||
|
|
||||||
def own_socketfile(milterconfig, sockname=None):
|
|
||||||
"""If socket is Unix socket, chown to UserID before dropping privileges"""
|
|
||||||
import os
|
|
||||||
user, group = user_group(milterconfig.get('UserID'))
|
|
||||||
offset = None
|
|
||||||
if sockname is None:
|
|
||||||
sockname = milterconfig.get('Socket')
|
|
||||||
if sockname is None:
|
|
||||||
return
|
|
||||||
if sockname[:1] == '/':
|
|
||||||
offset = 0
|
|
||||||
elif sockname[:6] == "local:":
|
|
||||||
offset = 6
|
|
||||||
elif sockname[:5] == "unix:":
|
|
||||||
offset = 5
|
|
||||||
|
|
||||||
if offset is not None:
|
|
||||||
if os.path.exists(sockname[offset:]):
|
|
||||||
os.chown(sockname[offset:], user, group)
|
|
||||||
|
|
||||||
|
|
||||||
def read_keyfile(milterconfig, keytype):
|
def read_keyfile(milterconfig, keytype):
|
||||||
"""Read private key from file."""
|
"""Read private key from file."""
|
||||||
import syslog
|
import syslog
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ except ImportError: # If PyDNS is not installed, prefer dnspython
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='dkimpy-milter',
|
name='dkimpy-milter',
|
||||||
version='1.1.2',
|
version='1.1.4',
|
||||||
author='Scott Kitterman',
|
author='Scott Kitterman',
|
||||||
author_email='scott@kitterman.com',
|
author_email='scott@kitterman.com',
|
||||||
url='https://launchpad.net/dkimpy-milter',
|
url='https://launchpad.net/dkimpy-milter',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
prefix="/usr/local"
|
prefix="/usr/local"
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
sysconfdir="/etc/dkimpy-milter"
|
sysconfdir="/usr/local/etc"
|
||||||
bindir="${exec_prefix}/bin/"
|
bindir="${exec_prefix}/bin/"
|
||||||
RUNDIR="/run/dkimpy-milter"
|
RUNDIR="/run/dkimpy-milter"
|
||||||
DAEMON=${bindir}/dkimpy-milter
|
DAEMON=${bindir}/dkimpy-milter
|
||||||
@@ -67,14 +67,14 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
start-stop-daemon --start --background --quiet --pidfile \
|
||||||
start-stop-daemon --start --quiet --pidfile $RUNDIR/$NAME.pid --startas \
|
$RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf
|
||||||
$DAEMON $sysconfdir/$NAME.conf --name $NAME --test > /dev/null \
|
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Stopping $DESC: "
|
echo -n "Stopping $DESC: "
|
||||||
if [ -f $RUNDIR/$NAME.pid ]; then
|
if [ -f $RUNDIR/$NAME.pid ]; then
|
||||||
|
chown root:root $RUNDIR/$NAME.pid
|
||||||
start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid
|
start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid
|
||||||
rm $RUNDIR/$NAME.pid
|
rm $RUNDIR/$NAME.pid
|
||||||
#echo $SOCKET
|
#echo $SOCKET
|
||||||
@@ -87,6 +87,7 @@ case "$1" in
|
|||||||
force-reload)
|
force-reload)
|
||||||
echo -n "Force reloading $DESC: "
|
echo -n "Force reloading $DESC: "
|
||||||
if [ -f $RUNDIR/$NAME.pid ]; then
|
if [ -f $RUNDIR/$NAME.pid ]; then
|
||||||
|
chown root:root $RUNDIR/$NAME.pid
|
||||||
start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid
|
start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid
|
||||||
rm $RUNDIR/$NAME.pid
|
rm $RUNDIR/$NAME.pid
|
||||||
#echo $SOCKET
|
#echo $SOCKET
|
||||||
@@ -95,7 +96,7 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
start-stop-daemon --start --chuid $USER --background --quiet --pidfile \
|
start-stop-daemon --start --background --quiet --pidfile \
|
||||||
$RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf
|
$RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
@@ -103,6 +104,7 @@ case "$1" in
|
|||||||
echo "Restarting $DESC: "
|
echo "Restarting $DESC: "
|
||||||
echo -n "Stopping $DESC: "
|
echo -n "Stopping $DESC: "
|
||||||
if [ -f $RUNDIR/$NAME.pid ]; then
|
if [ -f $RUNDIR/$NAME.pid ]; then
|
||||||
|
chown root:root $RUNDIR/$NAME.pid
|
||||||
start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid
|
start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid
|
||||||
rm $RUNDIR/$NAME.pid
|
rm $RUNDIR/$NAME.pid
|
||||||
#echo $SOCKET
|
#echo $SOCKET
|
||||||
@@ -113,7 +115,7 @@ case "$1" in
|
|||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -n "Starting $DESC: "
|
echo -n "Starting $DESC: "
|
||||||
start-stop-daemon --start --chuid $USER --background --quiet --pidfile \
|
start-stop-daemon --start --background --quiet --pidfile \
|
||||||
$RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf
|
$RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user