PlexConnect on FreeNAS can't login to MyPlex

When attempting “MyPlex Sign In” on Apple TV, I get an endlessly spinning progress wheel, and login never occurs.

I am running PlexConnect in its own jail on a FreeNAS box.

PlexConnect.log shows:

Traceback (most recent call last):
File “/PlexConnect/WebServer.py”, line 229, in do_GET
XML = XMLConverter.XML_PMS2aTV(PMSaddress, self.path + query, options)
File “/PlexConnect/XMLConverter.py”, line 241, in XML_PMS2aTV
(username, auth_token) = PlexAPI.MyPlexSignIn(parts[0], parts[1], options)
File “/PlexConnect/PlexAPI.py”, line 629, in MyPlexSignIn
response = urlopener.open(request).read()
File “/usr/local/lib/python2.7/urllib2.py”, line 431, in open
response = self._open(req, data)
File “/usr/local/lib/python2.7/urllib2.py”, line 449, in _open
‘_open’, req)
File “/usr/local/lib/python2.7/urllib2.py”, line 409, in _call_chain
result = func(*args)
File “/usr/local/lib/python2.7/urllib2.py”, line 1240, in https_open
context=self._context)
File “/usr/local/lib/python2.7/urllib2.py”, line 1197, in do_open
raise URLError(err)
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

I saw what appeared to be a promising suggestion on the following GitHub issue page: https://github.com/iBaa/PlexConnect/issues/341 . However, even after making the suggested changes to lines 38 and 378 of PlexAPI.py, the issue persists.

Thanks in advance for any help!

Cheers,
Kevan

Did you create the certificates on the Plex connect vm? And also did you set the atv network dns server to the ip of the plexconnect vm ?

I have the same set up.

@BillyPrefect said:
Did you create the certificates on the Plex connect vm? And also did you set the atv network dns server to the ip of the plexconnect vm ?

I have the same set up.

Yes, I copied over certificates from a previous install of PlexConnect that had been running on a Windows machine.

And yes, DNS is set up correctly.

FYI, everything else is running fine, i.e. I am able to browse the Plex server and play movie files. I am only running into issues when I try to log in to MyPlex.

It’s not the certificate on aTV, that’s for sure.
Somehow your NAS/python doesn’t seem to accept the certificate if the host plex.tv.
Are you on python 2.7.9, too?

Yes, Python 2.7.9
and OpenSSL 0.9.8za-freebsd 5 Jun 2014

I have been able to successfully implement the workaround for this issue described at https://github.com/iBaa/PlexConnect/issues/341 . It turned out that it was just a typo on my part that had foiled my previous attempt. Oops.

So I’m able to log in now, but I think that the workaround bypasses SSL altogether (correct me if I’m wrong, I’m not a Python programmer) and so this is likely an issue that still needs fixing.

Thanks to everyone for weighing in…

Kevan

Argh, I spoke to soon. Although the workaround does allow me to log in successfully, and I can browse the server, now all artwork shows up as flat grey rectangles, and any attempt to play media results in “An error occurred loading this content”.

Looks like your aTV doesn’t have a direct link to your PMS. When logged in, you now get encrypted/https connection, which relies on the resolution of the host .plex.direct, which needs to point back to your server. Check you router, it needs to have “rebind to local network” allowed.

The mentioned work around uses unverified SSL. You communication is encrypted but susceptible to anyone that can spoof your DNS and route you to their server as the certificate is not being verified. Use with caution depending on how much you value your plex account. :wink:

From what I can tell the code never did SSL verification. Apparently older versions of Python with the the library allowed the request to go unverified without throwing an exception.

It looks like plexconnect needs a re-write to handle SSL validation correctly.