I have OpenVPN configured on a Centos server and client can connect via OpenVPN client from their Windows box on port 1194. Clients get the gateway 10.0.8.1.
The problem is clients' boxes have viruses on their system and they are sending spam via my OpenVPN server; I just want to block port 25 for my clients.
I added the following rule in my iptables, which allows all traffic and drops port 25.
iptables -t nat -A PREROUTING -p tcp --dport 25 -j DROP
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
eth0
is the interface of the OpenVPN server.
But still it is sending spam.
Can anybody suggest how can I block the emails from my OpenVPN client machines?
You need to block the source port not the destination port lie so.
$VPN
is the interface that the VPN server is routing its traffic on.Try to filter using the FORWARD table:
Also, if you are running SMTP on your server, you may need to block access to it:
Assuming OpenVPN is using the default 10.8.0.0/24 IP address range, of course.