* Since the docker0 is a private network by default we can be
more accepting like the LAN is by default
Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
* The default server is the default switch so that
queries will go through the hosts dnsmasq by default
Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
* Moved logic out of config writing
* Made default config only specify OpenWrt dictated defaults
Otherwise, docker defaults can be assumed
Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
Dockerd start too early will conflict with other net config.
After boot must manually restart dockerd, Or some container will not run.
Signed-off-by: Yuhang Qin <qinyuhangxiaoxiang@gmail.com>
The source is being deprecated and split into the CLI and engine/daemon
repositories, So `docker-ce` will now be the `dockerd` and a separate
package will be made for the `docker` CLI.
Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
This is a convenience argument to primarily facilitate outbound wan
connections from a docker container. However, all docker containers
can't bidirectionally communicate with the internet by default.
Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
Deleting rules that docker has created is error-prone, because with
every update docker we have to check if anything has changed.
Cleaning up the firewall rules is part of the docker and should and must be
cleaned up and handeled by them when the service is terminated.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
If docker-ce handles the firewall and fw3 is not envolved because the
rules get not proceed, then not only docker0 should be handled but also
other interfaces and therefore other docker networks.
This commit extends the handling and introduces a new uci option
`device` in the docker config firewall section. This can be used to specify
which device is allowed to access the container. Up to now only docker0
is covert.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
As the protocol is set to none, this makes no sense here, as it cannot
be controlled and thus processed by the netifd.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Openwrt has a own firewall service called fw3, that supports firewall zones.
Docker can bypass the handling of the zone rules in openwrt via custom
tables. These are "always" processed before the openwrt firewall.
Which is prone to errors!
Since not everyone is aware that the firewall of openwrt will
not be passed. And this is a security problem because a mapped port is
visible on all interfaces and so also on the WAN side.
If the firewall handling in docker is switched off, then the port in
fw3 must be explicitly released and it cannot happen that the
port is accidentally exported to the outside world via the interfaces on
the WAN zone.
So all rules for the containers should and so must be made in fw3.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Up to now only the docker0 interface and bridge is created by default.
In order to create other interfaces and to integrate them into the
openwrt these functions can now be called with arguments.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* blocked_interfaces blocks all packets to docker0 from the given
interface. This is needed because all the iptables commands dockerd
adds operate before any of the fw3 generated rules.
Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
This commit adds two additional init.d targets:
* uciadd:
This command adds the default docker0 bridge to the network
configuration. Additional, a new firewall zone docker is created
* ucidel
This command removes default docker0 bridge from the network
configuration. The new docker firewall zone gets also deleted.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
If the uci configuration is changed send dockerd a SIGHUP to reload the
generated daemon.json file with the new configuration.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Until now, the firewall rules from the dockerd were preserved after the
service was stopped. This is not nice. With this change the firewall rules
created by dockerd will be deleted when the dockerd service is stopped.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
When we run docker image and export too many ports, dockerd will output some errors like "too many open files", it is caused by max-file limitation.
Now, we start dockerd using procd, just add a statement to fix this problem.
Signed-off-by: Fuying Wang <805447391@qq.com>