X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fmodules%2Fpub%2Frestrict;h=6204aa20c09d8717dd7dbc21bc843a3290156f85;hb=7e5b026095c54a78f94f6c91785c04d9cba1a309;hp=6d80590487417f88e83254e54cdb3d5b7b9f7c90;hpb=1be1a523cb04a5079e2212f3ab5a09b6591a4340;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/modules/pub/restrict b/nixops/modules/pub/restrict index 6d80590..6204aa2 100644 --- a/nixops/modules/pub/restrict +++ b/nixops/modules/pub/restrict @@ -2,6 +2,7 @@ user="$1" rootuser="$HOME/$user/" mkdir -p $rootuser +mkdir -p $HOME/$user-nixstore orig="$SSH_ORIGINAL_COMMAND" if [ -z "$orig" ]; then @@ -20,13 +21,15 @@ rsync*) nix-store -q -R \ /run/current-system/sw \ /etc/profiles/per-user/pub \ + /etc/ssl/certs/ca-bundle.crt \ | while read i; do - printf '%s--bind\0'$i'\0'$i'\0' '' + printf '%s--ro-bind\0'$i'\0'$i'\0' '' done } set -euo pipefail (exec -c bwrap --ro-bind /usr /usr \ + --bind /var/lib/pub/$user-nixstore /nix \ --args 10 \ --dir /tmp \ --dir /var \ @@ -35,11 +38,15 @@ rsync*) --dev /dev \ --ro-bind /etc/resolv.conf /etc/resolv.conf \ --ro-bind /etc/zoneinfo /etc/zoneinfo \ + --ro-bind /etc/ssl /etc/ssl \ + --ro-bind /etc/static/ssl/certs /etc/static/ssl/certs \ --ro-bind /run/current-system/sw/lib/locale/locale-archive /etc/locale-archive \ --ro-bind /run/current-system/sw/bin /bin \ --ro-bind /etc/profiles/per-user/pub/bin /bin-pub \ --bind /var/lib/pub/$user /var/lib/pub \ - --ro-bind $TMUX_RESTRICT /var/lib/pub/.tmux.restrict.conf \ + --dir /var/lib/commons \ + --ro-bind $TMUX_RESTRICT /var/lib/commons/tmux.restrict.conf \ + --file 9 /var/lib/commons/nix-dump \ --chdir /var/lib/pub \ --unshare-all \ --share-net \ @@ -53,6 +60,7 @@ rsync*) --file 11 /etc/passwd \ --file 12 /etc/group \ -- $orig) \ + 9< <(nix-store --dump-db) \ 10< <(nix_store_paths) \ 11< <(getent passwd $UID 65534) \ 12< <(getent group $(id -g) 65534)