FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

pair-pin-start #33

Closed mikeyjoel closed 2 years ago

mikeyjoel commented 2 years ago

I can't mirror since it requires a PIN and there is no option described in the man pages or help to set it. Running uxplay -d provides the following:

using system MAC address xx:xx:xx:xx:xx:xx
Initialized server socket(s)
Accepted IPv4 client on socket 38
Local: 192.168.1.10
Remote: 192.168.1.155
Open connections: 1
httpd receiving on socket 38
conn_request
Handling request GET with URL /info
INFO len = 1879041996
httpd receiving on socket 38
conn_request
Handling request POST with URL /pair-pin-start
httpd receiving on socket 38
Connection closed for socket 38
Destroying connection
Open connections: 0
uname -rsm
Linux 5.15.5-arch1-1 x86_64
fduncanh commented 2 years ago

This should definitely not happen.

Please give details about the client (iPad or Phone etc.) that is trying to connect to UxPlay what version of iOS, etc. Below is a working example of uxplay -d for the interaction with a client iOS 15.1 iPad: It should pair without asking for a PIN

using system MAC address xx:xx:xx:xx:xx:xx
Initialized server socket(s)
Accepted IPv4 client on socket 30
Local: 192.168.2.8
Remote: 192.168.2.138
Open connections: 1
httpd receiving on socket 30
conn_request
Handling request GET with URL /info
INFO len = 1073735620
httpd receiving on socket 30
conn_request
Handling request POST with URL /pair-setup
httpd receiving on socket 30
conn_request
Handling request POST with URL /pair-verify
httpd receiving on socket 30
conn_request
Handling request POST with URL /pair-verify
httpd receiving on socket 30
conn_request
Handling request POST with URL /fp-setup
httpd receiving on socket 30
conn_request
Handling request POST with URL /fp-setup
httpd receiving on socket 30
conn_request
Handling request SETUP with URL rtsp://192.168.1.100/12920992891964572425
DACP-ID: 262BE4D1A5C6CA1
Active-Remote: 793252252
Transport: null
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>et</key>
        <integer>32</integer>
        <key>eiv</key>
        <data>
        pztqog3MMxDUGNM0ybrXmw==
        </data>
        <key>timingProtocol</key>
        <string>NTP</string>
        <key>sessionUUID</key>
        <string>B3509693-AEE5-4309-8D0E-8A0849921D95</string>
        <key>diagnosticsAndUsage</key>
        <true/>
        <key>osName</key>
        <string>iPhone OS</string>
        <key>osBuildVersion</key>
        <string>19B74</string>
        <key>sourceVersion</key>
        <string>595.13.1</string>
        <key>timingPort</key>
        <integer>49207</integer>
        <key>isScreenMirroringSession</key>
        <true/>
        <key>osVersion</key>
        <string>15.1</string>
        <key>ekey</key>
        <data>
        RlBMWQECAQAAAAA8AAAAABs2LLwImeq8vVu2DbNhJsUAAAAQXsWpM7AChKkaZaHpyn5f
        al3tn8dfAFoara9IKcabOH4CuxBr
        </data>
        <key>internalBuild</key>
        <false/>
        <key>deviceID</key>
        <string>60:8B:0E:27:C4:D6</string>
        <key>model</key>
        <string>iPad7,11</string>
        <key>name</key>
        <string>F D’s iPad</string>
        <key>macAddress</key>
        <string>3A:48:5B:30:FC:AF</string>
</dict>
</plist>

SETUP 1
eiv_len = 16
ekey_len = 72
fairplay_decrypt ret = 0
timing_rport = 49207
fduncanh commented 2 years ago

If the client is emulating an iOS device ( like airparrot3 or airmypc on a WIndows laptop), unfortunately they use an older legacy AirPlay protocol that isnt supported on UxPlay at this time.

fduncanh commented 2 years ago

