Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent OSX popup for incoming connections for Python app?

I am developing a simple python3 server app. I invoke it like this:

python3 bbserver.py

Each time after doing this I get the OSX popup:

Do you want the application “Python.app” to accept incoming network connections?

I've tried making an exception for python3 executable (there is no python3.app) in the firewall and have tried code signing with a codesign certificate thus:

codesign -f -s mycodecert /Library/Frameworks/Python.framework/Versions/3.4/bin/python3 --deep

No luck.

like image 776
Mark Murphy Avatar asked Feb 04 '15 19:02

Mark Murphy


1 Answers

If you are using a virtualenv or anything similar you could be signing the wrong version of python.

sudo codesign --force --deep --sign - $(which python)

To check the status of the certificate that was used to sign an app:

codesign -dv /Library/Frameworks/Python.framework/Versions/3.4/bin/python3
codesign -dv $(which python)

Example Unsigned:

hostname ~ $ codesign -dv $(which python)
/usr/local/bin/python: code object is not signed at all

Example Signed:

hostname ~ $ workon py27
(py27)hostname ~/py27 $ codesign -dv $(which python)
Executable=/Users/me/.virtualenvs/py27/bin/python
Identifier=python-555549446408a33553ca3f479122ce9278a9a269
Format=Mach-O universal (i386 x86_64)
CodeDirectory v=20100 size=196 flags=0x2(adhoc) hashes=3+2 location=embedded
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=136
like image 76
Luke Exton Avatar answered Oct 15 '22 15:10

Luke Exton