Class: mobileconfig_superclass
Source Location: /devices/apple_mobileconfig/mobileconfig_superclass.php
Class mobileconfig_superclass
Class Overview
This is the main implementation class of the module
The class should only define one public method: writeInstaller. All other methods and properties should be private. This example sets zipInstaller method to protected, so that it can be seen in the documentation.
Located in /devices/apple_mobileconfig/mobileconfig_superclass.php [line 34]
DeviceConfig
|
--mobileconfig_superclass
Author(s):
API Tags:
Information Tags:
|
Methods
|
Inherited Properties, Constants, and Methods
Method Summary
void |
writeInstaller() |
prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer |
Methods
prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer
/** run innitial setup
this will:
- create the temporary directory and save its path as $this->FPATH
- process the CA certificates and store results in $this->attributes['internal:CAs'][0]
$this->attributes['internal:CAs'][0] is an array of processed CA certificates
a processed certifincate is an array
'pem' points to pem feromat certificate
'der' points to der format certificate
'md5' points to md5 fingerprint
'sha1' points to sha1 fingerprint
'name' points to the certificate subject
'root' can be 1 for self-signed certificate or 0 otherwise
- save the info_file (if exists) and put the name in $this->attributes['internal:info_file_name'][0]
*/
$dom = textdomain(NULL);
textdomain("devices");
debug(4, "mobileconfig Module Installer start\n");
// remove spaces and slashes (filename!), make sure it's simple ASCII only, then lowercase it
// also escape htmlspecialchars
// inst and profile MUST NOT be empty (needed to construct apple OID strings)
if ($this->massaged_inst == "")
$this->massaged_inst = "unnamed-inst";
if ($this->massaged_profile == "")
$this->massaged_profile = "unnamed-profile";
if (isset ($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset ($this->attributes['internal:realm'])) {
$use_realm = "@" . $this->attributes['internal:realm'][0];
if (isset ($this->attributes['internal:anon_local_value']))
$use_realm = $this->attributes['internal:anon_local_value'][0] . $use_realm;
}
else {
$use_realm = 0;
}
$OI_list = $this->attributes['internal:consortia'];
$server_names = $this->attributes['eap:server_name'];
$uuid_list = $this->list_ca_uuids($this->attributes['internal:CAs'][0]);
$output_xml = "";
$output_xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>PayloadContent</key>
<array>";
// did the admin want wired config?
if (isset ($this->attributes['media:wired']) && __CLASS__ == "Device_mobileconfig_os_x")
$include_wired = TRUE;
else
$include_wired = FALSE;
$output_xml .= $this->all_network_blocks($ssid_list, $OI_list, $server_names, $uuid_list, $eap_type, $include_wired, $use_realm);
$output_xml .= $this->all_ca($this->attributes['internal:CAs'][0]);
$output_xml .= "
</array>
<key>PayloadDescription</key>
<key>PayloadDisplayName</key>
<string>" . Config::$CONSORTIUM['name'] . "</string>
<key>PayloadIdentifier</key>
<string>" . mobileconfig_superclass::$IPHONE_PAYLOAD_PREFIX . ".$this->massaged_consortium.$this->massaged_country.$this->massaged_inst.$this->massaged_profile.$this->lang</string>
<key>PayloadOrganization</key>
<string>" . $this->attributes['general:instname'][0] . ( $this->attributes['internal:profile_count'][0] > 1 ? " (" . $this->attributes['profile:name'][0] . ")" : "") . "</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>" . uuid('',mobileconfig_superclass::$IPHONE_PAYLOAD_PREFIX . $this->massaged_consortium . $this->massaged_country . $this->massaged_inst . $this->attributes['profile:name'][0]) . "</string>
<key>PayloadVersion</key>
<integer>1</integer>";
if (isset ($this->attributes['support:info_file']))
$output_xml .= "
<key>ConsentText</key>
<dict>
<key>default</key>
</dict>
";
$output_xml .= "</dict></plist>";
$xml_f = fopen('installer_profile', 'w');
$o = system($this->sign . " installer_profile '$e' > /dev/null");
if ($o === FALSE)
debug(2, "Signing the mobileconfig installer $e FAILED!\n");
}
else
rename("installer_profile", $e);
textdomain($dom);
return $e;
}
API Tags:
Redefinition of:
- DeviceConfig::writeInstaller()
- placeholder for the main device method
|
|