Postfix email sandbox

Here an easy way to set up an email sandbox in Linux. All email sent from the server will be forwarded to an external email address.

1. Install postfix with pcre support.

apt-get install postfix postfix-pcre

2. Create the file /etc/postfix/virtual with the following line it (replace user@example.com with the email address that should receive all email).

/.*@.*/ user@example.com

3. edit /etc/postfix/main.cf and add the following line at the end

virtual_alias_maps = pcre:/etc/postfix/virtual

4. Restart postfix.

 

 

 

Limit an Ansible Playbook to a single host

Often when you start implementing something new you want to test your playbook on a single instance.  If your Ansible hosts file looks like this

[aws]
host1
host2

and you only want to run your playbook on host1, add the –limit paramter:

ansible-playbook –limit host1 playbook.yml

 

overflow tmp folder on aws

When you receive an error message like

scp: writing /tmp/mkinitramfs_Y2BgCE/ [..] : No space left on device

check how big your tmp folder is. If it looks like

overflow        1.0M  1.0M     0 100% /tmp

your volume was probably full at a time. After you allocated new disk space umount your volume with

umount /tmp

If you receive the error “umount: /tmp: device is busy.” run “lsof /tmp/” to see what is using it.

After umounting /tmp your system should work fine again. You can prevent /tmp from reappearing after a restart with

echo 'MINTMPKB=0' > /etc/default/mountoverflowtmp

 

How to run a VMware image in Virtualbox

Having just downloaded Kali Linux I was wondering how to convert its VMware image to VirtualBox, thankfully I quickly found a page that just recommended to create a new virtual machine and add the VMware image as a disk: http://opendirective.net/blog/2014/07/on-converting-a-vm-from-vmware-to-virtualbox/

So if you want to run Kali Linux in Virtualbox, just

a) Create a new virtual machine in VirtualBox
b) Slect ‘Use an existing virtual hard drive file’ and select the Kali-Linux image (e.g. Kali-Linux-1.1.0-vm-amd64, the one without -s00x in the name)

By they way, the default login for Kali Linux is root / toor

 

Turn on SNMP in Asuswrt-Merlin

Asus routers like the RT-N66U have support for SNMP in the latest firmware. Here is how to enable and test it (here using the awesome Asuswrt-merlin alternative firmware ).

Go To Administration and click on SNMP. Enable SNMP, enter a system name, system location, SNMP Get Community (just any text, this acts like a password). Click on Apply to activate the changes.

asus-snmp-settings

To test if SNMP is working you can use the snmpwalk command. If your router IP address is 192.168.1.1 and your SNMP Get Community string is ‘public’, run

snmpwalk -Os -c public -v2c 192.168.1.1 iso.3.6.1.2.1.1.1

The output should look like “iso.3.6.1.2.1.1.1.0 = STRING: “Linux RT-N66U 2.6.22.19 #1 Thu Nov 20 13:57:15 EST 2014 mips” if SNMP is working. If it is not working you will receive a message like “Timeout: No Response from 192.168.1.1”.

To get more data from SNMP run ‘snmpwalk -Os -c public -v2c 192.168.1.1’