maketank-scripts from ansible
This commit is contained in:
16
roles/mkt-scripts/files/dovecot/dovecot-generate-passdb.rb
Executable file
16
roles/mkt-scripts/files/dovecot/dovecot-generate-passdb.rb
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require 'csv'
|
||||
|
||||
csv = %x{echo "SELECT CONCAT_WS(':',mail_users.email,password_enc,uid, gid,homedir,maildir, (quota)) FROM mail_users JOIN panel_customers ON mail_users.customerid=panel_customers.customerid WHERE panel_customers.deactivated = 0" | mysql --skip-ssl -N -umaketank -pknatekam2007 -h 10.201.0.4 maketank_froxlor}.chomp
|
||||
if $?.exitstatus == 0
|
||||
users = File.open('/etc/dovecot/users','w')
|
||||
CSV.parse (csv) { |row|
|
||||
ra = row[0].split(':')
|
||||
mdir = ra[5].split('/')
|
||||
hdir = ra[4]+mdir[0]
|
||||
users.write( ra[0]+":{CRYPT}"+ra[1]+":"+ra[2]+":"+ra[3]+"::"+ra[4]+"::userdb_mail_driver=mdbox userdb_mail_path="+ra[4]+ra[5]+" userdb_quota_storage_size="+ra[6]+"M\n")
|
||||
}
|
||||
users.close unless users.nil?
|
||||
end
|
||||
|
||||
3
roles/mkt-scripts/files/dovecot/healthcheck.sh
Executable file
3
roles/mkt-scripts/files/dovecot/healthcheck.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
21
roles/mkt-scripts/files/dovecot/quota-warning.sh
Executable file
21
roles/mkt-scripts/files/dovecot/quota-warning.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
PERCENT=$1
|
||||
FROM="postmaster@maketank.net"
|
||||
|
||||
msg="From: $FROM
|
||||
To: $USER
|
||||
To: postmaster@maketank.net
|
||||
Subject: Your email quota is $PERCENT% full
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
|
||||
Your mailbox is now $PERCENT% full.
|
||||
Please free up some space, or increase the quota settings for this account.
|
||||
|
||||
Regards,
|
||||
your IMAP-Mailbox.
|
||||
"
|
||||
|
||||
echo "$msg" | /usr/sbin/sendmail -f $FROM "$USER"
|
||||
|
||||
exit 0
|
||||
32
roles/mkt-scripts/files/dovecot/upload_spam_ham.sh
Executable file
32
roles/mkt-scripts/files/dovecot/upload_spam_ham.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SWIFT="swift -A http://kvm01.int.lan:7480/auth/v2.0 -U mx:spam -K o99CuKcfmj31i2UumqB3h8Fh1K0T2bFBO2snbYpk"
|
||||
|
||||
BDIR="/var/spool/vmail_imapsieve_copy"
|
||||
|
||||
#run only if there is stuff in the dir
|
||||
|
||||
SIZE=$(du -sb ${BDIR} |cut -f1)
|
||||
[[ ${SIZE} -lt 12289 ]] && exit 0
|
||||
|
||||
cd $BDIR
|
||||
|
||||
remove_files () {
|
||||
if [[ $2 -eq 0 ]]; then
|
||||
rm -f $1/*
|
||||
fi
|
||||
}
|
||||
|
||||
#we have data, upload
|
||||
ls ham/*.eml 1>/dev/null 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
${SWIFT} upload mailing ham
|
||||
remove_files ham $?
|
||||
fi
|
||||
ls spam/*.eml 1>/dev/null 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
${SWIFT} upload mailing spam
|
||||
remove_files spam $?
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user