X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=9d8f3ce461d043aaf35a197894345657c5e58896;hb=2b68c779de205d3c4e0b6aaafd6445c2b7b1a7c5;hp=bbd264c17b3544364e70b2ad1ed7313f0b901b15;hpb=668a2ea39a23b44f1dfd13c4eaaa6fdca36a7b9d;p=proftpd-cn.git diff --git a/debian/postinst b/debian/postinst index bbd264c..9d8f3ce 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,100 +1,77 @@ #!/bin/sh -# postinst script for proftpd-cn -# -# see: dh_installdeb(1) set -e -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-deconfigure' `in-favour' -# `removing' -# -# 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 +[ "$1" = "configure" ] || exit 0 +[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx # created: 2002-11-15 Bozo Juretic # last update: 2007-05-14 Zoran Dzelajlija -# last update: 2007-10-27 Dinko Korunic +# last update: 2011-04-24 Dinko Korunic -# Source debconf library. -. /usr/share/debconf/confmodule - -# Import CN toolsa +# Load CARNet Tools . /usr/share/carnet-tools/functions.sh +# Load Debconf +#. /usr/share/debconf/confmodule + FTP_CONF=/etc/proftpd/proftpd.conf FTP_TMP=`mktemp /etc/proftpd/proftpd.conf.XXXXXX` FTP_OLD=/var/backups/proftpd.conf.bak -SSL_CERT=/etc/ssl/certs/ftpd-rsa.pem -SSL_KEY=/etc/ssl/certs/ftpd-rsa-key.pem +SSL_CERT=/etc/ssl/certs/ftpd.pem +SSL_KEY=/etc/ssl/private/ftpd.pem # Backup stare konfiguracije cp_backup_conffile $FTP_CONF cp -p $FTP_CONF $FTP_TMP # Onemogucavanje Anonymous ftp pristupa -disable_anonymous() -{ - if grep -qi "^ TLSEngine on + TLSLog /var/log/proftpd/tls.log + TLSProtocol SSLv23 # Are clients required to use FTP over TLS when talking to this server? TLSRequired off @@ -117,69 +94,72 @@ add_tls() TLSRenegotiate required off EOF - fi + fi } # include za slucaj da sistemac nije prihvatio izmjene od Debiana -include_modules() -{ - if [ -f $FTP_TMP ] ; then - if ! egrep -qi "^[[:space:]]*Include.*/etc/proftpd/modules.conf" $FTP_TMP ; then - printf "#\n# Includes required DSO modules. This is mandatory in proftpd 1.3\n#\nInclude\t/etc/proftpd/modules.conf\n\n" >$FTP_TMP.tmp.$$ - cat $FTP_TMP >>$FTP_TMP.tmp.$$ - mv -f $FTP_TMP.tmp.$$ $FTP_TMP - fi +include_modules() { + if [ -f $FTP_TMP ] ; then + if ! egrep -qi "^[[:space:]]*Include.*/etc/proftpd/modules.conf" $FTP_TMP ; then + printf "#\n# Includes required DSO modules. This is mandatory in proftpd 1.3\n#\nInclude\t/etc/proftpd/modules.conf\n\n" >$FTP_TMP.tmp.$$ + cat $FTP_TMP >>$FTP_TMP.tmp.$$ + cp_mv $FTP_TMP.tmp.$$ $FTP_TMP fi + fi } # Generiranje SSL certifikata -make_ssl_cert() -{ - if [ ! -f $SSL_CERT ] ; then - cd $(dirname $SSL_CERT) - echo "CN: Generating SSL certificate ... " - openssl req -new -x509 -days 365 -nodes -out $(basename $SSL_CERT) -keyout $(basename $SSL_KEY) - echo "CN: Self-signed SSL certificate generated in $SSL_CERT." - echo "CN: Please note that the certificate will expire in one year." - fi +make_ssl_cert() { + if [ \( ! -f $SSL_CERT \) -o \( ! -f $SSL_KEY \) ] ; then + echo "CN: Generating SSL certificate... " + HOSTNAME=`hostname -s` + FQDN=`hostname -f` + MAILNAME=`cat /etc/mailname 2> /dev/null || hostname -f` + (openssl req -new -x509 -days 365 -nodes -out $SSL_CERT -keyout $SSL_KEY >/dev/null 2>&1 <