jail: mount-bind /etc/resolv.conf for non-netns jails
authorDaniel Golle <daniel@makrotopia.org>
Thu, 12 Mar 2020 21:54:19 +0000 (22:54 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 12 Mar 2020 21:57:16 +0000 (22:57 +0100)
Many applications won't work without name resolution and expect
/etc/resolv.conf in place. While this is already handled for
netns-jails, simply mount-bind /etc/resolv.conf for non-netns-jails.

Signed-off-by: Daniel Golle <daniel@makrotoia.org>
jail/jail.c

index eb976cb113b1cc9e5ed8425f66d883893f4df5a9..5414519ce4d397474d293f290fd9aef60e124ad5 100644 (file)
@@ -544,6 +544,10 @@ int main(int argc, char **argv)
                                add_mount("/etc/passwd", 0, -1);
                                add_mount("/etc/group", 0, -1);
                        }
+
+                       if (!(opts.namespace & CLONE_NEWNET)) {
+                               add_mount("/etc/resolv.conf", 0, -1);
+                       }
                }
 
                if (opts.hostname)