gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

[Bug]: Cannot install on opnSense #1149

Closed JasonSwindle closed 2 years ago

JasonSwindle commented 2 years ago

Contact Details

No response

What happened?

Facing a few issues trying to install on opnSense

When trying to install via the docs:

# curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | VERSION="0.14.0" sh -
VERSION=0.14.0: Command not found.

If I just try the script with no flags, or piping

./netclient-install.sh
checking dependencies...
wireguard
     wireguard is installed
no $VERSION provided, fallback to latest
OS Version = FreeBSD
Netclient Version = latest
Binary = netclient-freebsd
Downloading netclient-freebsd latest
2022-05-30 12:52:20 URL:https://objects.githubusercontent.com/github-production-release-asset-2e65be/351486934/eb0fc195-7490-42ba-8d3d-9bda3af81e04?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220530%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220530T165220Z&X-Amz-Expires=300&X-Amz-Signature=26372504654f7460bed56da62d98d191dd70d8dd84ec21e0cf0f79d871835f92&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=351486934&response-content-disposition=attachment%3B%20filename%3Dnetclient-freebsd&response-content-type=application%2Foctet-stream [15063928/15063928] -> "netclient" [1]
2022/05/30 12:52:21 error decoding token
2022/05/30 12:52:21 illegal base64 data at input byte 4

Version

v0.14.0

What OS are you using?

Unlisted

Relevant log output

No response

Contributing guidelines

afeiszli commented 2 years ago

just put netclient in the executable bin (/usr/sbin/netclient i believe) and then run "netclient join -t "

What shell are you using to execute this?

FADEC44 commented 2 years ago

I was able to get it working as @afeiszli mentioned, thanks!

Btw @JasonSwindle, even though you are (presumably) root you still need to add "sudo" before VERSION to get the script to run. Like so:

# curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | sudo VERSION="0.14.0" sh -

Still leads you to the same error but FYI

JasonSwindle commented 2 years ago

@afeiszli

# ps -p$$
  PID TT  STAT    TIME COMMAND
32839  0  S    0:00.07 /bin/csh
# /bin/csh --version
/bin/csh --version
tcsh 6.22.04 (Astron) 2021-04-26 (x86_64-amd-FreeBSD) options wide,nls,dl,al,kan,sm,rh,color,filec
# uname -a
uname -a
FreeBSD xyz.tld 13.0-STABLE FreeBSD 13.0-STABLE stable/22.1-n248075-469123a60d1 SMP  amd64
# opnsense-version
opnsense-version
OPNsense 22.1.8 (amd64/OpenSSL)

Same error with sudo

Like @FADEC44 said

# curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | sudo VERSION="0.14.0" sh -
curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | sudo VERSION="0.14.0" sh -
checking dependencies...
wireguard
     wireguard is installed
OS Version = FreeBSD
Netclient Version = v0.14.0
Binary = netclient-freebsd
Downloading netclient-freebsd v0.14.0
2022-05-30 20:59:22 URL:https://objects.githubusercontent.com/github-production-release-asset-2e65be/351486934/c91adf3b-6912-494c-a935-7c95a79a6021?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220531%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220531T005922Z&X-Amz-Expires=300&X-Amz-Signature=cc010c78fcd175fc02560389a136780773ab296f9017313a38fa802000cd1302&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=351486934&response-content-disposition=attachment%3B%20filename%3Dnetclient-freebsd&response-content-type=application%2Foctet-stream [18992201/18992201] -> "netclient" [1]
[netclient] 2022-05-30 20:59:22 error decoding token illegal base64 data at input byte 4
2022/05/30 20:59:22 illegal base64 data at input byte 4
KingMichaelPark commented 2 years ago

just put netclient in the executable bin (/usr/sbin/netclient i believe) and then run "netclient join -t "

What shell are you using to execute this?

If you join this way after moving the executable there (which is the only way I could install it on my raspberry pi, the apt install fails as not found and the shell script has the same issue as above), there is no netclient.service so the command fails:

[netclient] 2022-06-01 10:37:10 error running command: systemctl restart netclient.service
[netclient] 2022-06-01 10:37:10 Failed to restart netclient.service: Unit netclient.service not found.
mattkasun commented 2 years ago

what is the failure with apt on pi?

to install netclient service run join with --daemon install flag

KingMichaelPark commented 2 years ago

Thanks for that command, the apt install issue is:

pi@raspberrypi:~ $ apt search ^netclient$
Sorting... Done
Full Text Search... Done
netclient/stable 0.14.0-2 arm64
  netclient daemon - a platform for modern, blazing fast virtual networks

pi@raspberrypi:~ $ sudo apt install netclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package netclient
JasonSwindle commented 2 years ago

@KingMichaelPark

Can you please create your own issue, as this issue is about opnSense (FreeBSD) and not apt (which is debian based) and rPi. Thanks.

cmonty14 commented 2 years ago

Why don't you install compiled package?

$ file netclient-freebsd 
netclient-freebsd: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), statically linked, Go BuildID=h1obpJrGZceeOl5KadH8/CIXAJ7gQsAkXK1pKUQyR/kFBWyFaRyYZ-UIul0yg6/VhIlE5gsNbCnr6ZytthH, not stripped
afeiszli commented 2 years ago

Bugfix added for freebsd script, closing issue.

JPBeltman commented 2 years ago

Btw @JasonSwindle, even though you are (presumably) root you still need to add "sudo" before VERSION to get the script to run. Like so:

# curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | sudo VERSION="0.14.0" sh -

Still leads you to the same error but FYI

Had the same issue as @JasonSwindle, on 0.15.2, sudo resolved it completely for me.