- optimizacija confa
[php-suhosin-cn.git] / debian / postinst
diff --git a/debian/postinst b/debian/postinst
new file mode 100755 (executable)
index 0000000..2fccdb0
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+# postinst script for proftpd-cn
+#
+# 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|reconfigure)
+      # continue below
+    ;;
+
+    *)
+        exit 0
+    ;;
+esac
+
+# Import CN toolsa
+. /usr/share/carnet-tools/functions.sh
+
+CONF=/etc/php5/conf.d/suhosin.ini
+
+if [ -e "$CONF" ]; then
+    echo "CN: Enabling Suhosin tuneups"    
+    cp -a "$CONF" "$CONF.$$"
+    cp-update --comment ';' php-suhosin-cn "$CONF.$$" <<EOF
+suhosin.cookie.max_name_length=1024
+suhosin.cookie.max_vars=1024
+suhosin.get.max_array_depth=1024
+suhosin.get.max_name_length=1024
+suhosin.get.max_value_length=307200
+suhosin.get.max_vars=1024
+suhosin.post.max_array_depth=1024
+suhosin.post.max_name_length=1024
+suhosin.post.max_value_length=307200
+suhosin.post.max_vars=1024
+suhosin.request.max_array_depth=1024
+suhosin.request.max_value_length=307200
+suhosin.request.max_varname_length=1024
+suhosin.request.max_vars=1024
+EOF
+       cp_mv "$CONF.$$" "$CONF"
+fi
+
+# reload Apache
+if apache2ctl configtest 2>/dev/null; then
+    echo "CN: Reloading Apache..."
+    invoke-rc.d apache2 force-reload || true
+else
+    echo "CN: Your Apache2 configuration is either broken or nonexistant"
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0