Profile Installation Failed – A connection to the server could not be established

Im trying to build a Website to grab the UDID after downloading a Profile.

Im following this Guide https://github.com/MerchV/Get-iOS-UDID

When i try to download the profile i click the Install Button and then i get this Error Message "Profile Installation Failed – A connection to the server could not be established.


i have a Ubuntu 14.04 LAMP Server provided by DigitalOcean
with an SSL provided by CertBot (https://certbot.eff.org/#ubuntutyakkety-apache)
and i got an 1 Year Developer Account by Apple.

i made a Private Application which can be downloaded over Web (with valid SSL) if the UDID is registered in the Apple Dev Portal.

Thats why i need a implemented UDID Grabber.
but it seems reject the Connection if i try to download the Profile.
i changed all the infos that are listed and it works until i try to install it and then it says "Could not download from the Server"

i even tried to sign it with an ssl but then it bricks the mobileconfig file.

i also tried to change the PayloadUUID with a generated one by using the Command uuidgen in Terminal or by modifying the PayloadIdentifier but that also wont work.

i hope Somebody can help me 🙂

My enroll.mobileconfig

<?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>PayloadContent</key>

<dict>

<key>URL</key>

<string>https://vezuure.me/temp/done.php</string>

<key>DeviceAttributes</key>

<array>

<string>DEVICE_NAME</string>

<string>UDID</string>

<string>PRODUCT</string>

<string>VERSION</string>

<string>SERIAL</string>

</array>

</dict>

<key>PayloadOrganization</key>

<string>example</string>

<key>PayloadDisplayName</key>

<string>Profile Service</string>

<key>PayloadVersion</key>

<integer>1</integer>

<key>PayloadUUID</key>

<string>CC9E1CFD-F89F-4987-AF17-F60CDB7AA64F</string>

<key>PayloadIdentifier</key>

<string>web.me.vezuure.udid</string>

<key>PayloadDescription</key>

<string>example</string>

<key>PayloadType</key>

<string>Profile Service</string>

</dict>

</plist>



my done.php

<?php



$data = file_get_contents('php://input');

$plistBegin = '<?xml version="1.0"';

$plistEnd = '</plist>';

$pos1 = strpos($data, $plistBegin);

$pos2 = strpos($data, $plistEnd);

$data2 = substr ($data,$pos1,$pos2-$pos1);

$xml = xml_parser_create();

xml_parse_into_struct($xml, $data2, $vs);

xml_parser_free($xml);

$UDID = "";

$CHALLENGE = "";

$DEVICE_NAME = "";

$DEVICE_PRODUCT = "";

$DEVICE_VERSION = "";

$iterator = 0;

$arrayCleaned = array();

foreach($vs as $v){

if($v['level'] == 3 && $v['type'] == 'complete'){

$arrayCleaned[]= $v;

}

$iterator++;

}

$data = "";

$iterator = 0;

foreach($arrayCleaned as $elem){

$data .= "\n==".$elem['tag']." -> ".$elem['value']."<br/>";

switch ($elem['value']) {

case "CHALLENGE":

$CHALLENGE = $arrayCleaned[$iterator+1]['value'];

break;

case "DEVICE_NAME":

$DEVICE_NAME = $arrayCleaned[$iterator+1]['value'];

break;

case "PRODUCT":

$DEVICE_PRODUCT = $arrayCleaned[$iterator+1]['value'];

break;

case "UDID":

$UDID = $arrayCleaned[$iterator+1]['value'];

break;

case "VERSION":

$DEVICE_VERSION = $arrayCleaned[$iterator+1]['value'];

break;

}

$iterator++;

}

$params = "UDID=".$UDID."&CHALLENGE=".$CHALLENGE."&DEVICE_NAME=".$DEVICE_NAME."&DEVICE_PRODUCT=".$DEVICE_PRODUCT."&DEVICE_VERSION=".$DEVICE_VERSION;

header('Location: https://vezuure.me/temp/complete?'.$params);

?>



This took me a long time to root through and figure out what was happening. For me, checking the server logs proved vital to getting this to work. Here's what I did.

I am using an Apache server with the ability to override some functionality through .htaccess files.

The server logs showed that all requests coming from the profile installation service were causing a 403 server error. It turns out my server did not like something about the data being posted (it definitely didn't like the User-Agent either).

My fix was to add an ErrorDocument to the .htaccess file and point it to my script - if this is what you are running into also, then, your example should work if you add the following line to your root .htaccess file.

Code Block
ErrorDocument 403 /temp/done.php


Finally, if you don't want all 403 errors going to that script you can test that the request is coming from the Profile installation service like so:

Code Block
if ($_SERVER["CONTENT_TYPE"] === "application/pkcs7-signature") { ... }



Profile Installation Failed – A connection to the server could not be established
 
 
Q