2024-02-05 19:54:17 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# This script will create the direcories or symlinks that browsers look for
|
|
|
|
# their policies. The user is trusted to setup those manually.
|
|
|
|
set -x
|
|
|
|
|
2024-05-14 09:25:49 +02:00
|
|
|
# Require root or exit
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
|
|
echo "This script requires root for managing /etc/" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-05 19:54:17 +01:00
|
|
|
# Firefox and LibreWolf (caution! https://codeberg.org/librewolf/issues/issues/1767)
|
2024-04-29 11:25:17 +02:00
|
|
|
mkdir -vp /etc/firefox/policies
|
2024-07-31 09:57:24 +02:00
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/firefox/policies
|
2024-04-29 11:25:17 +02:00
|
|
|
chmod -v a+rx /etc/firefox/
|
|
|
|
chmod -v a+rx /etc/firefox/policies/
|
|
|
|
touch /etc/firefox/policies/policies.json
|
|
|
|
chmod -v a+r /etc/firefox/policies/policies.json
|
|
|
|
printf "WARNING! LibreWolf default profile may be masked!\nhttps://codeberg.org/librewolf/issues/issues/1767\n"
|
2024-02-05 19:54:17 +01:00
|
|
|
|
2024-05-16 20:04:01 +02:00
|
|
|
# Note to self on ln:
|
|
|
|
# -s is obviously symbolic link.
|
|
|
|
# -n will not follow symlink if it's a directory stopping the symlinks.
|
|
|
|
# pointing to the directory containing them.
|
|
|
|
# -v is obviously verbose.
|
|
|
|
# -f is obviously force so there won't be error message about it already
|
|
|
|
# existing.
|
|
|
|
|
2024-02-14 10:25:44 +01:00
|
|
|
# Firefox ESR
|
2024-07-31 10:04:19 +02:00
|
|
|
ln -nsfv /etc/firefox /etc/firefox-esr
|
2024-02-14 10:25:44 +01:00
|
|
|
|
2024-02-05 19:54:17 +01:00
|
|
|
# Chromium
|
2024-05-17 07:31:13 +02:00
|
|
|
mkdir -vp /etc/opt/chromium/policies/{managed,recommended}
|
2024-07-31 09:57:24 +02:00
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/firefox/policies
|
2024-04-29 11:25:17 +02:00
|
|
|
chmod -v a+rx /etc/opt/chromium/policies/
|
|
|
|
chmod -v a+rx /etc/opt/chromium/policies/{managed,recommended}/
|
2024-02-05 19:54:17 +01:00
|
|
|
|
|
|
|
# Brave
|
2024-05-23 07:27:45 +02:00
|
|
|
mkdir -p /etc/brave
|
2024-07-31 09:57:24 +02:00
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/brave
|
2024-07-31 10:04:19 +02:00
|
|
|
ln -nsfv /etc/opt/chromium/policies /etc/brave/policies
|
2024-02-05 19:54:17 +01:00
|
|
|
|
|
|
|
# Vivaldi
|
2024-05-23 07:27:45 +02:00
|
|
|
mkdir -p /etc/chromium
|
2024-07-31 09:57:24 +02:00
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/chromium
|
2024-07-31 10:04:19 +02:00
|
|
|
ln -nsfv /etc/opt/chromium/policies /etc/chromium/policies
|
2024-02-05 19:54:17 +01:00
|
|
|
|
|
|
|
# Google Chrome
|
2024-05-23 07:27:45 +02:00
|
|
|
mkdir -p /etc/opt/chrome
|
2024-07-31 09:57:24 +02:00
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/opt/chrome
|
2024-07-31 10:04:19 +02:00
|
|
|
ln -nsfv /etc/opt/chromium/policies /etc/opt/chrome/policies
|
2024-02-05 19:54:17 +01:00
|
|
|
|
2024-07-31 10:03:13 +02:00
|
|
|
# Naggig suspicion of another Google Chrome
|
|
|
|
mkdir -p /etc/chrome
|
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/chrome
|
2024-07-31 10:04:19 +02:00
|
|
|
ln -nsfv /etc/opt/chromium/policies /etc/chrome/policies
|
2024-07-31 10:03:13 +02:00
|
|
|
|
2024-02-05 19:54:17 +01:00
|
|
|
# Microsoft Edge
|
2024-05-16 17:35:48 +02:00
|
|
|
# I used to have a separate policy for it so remember to remove this manually
|
|
|
|
# if it exists!
|
2024-05-23 07:27:45 +02:00
|
|
|
mkdir -p /etc/opt/edge
|
2024-07-31 09:57:24 +02:00
|
|
|
setfacl --recursive --modify=u:root:rw,o:rx /etc/opt/edge
|
2024-07-31 10:04:19 +02:00
|
|
|
ln -nsfv /etc/opt/chromium/policies /etc/opt/edge/policies
|
2024-02-05 19:54:17 +01:00
|
|
|
|
|
|
|
set +x
|