← Start of tutorial

WIUNIX ACADEMY

Set up Cloudflare Tunnel and Access for a private Linux web app

Page 2 of 5. Review the earlier steps and prerequisites before continuing.

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

Manjaro (rolling, x86_64)Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment8 editable values
04

LET’S BUILD

Install prerequisites from distribution repositories

On the fresh Manjaro lab host, install tools and cloudflared in one official-repository transaction. No AUR helper or repository substitution is needed. Review all changes before approval.

Syu also performs a complete rolling-system upgrade. Use the fresh host and a suitable window, avoid partial upgrades, and complete any required reboot through the distribution procedure before continuing. Python serves only the marker.

Bash

Run at the location stated in this step

sudo pacman -Syu --needed ca-certificates curl gnupg python bind iproute2 shadow sudo cloudflared
How do I know it worked?

The complete authenticated transaction succeeds and the host is not partially upgraded.

05

LET’S BUILD

Inspect the installed official distribution package

cloudflared was installed from the official Manjaro repository in the preceding transaction. Add no APT/RPM file. Inspect package metadata/file lists for /usr/bin/cloudflared and preserve pacman signature verification.

Record the maintained version and token-file support, available since 2025.4.0. Use this guide’s dedicated unit, not a token-bearing service-install command. Manjaro may lag Arch; do not mix repositories to force equal versions.

Bash

Run at the location stated in this step

pacman -Qi cloudflared
pacman -Ql cloudflared
command -v cloudflared
cloudflared --version
cloudflared tunnel run --help
How do I know it worked?

Package origin, binary path and version are identified and help shows token-file.

06

LET’S BUILD

Approve only the required outbound path

Use the current official firewall destination list: outbound UDP/7844 for QUIC and TCP/7844 for HTTP/2, plus DNS to your approved resolver. Repository downloads require HTTPS; connector-side Access JWT validation also needs HTTPS to your team cloudflareaccess.com endpoint. Do not assume TCP/443 replaces 7844. Keep existing inbound management policy unchanged, add no inbound origin port, and do not flush your firewall. The auto protocol can fall back to HTTP/2 when UDP is blocked. A successful TCP probe is not a QUIC handshake or an authorization test.

Bash

Run at the location stated in this step

getent ahostsv4 region1.v2.argotunnel.com
getent ahostsv4 region2.v2.argotunnel.com
dig SRV _v2-origintunneld._tcp.argotunnel.com
How do I know it worked?

Resolvers return tunnel destinations. Network owner has approved required egress; actual connector transport is checked after startup.

07

LET’S BUILD

Create a dedicated harmless origin

Use a fresh dedicated directory containing only a nonsecret marker, never application data, a home directory, repository, credential store or backup. The fixed loopback address is intentional.

Create a dedicated academy-origin account/group instead of assuming a distribution-wide www-data account exists. Refuse an existing same-name account/group, path or unit. The origin can read its public marker; the separate connector credential remains root-only.

Bash

Run at the location stated in this step

sudo bash -eu <<'ORIGIN' &&
test ! -e '/srv/academy-origin'
test ! -e /etc/systemd/system/academy-origin.service
if getent passwd academy-origin >/dev/null || getent group academy-origin >/dev/null; then echo 'Existing origin account/group: STOP' >&2; exit 1; fi
useradd --system --user-group --no-create-home --shell "$(command -v nologin)" academy-origin
install -d -m 0755 '/srv/academy-origin'
install -d -m 0755 "$(dirname '/srv/academy-origin/health.txt')"
printf '%s\n' 'academy-tunnel-origin-ok' > '/srv/academy-origin/health.txt'
chmod 0644 '/srv/academy-origin/health.txt'
ORIGIN
sudoedit /etc/systemd/system/academy-origin.service
How do I know it worked?

The fresh marker/account exist; the editor is open for the following dedicated unit.

Origin service file

FILE CONTENT: save this dedicated unit, not a shell command. It listens only on 127.0.0.1:8080 as the dedicated unprivileged academy-origin account.

ini · /etc/systemd/system/academy-origin.service
[Unit]
Description=Academy loopback marker origin
After=network.target

[Service]
Type=simple
User=academy-origin
Group=academy-origin
ExecStart=/usr/bin/python3 -m http.server 8080 --bind 127.0.0.1 --directory /srv/academy-origin
Restart=on-failure
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true

[Install]
WantedBy=multi-user.target
08

LET’S BUILD

Start and verify the loopback receiver

On the connector host, validate the unit before starting it. Verify the exact body, not just HTTP status. Inspect the listener address: no wildcard IPv4 or IPv6 binding. From a different machine, the host’s LAN/public address at this port must be unreachable; retain existing firewall policy. If that check fails, stop here and close the exposure before creating a route.

Bash

Run at the location stated in this step

sudo systemd-analyze verify /etc/systemd/system/academy-origin.service
sudo systemctl daemon-reload
sudo systemctl enable --now academy-origin.service
curl --fail --silent --show-error --noproxy '*' http://127.0.0.1:8080/health.txt
sudo ss -lntp 'sport = :8080'
How do I know it worked?

Body is academy-tunnel-origin-ok and the listener is only 127.0.0.1:8080.

Explore all tutorials ↗