X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=68f0916d34ed38034af6de0aad4b1a81509943dc;hb=8747a962419cb9331aa00df7ce631d835577b2dd;hp=a192ddcdb52ce0a9dd57cea299f64e57839606bb;hpb=7e6002ef77007d098c7e90ec060150f0a3eed71e;p=bacula-cn.git diff --git a/debian/postinst b/debian/postinst index a192ddc..68f0916 100644 --- a/debian/postinst +++ b/debian/postinst @@ -169,11 +169,15 @@ restart_bacula() { fi } +random_string() { + head -n 20 /dev/urandom | openssl dgst -sha1 | sed 's/^.* //' +} + send_mail() { REQUEST_FILE=/etc/bacula/bacula-fd.txt GPG_HOME=/var/lib/bacula-cn/gpg - BOUNDARY=$( head -20 /dev/urandom | openssl dgst -sha1 ) + BOUNDARY=$( random_string ) GPG="gpg --homedir $GPG_HOME --batch --encrypt --armour --recipient rt@tt.carnet.hr --always-trust" if [ -z "$CONFIG_CHANGED" ]; then @@ -214,7 +218,21 @@ Content-Disposition: inline; filename="df.txt.gpg" EOF - df -h | $GPG >> $REQUEST_FILE + df -h | $GPG >> $REQUEST_FILE + +# attachment: database sizes +if [ -d /var/lib/mysql -o -d /var/lib/postgresql ]; then + cat >> $REQUEST_FILE </dev/null \ + | $GPG >> $REQUEST_FILE +fi # attachment: client config cat >> $REQUEST_FILE </dev/null`" ]; then echo Mailing request from $REQUEST_FILE - if sendmail -t -oi < $REQUEST_FILE; then + if sendmail -t -oi -f "$EMAIL" < $REQUEST_FILE; then requestsent=1 fi fi @@ -294,9 +314,11 @@ load_config() { db_get bacula-cn/contact CONTACT=$RET + EMAIL=${CONTACT#*<} + EMAIL=${EMAIL%>*} - PASS_FD=$( head -20 /dev/urandom | openssl dgst -sha1 ) - PASS_BCONSOLE=$( head -20 /dev/urandom | openssl dgst -sha1 ) + PASS_FD=$( random_string ) + PASS_BCONSOLE=$( random_string ) DATE=$( date '+%Y-%m-%d' )