Port 22
Port 80
Much cleaner than iptables magic; though I have done similar iptables redirects before it is almost always a bad idea. :) Port 22
Port 80
Much cleaner than iptables magic; though I have done similar iptables redirects before it is almost always a bad idea. :)You could also do it in the load balancer/router.
setcap 'cap_net_bind_service=+ep' /path/to/executable
Now, the process doesn't need to start as root and drop privs.The reason privileged ports require root is so that they cannot be easily intercepted by userland processes.
The entire reason for the root requirement is this; it's expected that after your port assignment you drop your privileges to a lesser user. But requiring root to bind is a feature, not a bug.
If you do not have this then intentionally crashing the process for a user and rebinding the port as a standard user (even `nobody`) is possible.
This means if you break into someones mail server and run as the mail user, you would be able to bind ssh ports (if they are not privileged ports <1024).
Of course your mail server should be running as the `mail` user or some equivelent, because only the binding of the ports should be done on startup as root and then it should drop into the mail user.
Security is an onion.
None of this was new stuff back then. It just wasn’t well blogged (in fact it was so poorly written about that my very first blog post was on exactly this topic. Blog is long gone now though). However if anyone took the time to read the man pages, you’d see all the functionality is already backed into openssh
https://serverfault.com/questions/284566/configuration-for-m...
just idle speculation.
I'm pretty sure "Port" worked with older ssh servers, maybe. openssh was only 4 years old 20 years ago.
EDIT: hmmm what about needing privileges or an selinux config change?
Hell even in current year I occasionally come across guides that suggest disabling it... great way to get ctrl-w'd smh