Archive for May, 2009

How to prevent exim from including the original email in a bounce message

If you want to stop exim from including the orignal message in a bounced email, add this line to the top section of your /etc/exim.conf:

bounce_return_message = false

save, exit and restart exim. This doesn’t stop bounce emails, only the orignal message from being incuded as part of the message.

Force exim to send email from a particular IP

If you need to change the IP that is used to send email out of your system, you can do so by editing your /etc/exim.conf

Change:

remote_smtp:
driver = smtp

To the following below.

remote_smtp:
driver = smtp
interface = IP ADDRESS

Where IP ADDRESS is the IP you want exim to use.

Count the number of connections each IP makes

Use netstat command to calculate and count the number of connections each IP address makes to the server.

netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

SBDavid

The TCP wrappers

The TCP wrappers implements access control through the use of two files, /etc/hosts.allow and /etc/hosts.deny.

Note that the hosts.allow file takes precedence over the hosts.deny file.

A recommended security-strategy is to block all incoming requests by default, but allow specific hosts or networks to connect.

To deny everything by default, add the following line to /etc/hosts.deny:

ALL: ALL

To accept incoming SSH connections from e.g. nodes host1, host2 and host3, add the following line to /etc/hosts.allow:

sshd: host1 host2 host3

To accept incoming SSH connections from all servers from a specific network, add the name of the subnet to /etc/hosts.allow. For example:

sshd: host1 host2 host3 .subnet.host1.com

To accept incoming portmap connections from IP address 192.168.0.1 and subnet 192.168.5, add the following line to /etc/hosts.allow:

portmap: 192.168.0.1 192.168.5.

Using lsof to list all of the TCP and UDP listening sockets.

lsof - list open files

# lsof -i -n | egrep ‘COMMAND|LISTEN|UDP|TCP’
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
avahi-dae 3220 avahi 13u IPv4 7403 UDP *:mdns
avahi-dae 3220 avahi 14u IPv4 7408 UDP *:58607

« Prev - Next »