automate/020_torproject.sh

34 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
AVAILABLE=/etc/apt/sources.list-available
ACTIVE=/etc/apt/sources.list.d
# Install apt-transport-https to handle HTTPS connections
apt install -y apt-transport-https
RELEASE="bookworm"
# EXPERIMENTAL="tor-experimental"
# Add the Tor Project repository to the list of available sources
KEYRING="/etc/apt/trusted.gpg.d/tor-archive-keyring.gpg"
sudo bash -c "cat > ${AVAILABLE}/torproject.list" <<-EOF
deb [signed-by=${KEYRING}] https://deb.torproject.org/torproject.org ${EXPERIMENTAL} ${RELEASE} main
deb-src [signed-by=${KEYRING}] https://deb.torproject.org/torproject.org ${EXPERIMENTAL} ${RELEASE} main
EOF
# Create a symbolic link to the active sources list
ln -sf "${AVAILABLE}"/torproject.list "${ACTIVE}"/torproject.list
# Import the GPG key for the Tor Project repository
# Directly add the key to the trusted.gpg.d directory
KEY="A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc"
wget -q -O- https://deb.torproject.org/torproject.org/${KEY} | gpg --dearmor | sudo tee ${KEYRING} >/dev/null
# Update the package lists
apt update
# Install Tor and the Tor Project keyring
apt install -y tor # deb.torproject.org-keyring