Network bind to port below 1024

I would like to listen and send on port 67. How can I make my flatpak ask for the root password to do this or how can I package a flatpak that can be run in this way?

This might be a general question: If I would like to create a HTTP or FTP server, how would I go about this?


I will have a look…
… It seems that not even Wireshark is able to do the trick: GitHub - flathub/org.wireshark.Wireshark

What can be done so that an application can open ports like 80 for HTTP, 67 for DHCP and so on?

It seems to be possible to run the app as root when the app is installed as root.

sudo -i flatpak install -y "`pwd`/$id.flatpak"
sudo -i flatpak run "$id"

However, then the persistet directories cannot be accessed during runtime.

you can’t. If you require uid 0 then flatpak isn’t the way to go.

I do not require root rights if I can just bind to port 67. Is there a way that flatpak has specific permissions for specific ports? Docker for example allows exposing certain ports.

Docker run as root.

Binding a privileged ip port require uid 0. You can not setcap either, and even then it wouldn’t work as it is python.