Use token from environment variable

This commit is contained in:
Korbs 2024-06-19 19:51:22 -04:00
parent 9c12e3d800
commit 548dc03a78

View file

@ -119,13 +119,13 @@ mkdir -p /etc/netweak
mkdir -p /etc/netweak/log
# Download agent
echo -e "| Downloading agent.sh to /etc/netweak\n|\n| + $(curl -JLso /etc/netweak/agent.sh https://github.com/netweak/agent/raw/main/agent.sh)"
echo -e "| Downloading heartbeat.sh to /etc/netweak\n|\n| + $(curl -JLso /etc/netweak/heartbeat.sh https://github.com/netweak/agent/raw/main/heartbeat.sh)"
echo -e "| Downloading agent.sh to /etc/netweak\n|\n| + $(curl -JLso /etc/netweak/agent.sh https://ark.sudovanilla.org/Korbs/netweak-agent/raw/branch/main/agent.sh)"
echo -e "| Downloading heartbeat.sh to /etc/netweak\n|\n| + $(curl -JLso /etc/netweak/heartbeat.sh https://ark.sudovanilla.org/Korbs/netweak-agent/raw/branch/main/heartbeat.sh)"
if [ -f /etc/netweak/agent.sh ]
then
# Create auth file
echo "$1" > /etc/netweak/token.conf
echo $(env | grep TOKEN | grep -oe '[^=]*$'); > /etc/netweak/token.conf
# Create user
useradd netweak -r -d /etc/netweak -s /bin/false