Files
firezone/scripts/tests/token-path.sh
Reactor Scram 7081c71c10 chore(linux-client): allow custom token path (#4666)
```[tasklist]
# Before merging
- [x] Remove file extension `.txt`
- [x] Wait for `linux-group` test to go green on `main` (#4692)
- [x] *all* compatibility tests must be green on this branch
```

Closes #4664 
Closes #4665 

~~The compatibility tests are expected to fail until the next release is
cut, for the same reasons as in #4686~~

The compatibility test must be handled somehow, otherwise it'll turn
main red.
`linux-group` was moved out of integration / compatibility testing, but
the DNS tests do need the whole Docker + portal setup, so that one can't
move.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-19 18:50:24 +00:00

33 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
source "./scripts/tests/lib.sh"
BINARY_NAME=firezone-linux-client
TOKEN_PATH="token"
sudo cp "rust/target/debug/firezone-headless-client" "/usr/bin/$BINARY_NAME"
# Check should fail because there's no token yet
sudo "$BINARY_NAME" standalone --check && exit 1
touch "$TOKEN_PATH"
chmod 600 "$TOKEN_PATH"
sudo chown root:root "$TOKEN_PATH"
echo "n.SFMyNTY.g2gDaANtAAAAJGM4OWJjYzhjLTkzOTItNGRhZS1hNDBkLTg4OGFlZjZkMjhlMG0AAAAkN2RhN2QxY2QtMTExYy00NGE3LWI1YWMtNDAyN2I5ZDIzMGU1bQAAACtBaUl5XzZwQmstV0xlUkFQenprQ0ZYTnFJWktXQnMyRGR3XzJ2Z0lRdkZnbgYAGUmu74wBYgABUYA.UN3vSLLcAMkHeEh5VHumPOutkuue8JA6wlxM9JxJEPE" | sudo tee "$TOKEN_PATH" > /dev/null
# Check should fail because the token is not in the default path
sudo "$BINARY_NAME" --check standalone && exit 1
# Check should pass if we tell it where to look
sudo "$BINARY_NAME" --check --token-path "$TOKEN_PATH" standalone
# Move the token to the default path
sudo mkdir /etc/dev.firezone.client
sudo mv "$TOKEN_PATH" /etc/dev.firezone.client/token
# Check should now pass with the default path
sudo "$BINARY_NAME" --check standalone
# Redundant, but helps if the last command has an `&& exit 1`
exit 0