OSX: code executable to avoid a firewall warning

OSX El Capitan and Go 1.6

What I want is simpler than the name suggests.

The OSX firewall prevents any unknown application from accepting connections. When any such program starts, the user is presented with a dialog box about whether the specified executable file is allowed to receive connections. Then the user's choice is remembered.

This works fine when, for example, one is developed with node, where the actual executable is the only binary, and the user just needs to enable / disable it once.

When developed in go (and any other compiled language), the created executable is different every time. This means that I get a dialog every time I start my server.

One way to avoid this dialog is to sign the executable with a self-signed certificate that is generated in OSX. Once we have a certificate, we simply sign the executable file and enable / disable it once. Code signatures are always remembered, even if the binary executable changes.

So my question is :

Is there a way to make go run the signature command before running the compiled binary?

+5
source share
2 answers

Even simpler: start the server explicitly on localhost, for example:

 http.ListenAndServe("localhost:8080", nil) 

Recently, I wrote a small fragment:

suppressing-accept-incoming-network-connections-warnings-on-osx

+6
source

Stupid to me. It took me 5 minutes to write a question and 2 minutes to find the answer and write a script that solves it. I will post it here if anyone encounters the same problem.

 binary=$GOPATH/pkg/kliron/hiss/hiss.a go build -o $binary hiss/main.go codesign -f -s klironCode $binary --deep $binary " $@ " 

Just use go build .

+3
source

Source: https://habr.com/ru/post/1244003/


All Articles