Here is the complete installation guide for snac on a 1GB VPS, configured with Tor v3 client authorization (stealth mode). 馃摝 Step 1: Install System Dependencies First, install the required build tools and libraries. snac only needs OpenSSL and cURL to function, which helps keep your VPS resource usage low . ```bash sudo apt update sudo apt install libssl-dev libcurl4-openssl-dev build-essential git basez -y ``` 馃懁 Step 2: Create System User and Build Create a dedicated system user to run the daemon securely, then clone and compile the source code . ```bash # 1. Create the snac user (no shell needed, but useful for initial setup) sudo useradd -r -m -s /bin/bash snac # 2. Switch to the snac user and create directories sudo su - snac mkdir -p ~/src mkdir -p ~/data # 3. Clone the repository and compile cd ~/src git clone https://codeberg.org/grunfink/snac2.git cd snac2 make sudo make install ``` 鈿欙笍 Step 3: Initialize Snac Configuration Initialize the base directory. This creates the server.json configuration file and sets up the data structure . ```bash # Still as the snac user snac init ~/data ``` During the interactive setup, provide the following answers: 路 Host name: Your Tor onion address (e.g., your56characteraddress.onion) 路 Path prefix: (Leave empty, just press Enter) 路 Network address: 127.0.0.1 (This is critical. snac should only be accessible via the local Tor daemon, never directly from the internet) 路 Port: 8001 (The default port for snac) 馃敡 Step 4: Configure Snac for Tor Edit the server.json file to ensure it understands it is running on a hidden service and to handle media correctly . ```bash vi ~/data/server.json ``` Find and update the following key values: 路 "protocol": Set this to "http". Tor hidden services do not use standard TLS certificates, and setting this to https will break federation . 路 "proxy_media": Set this to true. This ensures that when you view images or media from other instances, your snac server downloads and re-serves them, preventing remote servers from seeing your Tor IP address . 馃殌 Step 5: Create a Systemd Service Create a service file to manage the snac daemon and ensure it starts automatically on reboot . ```bash sudo nano /etc/systemd/system/snac.service ``` Add the following content: ```ini [Unit] Description=snac ActivityPub Server After=network.target [Service] Type=simple User=snac Group=snac ExecStart=/usr/local/bin/snac httpd /home/snac/data Restart=always [Install] WantedBy=multi-user.target ``` Enable and start the service: ```bash sudo systemctl daemon-reload sudo systemctl enable snac.service sudo systemctl start snac.service ``` 馃 Step 6: Configure Tor Hidden Service (Stealth Mode) Now, we set up the Tor onion service and the client authorization keys. 1. Generate Client Keys (Stealth Mode) This replaces the old v2 HiddenServiceAuthorizeClient stealth command . ```bash # 1. Generate a private key for the client (e.g., user1) openssl genpkey -algorithm x25519 -out /tmp/user1.prv.pem # 2. Extract the public key for the server openssl pkey -in /tmp/user1.prv.pem -pubout | grep -v " PUBLIC KEY" | base64pem -d | tail --bytes=32 | base32 | sed 's/=//g' > /tmp/user1.pub.key # 3. Create the server's authorized_clients directory sudo mkdir -p /var/lib/tor/myservice/authorized_clients/ # 4. Create the .auth file using the public key echo "descriptor:x25519:$(cat /tmp/user1.pub.key)" | sudo tee /var/lib/tor/myservice/authorized_clients/user1.auth ``` 2. Configure Tor Edit your /etc/tor/torrc file to point to your snac instance: ```bash sudo vi /etc/tor/torrc ``` Add this block: ```text HiddenServiceDir /var/lib/tor/myservice/ HiddenServicePort 80 127.0.0.1:8001 ``` Note: HiddenServicePort 80 is the public port on the onion address, while 127.0.0.1:8001 is the local port where snac is running. 3. Reload Tor and Retrieve Address ```bash sudo systemctl reload tor # Get your new onion address sudo cat /var/lib/tor/myservice/hostname ``` 馃攽 Step 7: Client Configuration Give the client their private key (from /tmp/user1.prv.key) and the .onion address. On the client's Tor Browser or daemon, they need to configure ClientOnionAuthDir. (If using Tor Browser, this is done via the settings, or via the torrc if they run their own Tor). They must create a file (e.g., user1.auth_private) in their auth directory with the following content: <56-char-onion-address>:descriptor:x25519: 馃挕 Important Notes for a 1GB VPS 路 Resource Usage: snac is extremely lightweight. The setup guide notes that even 1GB RAM is "extreme overkill" for a personal instance, and it uses very little CPU . 路 Key Backup: The hs_ed25519_secret_key in /var/lib/tor/myservice/ is your onion address. If you lose it, you lose the address forever. Back it up securely. 路 Federation: Because your instance is on a .onion address, it will only federate with other Tor-accessible instances. Clearnet servers like Mastodon will not be able to reach you.