You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the issue with non-root on your readme is because it's always been like that. Here are some things to try:
Not sure there is a universal answer as it will depend on use cases and user permissions.
If your TFTP server program is inside docker (which btw uses namespaces) then you may need a combination of the following.
And also the same or similar settings within the container and give permissions to docker itself. Though docker itself runs as root it is deliberately restricted.
Normally Linux prevents non-root users from runing programs that bind to ports/sockets less than 1024. This is to prevent a non root user on a multi user system from stealing a port, is this could be malicious, e.g. by redirecting login or webpage to a fake terminal or application.
This was before the days of encryption and authentication. These days it's a little more reladed but you need to get under the hood.
To allow an app to bind to a lower port you need to either.
Network namespaces would only be useful in a virtual network, e.g. for a VM
systemd is too complicated to write up here and probably not what you need.
as for the others....
iptables
# something like
sudo iptables -t nat -A PREROUTING -p udp --dport 69 -j REDIRECT --to-ports 6969
/path/to/tftpd.binary -p 6969 [command line args]
Thanks for the tips. Tftpd is already running in port 1069 inside the container, though, with port mapped to 69 on host by docker (see example docker-compose.yml in repo), so I don't think the port is the issue. Can't really remember what problems I was facing, but it's probably related to how tftpd works and assumes it has root privileges (which it drops later).
I think the issue with non-root on your readme is because it's always been like that. Here are some things to try:
Not sure there is a universal answer as it will depend on use cases and user permissions.
If your TFTP server program is inside docker (which btw uses namespaces) then you may need a combination of the following.
And also the same or similar settings within the container and give permissions to docker itself. Though docker itself runs as root it is deliberately restricted.
Normally Linux prevents non-root users from runing programs that bind to ports/sockets less than 1024. This is to prevent a non root user on a multi user system from stealing a port, is this could be malicious, e.g. by redirecting login or webpage to a fake terminal or application.
This was before the days of encryption and authentication. These days it's a little more reladed but you need to get under the hood.
To allow an app to bind to a lower port you need to either.
iptables
though that is not a lot of use if the remote assumes a fixed port and has no means to change it.authbind
systemd
setcap
to tell the OS that you want to do this anyway.sysctl
Network namespaces would only be useful in a virtual network, e.g. for a VM
systemd is too complicated to write up here and probably not what you need.
as for the others....
iptables
# something like sudo iptables -t nat -A PREROUTING -p udp --dport 69 -j REDIRECT --to-ports 6969 /path/to/tftpd.binary -p 6969 [command line args]
wrapper
setcap
sysctl (not to be confused with systemctl)
If it still does not play ball in your use case, then take a look at docker itself.
remember to run docker container with the
--privileged
commanddocker (compose)
The text was updated successfully, but these errors were encountered: