I am using SSL Connection from Web Client (firefox) to connect to the local Server created via the code available in this link MDM server code I have all the required signed Certificates issued by Apple available for running the server, as well as all the depended python modules installed.
I ran my code using the following command on my Windows Machine.
python server.py .
This successfully start running the server at the port 8080.
C:\Users\Administrator\Desktop\MDMServer>python server.py <ip address>
Can't find MyApp.mobileprovision in current directory.
Need both MyApp.ipa and Manifest.plist to enable InstallCustomApp.
Starting Server
https://<ipaddress>:8080/
But whenever a Web Client tries to connect to this Server.
Upon launching the link https://<ip address>:8080 in the firefox. The Server reports the following error.
Traceback (most recent call last):
File "server.py", line 498, in <module>
app.run()
File "C:\Python27\lib\site-packages\web\application.py", line 313, in run
return wsgi.runwsgi(self.wsgifunc(*middleware))
File "C:\Python27\lib\site-packages\web\wsgi.py", line 54, in runwsgi
return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))
File "C:\Python27\lib\site-packages\web\httpserver.py", line 157, in runsimple
server.start()
File "C:\Python27\lib\site-packages\web\wsgiserver\__init__.py", line 1765, in
start
self.tick()
File "C:\Python27\lib\site-packages\web\wsgiserver\__init__.py", line 1815, in
tick
s, ssl_env = self.ssl_adapter.wrap(s)
File "C:\Python27\lib\site-packages\web\wsgiserver\ssl_builtin.py", line 42, i
n wrap
keyfile=self.private_key, ssl_version=ssl.PROTOCOL_SSLv23)
File "C:\Python27\lib\ssl.py", line 372, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 134, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 296, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:503: error:1408A0C1:SSL routines:SSL3_GET_CLIENT_
HELLO:no shared cipher
Can anyone help me understand:
1) What these errors mean
2) Why I'm getting them, It was not coming with the older version of server.py code applicable to iphone 4s?
3) How I can go about fixing these
Thanks,
Vivek
This is because APNSWrapper hasn't been updated to TLSv1 yet.
Apple no longer supports sslv3 for MDM due to the POODLE vulnerability.
You can update APNSWrapper source yourself though pretty easily.
download the source and update connection.py
ssl_version = self.ssl_module.PROTOCOL_TLSv1,
the run
python setup.py install
Related
After running "mtt start" i get this error message, what could be the cause of this and how can it be resolved?
/home/me/.local/lib/python3.6/site-packages/google/auth/crypt/_cryptography_rsa.py:22: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
import cryptography.exceptions
INFO|No lab config path set; using standalone mode config
INFO|Using image gcr.io/android-mtt/mtt:prod.
WARNING|No gcloud or service account json key file, can not login to https://gcr.io.
Traceback (most recent call last):
File "/home/me/.local/bin/mtt", line 11, in <module>
load_entry_point('Android-Test-Station-CLI===R30.202206.000', 'console_scripts', 'mtt')()
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/cli.py", line 1204, in Main
args.func(args)
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/cli.py", line 367, in Start
_StartMttNode(args, host)
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/cli.py", line 399, in _StartMttNode
if docker_helper.IsContainerRunning(args.name):
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/command_util.py", line 974, in IsContainerRunning
container_name, res.stderr, res.stdout))
multitest_transport.cli.command_util.DockerError: Failed to inpect mtt:
stderr:Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/mtt/json": dial unix /var/run/docker.sock: connect: permission denied
stdout:
.
I have 2 servers. I am attempting to setup one for continuous integration for my main website server
Web server 1(cloud-hosting):
Python3.6
Django3.1
Ubuntu16.04
Webserver 2(VPS):
Python3.7
Django3.1
Ubuntu16.04
Jenkins
--ShiningPanda(plugin)
Im new to web development, so if it seems odd as far as my web server types, that is why. I have been following along in the book Test Driven Development with Python. My issue is that when running python manage.py test [app] My [app] inherits from the class StaticLiveSever to generate a testing environment. On webserver 1, this works fine. On webserver 2, i get an error that the request address cannot be assigned. I use jenkins to build the environment, but the error i get is OSerror[99]:cannot assign requested address. I dont understand why this is happening when i run the same commands in Web Sever 1. It runs fine. Although again, the commands are run by jenkins and jenkins is configured to run python3.7
Full Traceback(Main Issue)
Traceback (most recent call last):
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/django/test/testcases.py", line 1449, in setUpClass
raise cls.server_thread.error
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/django/test/testcases.py", line 1374, in run
self.httpd = self._create_server()
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/django/test/testcases.py", line 1389, in _create_server
return ThreadedWSGIServer((self.host, self.port), QuietWSGIRequestHandler, allow_reuse_address=False)
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 67, in __init__
super().__init__(*args, **kwargs)
File "/usr/lib/python3.7/socketserver.py", line 452, in __init__
self.server_bind()
File "/usr/lib/python3.7/wsgiref/simple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "/usr/lib/python3.7/http/server.py", line 137, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 99] Cannot assign requested address
After hardcoded host
Traceback (most recent call last):
File "/var/lib/jenkins/workspace/Superlists/functional_tests/base.py", line 47, in setUp
self.browser = webdriver.Firefox()
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 100, in start
self.assert_process_still_running()
File "/var/lib/jenkins/shiningpanda/jobs/ddc1aed1/virtualenvs/d41d8cd9/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 113, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 69
geckodriver.log w/ hardcoded host ip in LiveTestServer
eckodriver: error: Address not available (os error 99)
geckodriver 0.27.0 (7b8c4f32cdde 2020-07-28 18:16 +0000)
WebDriver implementation for Firefox
USAGE:
geckodriver [FLAGS] [OPTIONS]
[...]
Hopefully the tracebacks above are not too confusing. Ultmiately what i did notice was the when im in webserver 2, i access the Django testcases.py module that has LiverServerThread and hardcode host=0.0.0.0 instead of host=localhost (1st traceback). The connection is then made although then the problem lies with geckodriver and the same thing (2nd traceback). I need to hard code ip 0.0.0.0 to be able to establish a connection, but then geckodriver is just listening, which i am assuming, at a completely different location (no error.log shown here).
So 1st id like to at least be able to make a connection to run the LiveServerThread class properly. Then try and resolve the issue with geckodriver. I also was not sure if the type of servers im running on poses as the problem.
I have a simple code running good using http (not secure) but then I update it to https a get an error about ssl.SSLCertVerificationError
I'm using a heroku server with a valid ssl of course, python 3.7.3 on a mac, ssl.OPENSSL_VERSION= 1.1.0, certifi=2019.3.9, Flask=1.0.2, Flask-SocketIO=3.3.2
Here is the code:
import socketio
sio = socketio.Client()
#sio.on('connect')
def on_connect():
print('Connected ...')
#sio.on('message')
def on_message(data):
print('I received a message!')
print(data)
if __name__ == '__main__':
sio.connect('https://heroku.server.url')
And this is what I get using https:
Traceback (most recent call last):
File "/Users/calavraian/Devel/Projects/FlaskTesting/Client.py", line 21, in <module>
sio.connect('https://heroku.server.url')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/socketio/client.py", line 208, in connect
engineio_path=socketio_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/engineio/client.py", line 166, in connect
url, headers, engineio_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/engineio/client.py", line 303, in _connect_polling
if self._connect_websocket(url, headers, engineio_path):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/engineio/client.py", line 341, in _connect_websocket
cookie=cookies)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websocket/_core.py", line 514, in create_connection
websock.connect(url, **options)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websocket/_core.py", line 223, in connect
options.pop('socket', None))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websocket/_http.py", line 126, in connect
sock = _ssl_socket(sock, options.sslopt, hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websocket/_http.py", line 260, in _ssl_socket
sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websocket/_http.py", line 239, in _wrap_sni_socket
server_hostname=hostname,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 853, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1117, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
Any ideas ?
Finally I made it work, I tried the same code on another Mac computer with the same software condition and it works fine, also on a PC with Ubuntu and a Raspberry Pi with Raspbian, everything works fine, so back again on the first Mac with the problem, I started to debug again, reinstalling and updating packages with pip and nothing happened.
Other solution that I have tried was to reinstall the certifi package with pip but nothing was fixed.
At the end, what solved the problem was running the script that comes with Python and is located in /Applications/Python 3.X/Install Certificates.command, you can run it directly from Finder with double clic on it or on a terminal go to the folder and execute it.
After doing this I tested python-socketio 3.1.2 and python-socketio 4.0.1 and everything works fine.
A final recommendation, in case that you are still getting the same error after try running the script, you can try an alternative to python-socketio, in the process to figure it out I have tried socketIO-client-2 when I was getting the error and this library worked good on the initial conditions (before running the script). After running the script above both are running perfect now.
I'm having trouble creating a working executable using PyInstaller. I've been able to successfully create a simple web server using Python and Bottle - but when I create my executable with PyInstaller and click it - I get the following output:
Alans-MBP:~ alanscarpa$ /Users/alanscarpa/Desktop/testSite/dist/testing ; exit;
Bottle v0.13-dev server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:80/
Hit Ctrl-C to quit.
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/bottle", line 3093, in run
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/bottle", line 2692, in run
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/wsgiref.simple_server", line 151, in make_server
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/SocketServer", line 420, in __init__
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/wsgiref.simple_server", line 48, in server_bind
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/BaseHTTPServer", line 108, in server_bind
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/SocketServer", line 434, in server_bind
File "/Users/alanscarpa/Desktop/testSite/build/testing/out00-PYZ.pyz/socket", line 224, in meth
socket.error: [Errno 13] Permission denied
logout
[Process completed]
The first 3 lines are perfect - and that's how it should look if working fine:
Bottle v0.13-dev server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:80/
Hit Ctrl-C to quit.
But then everything after that, messes up my program!
Here's my Python file called testing.py
#!/usr/bin/python
from bottle import route, run, template
#route('/testing')
def index():
return 'Hello..testing'
run(host='0.0.0.0', port=80, debug=True)
When I visit mylocalip/testing - I get webpage unavailable. But if I open up terminal and write: sudo /path/to/testing - it works perfectly. (I obviously want to be able to send the executable to someone and they just click it to run instead of having to use Terminal).
Any suggestions?
EDIT: I changed my port to 8080 and it's working! Anyone know why?
You can't listen on ports below 1024 without root privileges on most systems (at least BSD, OS X and Linux).
I have a long running python script, launched with upstart. This script makes quite a lot of requests. Everything works well at first, however after a few hours I start permanently getting the following error for each request:
File "/opt/a/a-env/local/lib/python2.7/site-packages/atom/client.py", line 119, in request
File "/opt/a/a-env/local/lib/python2.7/site-packages/atom/http_core.py", line 420, in request
File "/opt/a/a-env/local/lib/python2.7/site-packages/atom/http_core.py", line 489, in _http_request
File "/usr/lib/python2.7/httplib.py", line 931, in endheaders
File "/usr/lib/python2.7/httplib.py", line 794, in _send_output
File "/usr/lib/python2.7/httplib.py", line 756, in send
File "/usr/lib/python2.7/httplib.py", line 1134, in connect
File "/usr/lib/python2.7/socket.py", line 553, in create_connection
gaierror: [Errno -3] Temporary failure in name resolution
This is not a problem with name resolution or DNS, because a simple restart of the application fixes this problem.
I've tried both Python 2.6 a 2.7 and the same situation occurs.
I'm running Linux 2.6.35-30-virtual #61-Ubuntu SMP Tue Oct 11 18:26:36 UTC 2011 x86_64 GNU/Linux
There have been a few posts with this problem, but none with a straightforward explanation or solution:
https://github.com/ggstuart/greenview/issues/4
Permanent 'Temporary failure in name resolution' after running for a number of hours
I think this happens when you get in a "too many open files" condition. Next time this happens, try to see how many file descriptors your script has open.
The root cause is that /etc/resolv.conf is only read at python startup. To force a refresh of the resolve table, you can run this (on Linux):
import ctypes
libc = ctypes.cdll.LoadLibrary('libc.so.6')
res_init = libc.__res_init
res_init()