Showing posts with label DirectAdmin. Show all posts
Showing posts with label DirectAdmin. Show all posts

Tuesday, January 26, 2016

Outgoing Email Counts For DirectAdmin Users

Replace $user with the system user and it will return a count of outgoing mails, per-user for the current day ($user and $user.bytes in this directory reset at midnight)
cat /etc/virtual/usage/$user.bytes | grep outgoing | awk -F= '{print $4}' | awk -F\& '{print $1}' | sort | uniq -c | sort -n

Find Files Sending SPAM On DirectAdmin Exim Server

This will check your exim_mainlog and dump the paths from which mail has been sent along with the number. Check the listed directory for malware, shells, etc:
grep cwd /var/log/exim/mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n

Tuesday, October 29, 2013

Wednesday, October 23, 2013

Debugging DirectAdmin Cronjobs

/usr/local/directadmin/dataskq d2000
tail -f /var/log/directadmin/system.log

Update Used Diskspace Quota For One User In DirectAdmin

echo "action=quotatally&value=[username]&type=user" >> /usr/local/directadmin/data/task.queue

Thursday, January 31, 2013

Find All Catch-All Emails On DirectAdmin

find /etc/virtual -name "aliases" -exec grep -H "*: " {} \; | grep -v "fail" | grep -v "blackhole"

List Reseller Accounts On Directadmin

cd /usr/local/directadmin/data
grep -H "usertype=reseller" users/*/user.conf | cut -d/ -f2

Thursday, November 15, 2012

Reset Bandwidth Usage For A Single User In DirectAdmin

From the CLI:
echo 'action=reset&value=USERNAME&type=user' >> /usr/local/directadmin/data/task.queue
echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue

Wednesday, November 7, 2012

Tuesday, October 30, 2012

Securing /tmp And /var/tmp On DirectAdmin With SecureTmp

This presumes you are using a fresh server with no valuable contents in /tmp or /var/tmp. This still applies even if you do, just make a backup of the directory contents so it can be restored after.

This will give you ~2.1GB of /tmp and /var/tmp
dd if=/dev/zero of=/var/varTmp bs=1024 count=2048000
dd if=/dev/zero of=/var/Tmp bs=1024 count=2048000
/sbin/mkfs -t ext3 /var/varTmp
/sbin/mkfs -t ext3 /var/Tmp
mount -o loop,noexec,nosuid,rw /var/Tmp /tmp
mount -o loop,noexec,nosuid,rw /var/varTmp /var/tmp
chmod 0777 /tmp
chmod +t /tmp
chmod 0777 /var/tmp
chmod +t /var/tmp

Add to /etc/fstab:
/var/Tmp        /tmp            ext3    loop,noexec,nosuid,rw   0       0
/var/varTmp     /var/tmp        ext3    loop,noexec,nosuid,rw   0       0

You may want to reboot =)

Friday, October 19, 2012

Fixing MySQL Management Timeout In DirectAdmin

This is due to DirectAdmin calculating the size of the assigned databases on the fly to inform the user. Users with large databases are negatively affected by this and as such this "feature" should be limited or removed via the following.

Edit:
/usr/local/directadmin/conf/directadmin.conf
Show_db_usage = 0
You can also set this value to the maximum number of tables it will read before giving up.

Thursday, May 3, 2012

Enable suPHP On DirectAdmin

cd /usr/local/directadmin/custombuild
./build update
./build set suphp yes
./build clean
./build php d
./build rewrite_confs