aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-06-17 00:06:58 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-17 19:36:37 +0200
commit9132be46ed3aec156d1c26648124464af5c8b779 (patch)
tree97181e5eda732c5e176835e691fc7d914f946373
parentsimd: no need to restore fpu state when no preemption (diff)
downloadwireguard-monolithic-historical-9132be46ed3aec156d1c26648124464af5c8b779.tar.xz
wireguard-monolithic-historical-9132be46ed3aec156d1c26648124464af5c8b779.zip
dns-hatchet: apply resolv.conf's selinux context to new resolv.conf
-rw-r--r--contrib/examples/dns-hatchet/hatchet.bash2
1 files changed, 2 insertions, 0 deletions
diff --git a/contrib/examples/dns-hatchet/hatchet.bash b/contrib/examples/dns-hatchet/hatchet.bash
index 793684c..5857cc1 100644
--- a/contrib/examples/dns-hatchet/hatchet.bash
+++ b/contrib/examples/dns-hatchet/hatchet.bash
@@ -17,9 +17,11 @@ set_dns() {
printf 'nameserver %s\n' "${DNS[@]}"
} | unshare -m --propagation shared bash -c "$(cat <<-_EOF
set -e
+ context="\$(stat -c %C /etc/resolv.conf 2>/dev/null)" || unset context
mount --make-private /dev/shm
mount -t tmpfs none /dev/shm
cat > /dev/shm/resolv.conf
+ [[ -z \$context || \$context == "?" ]] || chcon "\$context" /dev/shm/resolv.conf 2>/dev/null || true
mount -o remount,ro /dev/shm
mount -o bind,ro /dev/shm/resolv.conf /etc/resolv.conf
_EOF