Quick Deployment Of Newt #1723

Closed
opened 2026-04-05 19:40:15 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @freedbygrace on 3/11/2025

There is another package out there called Newt, which can be installed using a package manager and could confuse things down the line. I developed a shell script that will do all the heavy lifting to get your version of Newt configured with ease. I download the latest version automatically and rename the binary on the filesystem to "pangolin.newt" so there is never a chance for contention. I hope this helps streamline deployment! I kept it simple, but this could be made more sophisticated to check if the service exists, stop the service, update the binary, and start the service back up.

P.S. - This is a great product!

Quick question though, is there any way to show which clients are registered to a site? This would be fantastic!

#!/bin/bash

NEWTENDPOINTURL="https://YourPangolinDNSAddress"

NEWTID="YourNewtSiteID"
NEWTSECRET="YourNewtSiteSecret"

NEWTDOWNLOADURL="https://github.com/fosrl/newt/releases/latest/download/newt_linux_amd64"
NEWTDOWNLOADDIRECTORY="/usr/local/bin"
NEWTFILENAME="pangolin.newt"
NEWTFILEPATH="${NEWTDOWNLOADDIRECTORY}/${NEWTFILENAME}"
NEWTSERVICENAME="pangolin.newt.service"

if [[ ! -f "${NEWTFILEPATH}" ]]; then
	mkdir -p "${NEWTDOWNLOADDIRECTORY}"
	wget -q -O "${NEWTFILEPATH}" "${NEWTDOWNLOADURL}"
	
	if [[ -f "${NEWTFILEPATH}" ]]; then
		
		sleep 2s

		chmod +x "${NEWTFILEPATH}"

		NEWTSERVICEDEFINITIONPATH="/etc/systemd/system/${NEWTSERVICENAME}"
				
		sleep 2s
		
		cat > "${NEWTSERVICEDEFINITIONPATH}" << EOF
[Unit]
Description=Pangolin Newt VPN Client
After=network.target

[Service]
ExecStart=$NEWTFILEPATH --id $NEWTID --secret $NEWTSECRET --endpoint $NEWTENDPOINTURL
Restart=always
User=root

[Install]
WantedBy=multi-user.target
EOF

		sleep 2s
		
		systemctl enable "${NEWTSERVICENAME}"
		
		systemctl start "${NEWTSERVICENAME}"
		
		systemctl -l --no-pager status "${NEWTSERVICENAME}"
	else
		echo "Could not locate '${NEWTFILEPATH}'. No further action will be taken."
	fi
fi
Sample SystemCTL Output

● pangolin.newt.service - Pangolin Newt VPN Client
     Loaded: loaded (/etc/systemd/system/pangolin.newt.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-03-11 02:18:25 UTC; 9h ago
   Main PID: 21905 (pangolin.newt)
      Tasks: 10 (limit: 9432)
     Memory: 7.1M (peak: 7.9M)
        CPU: 3.387s
     CGroup: /system.slice/pangolin.newt.service
             └─21905 /usr/local/bin/pangolin.newt --id YourNewtSiteID --secret YourNewtSiteSecret --endpoint https://YourPangolinDNSAddress
*Originally created by @freedbygrace on 3/11/2025* There is another package out there called Newt, which can be installed using a package manager and could confuse things down the line. I developed a shell script that will do all the heavy lifting to get your version of Newt configured with ease. I download the latest version automatically and rename the binary on the filesystem to "pangolin.newt" so there is never a chance for contention. I hope this helps streamline deployment! I kept it simple, but this could be made more sophisticated to check if the service exists, stop the service, update the binary, and start the service back up. P.S. - This is a great product! Quick question though, is there any way to show which clients are registered to a site? This would be fantastic! ``` #!/bin/bash NEWTENDPOINTURL="https://YourPangolinDNSAddress" NEWTID="YourNewtSiteID" NEWTSECRET="YourNewtSiteSecret" NEWTDOWNLOADURL="https://github.com/fosrl/newt/releases/latest/download/newt_linux_amd64" NEWTDOWNLOADDIRECTORY="/usr/local/bin" NEWTFILENAME="pangolin.newt" NEWTFILEPATH="${NEWTDOWNLOADDIRECTORY}/${NEWTFILENAME}" NEWTSERVICENAME="pangolin.newt.service" if [[ ! -f "${NEWTFILEPATH}" ]]; then mkdir -p "${NEWTDOWNLOADDIRECTORY}" wget -q -O "${NEWTFILEPATH}" "${NEWTDOWNLOADURL}" if [[ -f "${NEWTFILEPATH}" ]]; then sleep 2s chmod +x "${NEWTFILEPATH}" NEWTSERVICEDEFINITIONPATH="/etc/systemd/system/${NEWTSERVICENAME}" sleep 2s cat > "${NEWTSERVICEDEFINITIONPATH}" << EOF [Unit] Description=Pangolin Newt VPN Client After=network.target [Service] ExecStart=$NEWTFILEPATH --id $NEWTID --secret $NEWTSECRET --endpoint $NEWTENDPOINTURL Restart=always User=root [Install] WantedBy=multi-user.target EOF sleep 2s systemctl enable "${NEWTSERVICENAME}" systemctl start "${NEWTSERVICENAME}" systemctl -l --no-pager status "${NEWTSERVICENAME}" else echo "Could not locate '${NEWTFILEPATH}'. No further action will be taken." fi fi ``` ``` Sample SystemCTL Output ● pangolin.newt.service - Pangolin Newt VPN Client Loaded: loaded (/etc/systemd/system/pangolin.newt.service; enabled; preset: enabled) Active: active (running) since Tue 2025-03-11 02:18:25 UTC; 9h ago Main PID: 21905 (pangolin.newt) Tasks: 10 (limit: 9432) Memory: 7.1M (peak: 7.9M) CPU: 3.387s CGroup: /system.slice/pangolin.newt.service └─21905 /usr/local/bin/pangolin.newt --id YourNewtSiteID --secret YourNewtSiteSecret --endpoint https://YourPangolinDNSAddress ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#1723