#!/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 # created: 2002-11-15 Bozo Juretic # last update: 2007-05-14 Zoran Dzelajlija # last update: 2007-10-27 Dinko Korunic # Source debconf library. . /usr/share/debconf/confmodule # Import CN toolsa . /usr/share/carnet-tools/functions.sh 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.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 # Are clients required to use FTP over TLS when talking to this server? TLSRequired off # Server's certificate TLSRSACertificateFile $SSL_CERT TLSRSACertificateKeyFile $SSL_KEY # CA the server trusts #TLSCACertificateFile /etc/ftpd/root.cert.pem # Authenticate clients that want to use FTP over TLS? TLSVerifyClient off # Allow SSL/TLS renegotiations when the client requests them, but # do not force the renegotations. Some clients do not support # SSL/TLS renegotiations; when mod_tls forces a renegotiation, these # clients will close the data connection, or there will be a timeout # on an idle data connection. TLSRenegotiate required off EOF 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.$$ cp_mv $FTP_TMP.tmp.$$ $FTP_TMP fi fi } # Generiranje SSL certifikata 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 <