沙箱安装混乱

问题描述 投票:1回答:1

首先,我正在使用Bubblewrap作为沙盒软件,但我感觉这是一个普遍的安装问题,而不是气泡包装。我正在尝试将bwrap添加到沙盒包装器called sandboxlib中,除了正在运行的测试之外,其他细节并不重要。

一个特定的测试试图从“ / foo / bar”挂载沙箱/。它包含2个子目录,数据和bin。

bin目录仅包含一个称为'test-file-is-writable'的简单二进制文件。

如果我跑步:

$ / usr / bin / bwrap --ro-bind / foo / bar / --tmpfs / data test-file-is-writable data / 1 / canary

无法打开数据/ 1 / canary进行写入。

但是,安装/作为可写作品

$ / usr / bin / bwrap --bind / foo / bar / --tmpfs / data test-file-is-writable data / 1 / canary

将数据写入data / 1 / canary。

但是,我只希望/ data是可写的,并且假设/的其余部分为ro

以只读方式添加重新安装仍然无法解决问题

$ / usr / bin / bwrap --ro-bind / foo / bar / --tmpfs / data --remount-ro / test-file-is-writable data / 1 / canary

无法打开数据/ 1 / canary进行写入。

进一步调试,我添加了放入沙箱内的交互式外壳所需的安装/路径

$ / usr / bin / bwrap --bind / foo / bar / --tmpfs / data --ro-bind / lib / lib --ro-bind / lib64 / lib64 --ro-bind / bin / usr / bin --remount-ro / bash

运行/的简单ls表示一切都按预期装入。测试r / w都很好。但是,问题是/ data目录完全为空(除了我的“ touch / data / testwrite”的输出之外)。请注意,我想挂载的原始/ data分区实际上包含文件。

Q。我不明白这里的安装吗?还是测试错了?我能看到的唯一解决方法是将文件从原始ro / data复制到新写入的/ data

linux sandbox mount mount-point
1个回答
0
投票

data/1/canary是相对路径,当前目录不是根目录,因此您尝试写入其他位置

© www.soinside.com 2019 - 2024. All rights reserved.