summaryrefslogtreecommitdiff
path: root/hosts/vidhar
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-02-17 15:37:34 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-02-17 15:37:34 +0100
commit1303f869eb553749cb233beb4955adfc700175fa (patch)
treeac926bbeacec90d21637e7e161742e37e2e73eee /hosts/vidhar
parent433a8cf0d2f99b9b122d6fb8afd581e36dabe429 (diff)
downloadnixos-1303f869eb553749cb233beb4955adfc700175fa.tar
nixos-1303f869eb553749cb233beb4955adfc700175fa.tar.gz
nixos-1303f869eb553749cb233beb4955adfc700175fa.tar.bz2
nixos-1303f869eb553749cb233beb4955adfc700175fa.tar.xz
nixos-1303f869eb553749cb233beb4955adfc700175fa.zip
vidhar: ...
Diffstat (limited to 'hosts/vidhar')
-rwxr-xr-xhosts/vidhar/borg/copy.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index fa698029..8eea7794 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -98,17 +98,13 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
98 unshare.unshare(unshare.CLONE_NEWNS | unshare.CLONE_NEWUSER) 98 unshare.unshare(unshare.CLONE_NEWNS | unshare.CLONE_NEWUSER)
99 with open('/proc/self/setgroups', 'w') as setgroups: 99 with open('/proc/self/setgroups', 'w') as setgroups:
100 setgroups.write('deny') 100 setgroups.write('deny')
101 # with open('/proc/self/uid_map', 'w') as uid_map: 101 with open('/proc/self/uid_map', 'w') as uid_map:
102 # uid_map.write(f'0 {uid} 1') 102 uid_map.write(f'0 0 4294967295')
103 # with open('/proc/self/gid_map', 'w') as gid_map: 103 with open('/proc/self/gid_map', 'w') as gid_map:
104 # gid_map.write(f'0 {gid} 1') 104 gid_map.write(f'0 0 4294967295')
105 pyprctl.cap_permitted.sys_admin = True 105 pyprctl.cap_permitted.sys_admin = True
106 pyprctl.cap_inheritable.sys_admin = True 106 pyprctl.cap_inheritable.sys_admin = True
107 pyprctl.cap_ambient.sys_admin = True 107 pyprctl.cap_ambient.sys_admin = True
108 with open('/proc/self/uid_map', 'w') as uid_map:
109 uid_map.write(f'0 0 1\n{uid} {uid} 1')
110 with open('/proc/self/gid_map', 'w') as gid_map:
111 gid_map.write(f'0 0 1\n{gid} {gid} 1')
112 subprocess.run(['mount', '--make-rprivate', '/'], check=True) 108 subprocess.run(['mount', '--make-rprivate', '/'], check=True)
113 chroot = pathlib.Path(tmpdir) / 'chroot' 109 chroot = pathlib.Path(tmpdir) / 'chroot'
114 upper = pathlib.Path(tmpdir) / 'upper' 110 upper = pathlib.Path(tmpdir) / 'upper'