fixed security hole with world-open umask

debian-releases/etch
Yaroslav Halchenko 2005-07-08 05:05:49 +00:00
parent 02c1a20bf6
commit fc4531ff45
2 changed files with 47 additions and 1 deletions

44
debian/postinst vendored Executable file
View File

@ -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

View File

@ -129,7 +129,9 @@ def createDaemon():
# to do this could make a filesystem unmountable.
os.chdir("/")
# 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:
os._exit(0) # Exit parent (the first child) of the second child.
else: