jail: move /tmp/resolv.conf.d to /dev/resolv.conf.d
authorDaniel Golle <daniel@makrotopia.org>
Sun, 19 Jul 2020 19:21:33 +0000 (20:21 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 20 Jul 2020 00:06:10 +0000 (01:06 +0100)
OCI spec implicitely intends /dev to be used as tmpfs mounted by
default while /tmp may not be mounted or may not even exist.
Hence move /tmp/resolv.conf.d to /dev/resolv.conf.d inside
container.

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

index 62da3ec64769fce2b08f38c862efdd85dfafd1b6..a9f473e73902b3921002adff1b2dc771705f326e 100644 (file)
@@ -585,7 +585,7 @@ static int build_jail_fs(void)
                if (overlaydir)
                        unlink(jaillink);
 
-               symlink("../tmp/resolv.conf.d/resolv.conf.auto", jaillink);
+               symlink("../dev/resolv.conf.d/resolv.conf.auto", jaillink);
        }
 
        run_hooks(opts.hooks.createContainer);
@@ -2051,7 +2051,7 @@ int main(int argc, char **argv)
 
                                snprintf(hostdir, PATH_MAX, "/tmp/resolv.conf-%s.d", opts.name);
                                mkdir_p(hostdir, 0755);
-                               add_mount(hostdir, "/tmp/resolv.conf.d", NULL, MS_BIND | MS_NOEXEC | MS_NOATIME | MS_NOSUID | MS_NODEV | MS_RDONLY, NULL, -1);
+                               add_mount(hostdir, "/dev/resolv.conf.d", NULL, MS_BIND | MS_NOEXEC | MS_NOATIME | MS_NOSUID | MS_NODEV | MS_RDONLY, NULL, -1);
                        }
                }