"pair-pin-start" is not among the client requests that are recognized by UxPlay, and I have never seen it before. UxPlay tells the client a pin is not needed. I hope Apple havent changed something, but I dont see any update of iOS that came out in the last day or two.

fduncanh commented 2 years ago

There is some discussion of pin-pair-start here, but you are the first of many users to have this issue.

https://htmlpreview.github.io/?https://github.com/philippe44/RAOP-Player/blob/master/doc/auth_protocol.html

fduncanh commented 2 years ago

A real Apple TV would require a pin, but UxPlay does not. The issue is , why is your client device asking for a pin setup?

mikeyjoel commented 2 years ago

Thanks for this information. I went ahead and tried with a different iPad on the latest version of iOS 15.1. After checking our MDM solution(Jamf) our Configuration Profile was requiring Pin Code. I have created a test configuration profile and will be testing. For now it's working fine on our Arch Linux servers. Consider this to be closed and as a lesson for those that are using MDM to manage and keep track of their iPads. Thank you so much for your prompt response, Cheers! Screenshot_2021-11-29_18-12-17

fduncanh commented 2 years ago

Whew! Glad to know that Apple hadn't released some change that broke UxPlay!

mikeyjoel commented 2 years ago

Nope, nothing broken. Just a little bit of restrictions on our side with the configuration profile we are using. Good to be aware of nevertheless!

fduncanh commented 2 years ago

I added an explanatory warning output that MDM has been applied when "pair-pin-start" is requested, and tried to use Apple's small-org MDM solution "Apple Configurator" to add the profile to an iPad. I tried to add the "require pin" behavior to the iPad but the iPad doesn't seem to care (it didn't t ask for the pin) so I haven't been able to test. (not sure what I am doing wrong with the apple configurator)

If you are able to test (on a fresh github checkout) I would be grateful!

uxplay without the "-d" option should produce a message (coded in lib/raop.c line 181)


    } else if (!strcmp(method, "POST") && !strcmp(url, "/pair-pin-start")) {
       logger_log(conn->raop->logger, LOGGER_INFO, "Unsupported client request %s with URL %s", method, url);
       logger_log(conn->raop->logger, LOGGER_INFO, "AirPlay client has requested PIN as implemented on  AppleTV,");
       logger_log(conn->raop->logger, LOGGER_INFO, "but UxPlay does not require a PIN and cannot supply one.");
       logger_log(conn->raop->logger, LOGGER_INFO, "This client behavior may be controlled by mobile device management (MDM)");
       logger_log(conn->raop->logger, LOGGER_INFO, "(such as Apple Configurator or a third-party MDM tool).");
mikeyjoel commented 2 years ago

@fduncanh no problem, happy to help.

UxPlay-master Ran into an issue getting the Passcode to work on both skipped and Required. Required Screenshot_2021-11-30_19-03-50 Skipped Screenshot_2021-11-30_19-05-52 Skipped with -d image

UxPlay-1.42h Works as intended if I have Skipped on the configuration profile. Screenshot_2021-11-30_19-07-12

Let me know if you need to make any changes on your end or if I need to do anything to get the master to work.

fduncanh commented 2 years ago

Hmmm. I want master to issue a warning if Passcode "required", rather than fail silently, and work (like 1.42 h when it is "skipped". OK, I left in something I used for testing to make it not do pair-setup. Fixed in master. My bad. master will now work with "skipped", need to see why no error message when "required".

fduncanh commented 2 years ago

please check if master now works as expected with Passcode "skipped" (uxplay, without "-d") and that it produces an error message with Passcode "required" (use uxplay -d to see debug messages ). Thanks

message should be

*** ERROR: Unsupported client request POST with URL /pair-pin-start
*** AirPlay client has requested PIN as implemented on AppleTV,
*** but UxPlay does not require a PIN and cannot supply one.
*** This client behavior may have been required by mobile device management (MDM)
*** (such as Apple Configurator or a third-party MDM tool).