sliver icon indicating copy to clipboard operation
sliver copied to clipboard

Can't build sliver under several Linux distro

Open Gr4yG opened this issue 2 years ago • 5 comments

Description: I have tried to build Sliver under Kali, Debian-11, Debian-10 but I always keep getting the same error. I even tried to build it with different versions of Golang installed, yet it's always the same error.

Some ENV details: The Golang version used were: Go.1.20.1 & Go.1.21.5 (latest) The Sliver branches I tried were: V1.5.40 & v1.5.39 Tried it under a VM and on my main machine, same result.

The error is as follow, when running the make or make linux:

...
...
touch ./.downloaded_assets
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -mod=vendor -trimpath -tags osusergo,netgo,cgosqlite,sqlite_omit_load_extension,server -ldflags "-s -w -extldflags '-static' -X github.com/bishopfox/sliver/client/version.Version=v1.5.39 -X \"github.com/bishopfox/sliver/client/version.GoVersion=go version go1.21.3 linux/amd64\" -X github.com/bishopfox/sliver/client/version.CompiledAt=1702124090 -X github.com/bishopfox/sliver/client/version.GithubReleasesURL=https://api.github.com/repos/BishopFox/sliver/releases -X github.com/bishopfox/sliver/client/version.GitCommit=af46878f8520c0c65bbb1e80d813a9658ba09188 -X github.com/bishopfox/sliver/client/version.GitDirty= -X github.com/bishopfox/sliver/client/assets.DefaultArmoryPublicKey=RWSBpxpRWDrD7Fe+VvRE3c2VEDC2NK80rlNCj+BX0gz44Xw07r6KQD9L -X github.com/bishopfox/sliver/client/assets.DefaultArmoryRepoURL=https://api.github.com/repos/sliverarmory/armory/releases" -o sliver-server ./server
package github.com/bishopfox/sliver/server
	imports github.com/bishopfox/sliver/server/cli
	imports github.com/bishopfox/sliver/server/builder
	imports github.com/bishopfox/sliver/server/generate
	imports github.com/bishopfox/sliver/server/certs
	imports github.com/bishopfox/sliver/server/core
	imports github.com/bishopfox/sliver/implant/sliver/transports/wireguard
	imports github.com/bishopfox/sliver/implant/sliver/netstack
	imports gvisor.dev/gvisor/pkg/bufferv2
	imports gvisor.dev/gvisor/pkg/atomicbitops
	imports gvisor.dev/gvisor/pkg/state
	imports gvisor.dev/gvisor/pkg/state/wire
	imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /home/XX/Documents/sliver/vendor/gvisor.dev/gvisor/pkg/gohacks
make: *** [Makefile:137: linux] Error 1

Note: I've done some research, and found some ppl talking about it and it looks like some Go bug in the gvisor, I'm not sure about that

Gr4yG avatar Dec 09 '23 12:12 Gr4yG

Check the go version on your PATH

moloch-- avatar Dec 09 '23 21:12 moloch--

go version go1.21.6 linux/amd64.

Same problem here.

kmahyyg avatar Jan 16 '24 08:01 kmahyyg

https://github.com/google/gvisor/pull/9197 https://github.com/google/gvisor/commit/c006f01e0e550ea5609190131747d7b1533f8e03

It seems you may need to upgrade gVisor library. And after upgrade, tun implementation need some fixes for v1.5.x to build and work.

kmahyyg avatar Jan 16 '24 08:01 kmahyyg

After updating gVisor, it still gives an error: go: inconsistent vendoring in /home/kali/sliver: gvisor.dev/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt gvisor.dev/[email protected]: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod To ignore the vendor directory, use -mod=readonly or -mod=mod. To sync the vendor directory, run: go mod vendor

'go mod vendor' don't solve the problem

leader0001 avatar Jan 25 '24 13:01 leader0001

Using the weird install instructions of gvisor from https://gvisor.dev/docs/user_guide/install/ didnt help, using sliver v1.5.41.

But master seems to have fixed it:

