mirror of https://github.com/fail2ban/fail2ban
fixed security hole with world-open umask
parent
02c1a20bf6
commit
fc4531ff45
|
@ -0,0 +1,44 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# postinst script for fail2ban
|
||||||
|
#
|
||||||
|
# see: dh_installdeb(1)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# summary of how this script can be called:
|
||||||
|
# * <postinst> `configure' <most-recently-configured-version>
|
||||||
|
# * <old-postinst> `abort-upgrade' <new version>
|
||||||
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||||
|
# <new-version>
|
||||||
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||||
|
# <failed-install-package> <version> `removing'
|
||||||
|
# <conflicting-package> <version>
|
||||||
|
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||||
|
# the debian-policy package
|
||||||
|
#
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
configure)
|
||||||
|
# To fix the bug in generated by previous version files permissions
|
||||||
|
LOG=/var/log/fail2ban.log
|
||||||
|
[ -f $LOG ] && chmod go-w $LOG
|
||||||
|
;;
|
||||||
|
|
||||||
|
abort-upgrade|abort-remove|abort-deconfigure)
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "postinst called with unknown argument \`$1'" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# dh_installdeb will replace this with shell code automatically
|
||||||
|
# generated by other debhelper scripts.
|
||||||
|
|
||||||
|
#DEBHELPER#
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,9 @@ def createDaemon():
|
||||||
# to do this could make a filesystem unmountable.
|
# to do this could make a filesystem unmountable.
|
||||||
os.chdir("/")
|
os.chdir("/")
|
||||||
# Give the child complete control over permissions.
|
# Give the child complete control over permissions.
|
||||||
os.umask(0)
|
# yoh: BAD BAD BAD IDEA - generated files are writable by everybody
|
||||||
|
# changing to restrictive umask
|
||||||
|
os.umask(0022)
|
||||||
else:
|
else:
|
||||||
os._exit(0) # Exit parent (the first child) of the second child.
|
os._exit(0) # Exit parent (the first child) of the second child.
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue