fix(gateway): Use sudo tee instead of sudo cat to write files as root (#3177)

Fixes an issue with input/output redirection that is preventing the
systemd gateway install script from working properly.
This commit is contained in:
Jamil
2024-01-11 16:58:03 -08:00
committed by GitHub
parent e0696e4a59
commit fafc7edebb

View File

@@ -199,7 +199,7 @@ defmodule Web.Sites.NewToken do
id -u firezone &>/dev/null || sudo useradd -r -g firezone -s /sbin/nologin firezone
# Create systemd unit file
sudo cat << EOF > /etc/systemd/system/firezone-gateway.service
cat << EOF | sudo tee /etc/systemd/system/firezone-gateway.service
[Unit]
Description=Firezone Gateway
After=network.target
@@ -224,7 +224,7 @@ defmodule Web.Sites.NewToken do
EOF
# Create ExecStartPre script
sudo cat << EOF > /usr/local/bin/firezone-gateway-init
cat << EOF | sudo tee /usr/local/bin/firezone-gateway-init
#!/bin/sh
set -ue