I need rules that :Block all incoming traffic ( internet > server) but allow outgoing ( server > internet ) and allow local services to run tooOnly accept incoming traffic from ports I want.I also need to this while in a ssh session ( I've been locked before ).The reason I'm asking is because I'm unable to use UFW with my VPS provider... apparently because their kernel / OpenVZ... While I tried to learn the commands by myself that is like learning to use a tool and trying to build a house. And would be really nice if I could have some productivity today instead of spending hours and hours trying to fix this. If someone could help me I would really appreciate.
Block all connections but allow only a few ports with iptables
iptables