-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config settings for sockets permissions and some minor fixes. #12
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,6 @@ | |
# Description: another spam-defense service | ||
### END INIT INFO | ||
|
||
|
||
|
||
# Based on skeleton by Miquel van Smoorenburg and Ian Murdock | ||
|
||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin | ||
|
@@ -25,8 +23,7 @@ DESC="Rmilter Mail Filter Daemon" | |
PIDFILE="/var/run/$NAME.pid" | ||
PNAME="rmilter" | ||
USER="rmilter" | ||
SOCKET=/var/lib/rmilter/rmilter.sock | ||
|
||
SOCKET=/var/spool/postfix/rmilter/rmilter.sock | ||
|
||
[ -x $DAEMON ] || DAEMON=/usr/sbin/rmilter | ||
[ -x $DAEMON ] || exit 0 | ||
|
@@ -68,7 +65,7 @@ set -e | |
case "$1" in | ||
start) | ||
echo -n "Starting $DESC: " | ||
rm -f /var/lib/rmilter/rmilter.sock | ||
rm -f $SOCKET | ||
start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \ | ||
--chuid $USER --name $PNAME $NICE --oknodo --startas $DAEMON -- \ | ||
$OPTIONS $DOPTIONS | ||
|
@@ -78,27 +75,15 @@ case "$1" in | |
stop) | ||
echo -n "Stopping $DESC: " | ||
start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME --oknodo | ||
rm -f /var/lib/rmilter/rmilter.sock | ||
echo "$NAME." | ||
;; | ||
|
||
restart|force-reload) | ||
echo -n "Restarting $DESC: " | ||
start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME \ | ||
--retry 5 --oknodo | ||
rm -f /var/lib/rmilter/rmilter.sock | ||
start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \ | ||
--chuid $USER --name $PNAME $NICE --oknodo --startas $DAEMON -- \ | ||
$OPTIONS $DOPTIONS | ||
|
||
rm -f $SOCKET | ||
echo "$NAME." | ||
;; | ||
|
||
reload) | ||
restart|reload|force-reload) | ||
echo -n "Restarting $DESC: " | ||
start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME \ | ||
--retry 5 --oknodo | ||
rm -f /var/lib/rmilter/rmilter.sock | ||
rm -f $SOCKET | ||
start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \ | ||
--chuid $USER --name $PNAME $NICE --oknodo --startas $DAEMON -- \ | ||
$OPTIONS $DOPTIONS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, both old and new versions are wrong. Rmilter supports graceful reload without a requirement to perform the full restart (implemented by handling |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,12 +252,9 @@ main(int argc, char *argv[]) | |
srand (time (NULL)); | ||
#endif | ||
|
||
/* | ||
* Hack to set milter unix socket permissions, but it also affect | ||
* temporary file too :( temporary directory shuld be owned by user | ||
* rmilter-clam and have permissions 700 | ||
*/ | ||
umask(0007); | ||
/* Set unix socket permissions if specified in config */ | ||
if (cfg->sock_cred_mode) | ||
umask(0777 & ~cfg->sock_cred_mode); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem with this code is that a user may specify insecure attributes for temporary files. Nevertheless, I don't know indeed what to do with brain-damaged libmilter that has absolutely fucked API... |
||
|
||
smfi_setconn(cfg->sock_cred); | ||
if (smfi_register(smfilter) == MI_FAILURE) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a wrong path actually. The problem is that rmilter is not intended to run with Postfix MTA only, therefore it should create socket into some other path. The proper solution is to read from /etc/defaults/rmilter the name of the socket and use it in the init script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to override any variable, because bellow occured that line:
test -f /etc/default/rmilter && . /etc/default/rmilter