move the mobileconfig into the conf directory as a plain XML file and handle substitutions and copying to /var in web.sh
This commit is contained in:
parent
7db80458dd
commit
b04addda9a
|
@ -4,4 +4,3 @@ management/__pycache__/
|
|||
tools/__pycache__/
|
||||
externals/
|
||||
.env
|
||||
.vagrant
|
||||
|
|
|
@ -1,28 +1,22 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# iOS Configuration Profile
|
||||
# ----------------------------------------------
|
||||
#
|
||||
# Mobileconfig for iOS users to setup IMAP, Contacts & Calendars
|
||||
#
|
||||
# https://developer.apple.com/library/ios/featuredarticles/iPhoneConfigurationProfileRef/Introduction/Introduction.html
|
||||
|
||||
source setup/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
echo "Generate iOS Configuration Profile"
|
||||
|
||||
echo "<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?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">
|
||||
<!--
|
||||
iOS Configuration Profile
|
||||
----------------------------------------------
|
||||
|
||||
Mobileconfig for iOS users to setup IMAP, Contacts & Calendars
|
||||
|
||||
https://developer.apple.com/library/ios/featuredarticles/iPhoneConfigurationProfileRef/Introduction/Introduction.html
|
||||
-->
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PayloadContent</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CalDAVAccountDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME calendar</string>
|
||||
<string>PRIMARY_HOSTNAME calendar</string>
|
||||
<key>CalDAVHostName</key>
|
||||
<string>$PRIMARY_HOSTNAME</string>
|
||||
<string>PRIMARY_HOSTNAME</string>
|
||||
<key>CalDAVPort</key>
|
||||
<real>443</real>
|
||||
<key>CalDAVPrincipalURL</key>
|
||||
|
@ -30,29 +24,29 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
|
|||
<key>CalDAVUseSSL</key>
|
||||
<true/>
|
||||
<key>PayloadDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>$PRIMARY_HOSTNAME calendar</string>
|
||||
<string>PRIMARY_HOSTNAME calendar</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME.CalDAV</string>
|
||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.CalDAV</string>
|
||||
<key>PayloadOrganization</key>
|
||||
<string></string>
|
||||
<key>PayloadType</key>
|
||||
<string>com.apple.caldav.account</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>$(cat /proc/sys/kernel/random/uuid)</string>
|
||||
<string>UUID1</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>EmailAccountDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME mail</string>
|
||||
<string>PRIMARY_HOSTNAME mail</string>
|
||||
<key>EmailAccountType</key>
|
||||
<string>EmailTypeIMAP</string>
|
||||
<key>IncomingMailServerAuthentication</key>
|
||||
<string>EmailAuthPassword</string>
|
||||
<key>IncomingMailServerHostName</key>
|
||||
<string>$PRIMARY_HOSTNAME</string>
|
||||
<string>PRIMARY_HOSTNAME</string>
|
||||
<key>IncomingMailServerPortNumber</key>
|
||||
<integer>993</integer>
|
||||
<key>IncomingMailServerUseSSL</key>
|
||||
|
@ -60,7 +54,7 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
|
|||
<key>OutgoingMailServerAuthentication</key>
|
||||
<string>EmailAuthPassword</string>
|
||||
<key>OutgoingMailServerHostName</key>
|
||||
<string>$PRIMARY_HOSTNAME</string>
|
||||
<string>PRIMARY_HOSTNAME</string>
|
||||
<key>OutgoingMailServerPortNumber</key>
|
||||
<integer>587</integer>
|
||||
<key>OutgoingMailServerUseSSL</key>
|
||||
|
@ -68,17 +62,17 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
|
|||
<key>OutgoingPasswordSameAsIncomingPassword</key>
|
||||
<true/>
|
||||
<key>PayloadDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>$PRIMARY_HOSTNAME mail</string>
|
||||
<string>PRIMARY_HOSTNAME mail</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME.E-Mail</string>
|
||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.E-Mail</string>
|
||||
<key>PayloadOrganization</key>
|
||||
<string></string>
|
||||
<key>PayloadType</key>
|
||||
<string>com.apple.mail.managed</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>$(cat /proc/sys/kernel/random/uuid)</string>
|
||||
<string>UUID2</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>PreventAppSheet</key>
|
||||
|
@ -90,9 +84,9 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
|
|||
</dict>
|
||||
<dict>
|
||||
<key>CardDAVAccountDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME contacts</string>
|
||||
<string>PRIMARY_HOSTNAME contacts</string>
|
||||
<key>CardDAVHostName</key>
|
||||
<string>$PRIMARY_HOSTNAME</string>
|
||||
<string>PRIMARY_HOSTNAME</string>
|
||||
<key>CardDAVPort</key>
|
||||
<integer>443</integer>
|
||||
<key>CardDAVPrincipalURL</key>
|
||||
|
@ -100,27 +94,27 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
|
|||
<key>CardDAVUseSSL</key>
|
||||
<true/>
|
||||
<key>PayloadDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>$PRIMARY_HOSTNAME contacts</string>
|
||||
<string>PRIMARY_HOSTNAME contacts</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME.carddav</string>
|
||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.carddav</string>
|
||||
<key>PayloadOrganization</key>
|
||||
<string></string>
|
||||
<key>PayloadType</key>
|
||||
<string>com.apple.carddav.account</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>$(cat /proc/sys/kernel/random/uuid)</string>
|
||||
<string>UUID3</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PayloadDescription</key>
|
||||
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>$PRIMARY_HOSTNAME</string>
|
||||
<string>PRIMARY_HOSTNAME</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME</string>
|
||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME</string>
|
||||
<key>PayloadOrganization</key>
|
||||
<string></string>
|
||||
<key>PayloadRemovalDisallowed</key>
|
||||
|
@ -128,8 +122,8 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
|
|||
<key>PayloadType</key>
|
||||
<string>Configuration</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>$(cat /proc/sys/kernel/random/uuid)</string>
|
||||
<string>UUID4</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</plist>" > "/var/lib/mailinabox/mobileconfig.xml";
|
||||
</plist>
|
|
@ -125,7 +125,6 @@ source setup/webmail.sh
|
|||
source setup/owncloud.sh
|
||||
source setup/zpush.sh
|
||||
source setup/management.sh
|
||||
source setup/mobileconfig.sh
|
||||
|
||||
# Write the DNS and nginx configuration files.
|
||||
sleep 5 # wait for the daemon to start
|
||||
|
|
13
setup/web.sh
13
setup/web.sh
|
@ -40,6 +40,19 @@ tools/editconf.py /etc/php5/fpm/pool.d/www.conf -c ';' \
|
|||
# since it depends on what domains we're serving, which we don't know
|
||||
# until mail accounts have been created.
|
||||
|
||||
# Create the iOS Mobile Configuration file which is exposed via the
|
||||
# nginx configuration at /mailinabox-mobileconfig.
|
||||
mkdir -p /var/lib/mailinabox
|
||||
chmod a+rx /var/lib/mailinabox
|
||||
cat conf/ios-profile.xml \
|
||||
| sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \
|
||||
| sed "s/UUID1/$(cat /proc/sys/kernel/random/uuid)/" \
|
||||
| sed "s/UUID2/$(cat /proc/sys/kernel/random/uuid)/" \
|
||||
| sed "s/UUID3/$(cat /proc/sys/kernel/random/uuid)/" \
|
||||
| sed "s/UUID4/$(cat /proc/sys/kernel/random/uuid)/" \
|
||||
> /var/lib/mailinabox/mobileconfig.xml
|
||||
chmod a+r /var/lib/mailinabox/mobileconfig.xml
|
||||
|
||||
# make a default homepage
|
||||
if [ -d $STORAGE_ROOT/www/static ]; then mv $STORAGE_ROOT/www/static $STORAGE_ROOT/www/default; fi # migration #NODOC
|
||||
mkdir -p $STORAGE_ROOT/www/default
|
||||
|
|
Loading…
Reference in New Issue