root@sliver:~/sliver# git checkout tags/v1.5.41
Note: switching to 'tags/v1.5.41'.
root@sliver:~/sliver# make
rm -f sliver-client sliver-server sliver-*.exe
CGO_ENABLED=1 go build -mod=vendor -trimpath -tags osusergo,netgo,cgosqlite,sqlite_omit_load_extension,server -ldflags "-s -w -X github.com/bishopfox/sliver/client/version.Version=v1.5.41 -X \"github.com/bishopfox/sliver/client/version.GoVersion=go version go1.21.6 linux/amd64\" -X github.com/bishopfox/sliver/client/version.CompiledAt=1706440357 -X github.com/bishopfox/sliver/client/version.GithubReleasesURL=https://api.github.com/repos/BishopFox/sliver/releases -X github.com/bishopfox/sliver/client/version.GitCommit=f2a3915c79b31ab31c0c2f0428bbd53d9e93c54b -X github.com/bishopfox/sliver/client/version.GitDirty= -X github.com/bishopfox/sliver/client/assets.DefaultArmoryPublicKey=RWSBpxpRWDrD7Fe+VvRE3c2VEDC2NK80rlNCj+BX0gz44Xw07r6KQD9L -X github.com/bishopfox/sliver/client/assets.DefaultArmoryRepoURL=https://api.github.com/repos/sliverarmory/armory/releases" -o sliver-server ./server
package github.com/bishopfox/sliver/server
        imports github.com/bishopfox/sliver/server/cli
        imports github.com/bishopfox/sliver/server/builder
        imports github.com/bishopfox/sliver/server/generate
        imports github.com/bishopfox/sliver/server/certs
        imports github.com/bishopfox/sliver/server/core
        imports github.com/bishopfox/sliver/implant/sliver/transports/wireguard
        imports github.com/bishopfox/sliver/implant/sliver/netstack
        imports gvisor.dev/gvisor/pkg/bufferv2
        imports gvisor.dev/gvisor/pkg/atomicbitops
        imports gvisor.dev/gvisor/pkg/state
        imports gvisor.dev/gvisor/pkg/state/wire
        imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /root/sliver/vendor/gvisor.dev/gvisor/pkg/gohacks
root@sliver:~/sliver# git checkout master
Previous HEAD position was f2a3915c7 Merge pull request #1344 from BishopFox/fix/pstree
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
root@sliver:~/sliver# make
rm -f sliver-client sliver-client_* sliver-server sliver-server_* sliver-*.exe
CGO_ENABLED=0 go build -mod=vendor -trimpath -tags go_sqlite,server -ldflags "-s -w -X github.com/bishopfox/sliver/client/version.Version=v1.5.39 -X \"github.com/bishopfox/sliver/client/version.GoVersion=go version go1.21.6 linux/amd64\" -X github.com/bishopfox/sliver/client/version.CompiledAt=1706440502 -X github.com/bishopfox/sliver/client/version.GithubReleasesURL=https://api.github.com/repos/BishopFox/sliver/releases -X github.com/bishopfox/sliver/client/version.GitCommit=d0dc42ea2f578624da804e889b391b059c4470c0 -X github.com/bishopfox/sliver/client/version.GitDirty= -X github.com/bishopfox/sliver/client/assets.DefaultArmoryPublicKey=RWSBpxpRWDrD7Fe+VvRE3c2VEDC2NK80rlNCj+BX0gz44Xw07r6KQD9L -X github.com/bishopfox/sliver/client/assets.DefaultArmoryRepoURL=https://api.github.com/repos/sliverarmory/armory/releases" -o sliver-server ./server
CGO_ENABLED=0 go build -mod=vendor -trimpath -tags go_sqlite,client -ldflags "-s -w -X github.com/bishopfox/sliver/client/version.Version=v1.5.39 -X \"github.com/bishopfox/sliver/client/version.GoVersion=go version go1.21.6 linux/amd64\" -X github.com/bishopfox/sliver/client/version.CompiledAt=1706440502 -X github.com/bishopfox/sliver/client/version.GithubReleasesURL=https://api.github.com/repos/BishopFox/sliver/releases -X github.com/bishopfox/sliver/client/version.GitCommit=d0dc42ea2f578624da804e889b391b059c4470c0 -X github.com/bishopfox/sliver/client/version.GitDirty= -X github.com/bishopfox/sliver/client/assets.DefaultArmoryPublicKey=RWSBpxpRWDrD7Fe+VvRE3c2VEDC2NK80rlNCj+BX0gz44Xw07r6KQD9L -X github.com/bishopfox/sliver/client/assets.DefaultArmoryRepoURL=https://api.github.com/repos/sliverarmory/armory/releases" -o sliver-client ./client
root@sliver:~/sliver#

dobin avatar Jan 28 '24 11:01 dobin

Make sure to use Go v1.20.7 when building v1.5.x

moloch-- avatar Mar 13 '24 13:03 moloch--

From the documentation, When compiling v1.5.x use Go v1.20.7. I downgraded the go version to 1.20.7 and that solved the issue.

SLizerin-CLI avatar Apr 09 '24 04:04 SLizerin-CLI