Commit b04addda authored by Joshua Tauberer's avatar Joshua Tauberer

move the mobileconfig into the conf directory as a plain XML file and handle...

move the mobileconfig into the conf directory as a plain XML file and handle substitutions and copying to /var in web.sh
parent 7db80458
...@@ -4,4 +4,3 @@ management/__pycache__/ ...@@ -4,4 +4,3 @@ management/__pycache__/
tools/__pycache__/ tools/__pycache__/
externals/ externals/
.env .env
.vagrant
#!/bin/bash <?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 <!--
# ---------------------------------------------- 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" Mobileconfig for iOS users to setup IMAP, Contacts & Calendars
echo "<?xml version="1.0" encoding="UTF-8"?> https://developer.apple.com/library/ios/featuredarticles/iPhoneConfigurationProfileRef/Introduction/Introduction.html
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -->
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>PayloadContent</key> <key>PayloadContent</key>
<array> <array>
<dict> <dict>
<key>CalDAVAccountDescription</key> <key>CalDAVAccountDescription</key>
<string>$PRIMARY_HOSTNAME calendar</string> <string>PRIMARY_HOSTNAME calendar</string>
<key>CalDAVHostName</key> <key>CalDAVHostName</key>
<string>$PRIMARY_HOSTNAME</string> <string>PRIMARY_HOSTNAME</string>
<key>CalDAVPort</key> <key>CalDAVPort</key>
<real>443</real> <real>443</real>
<key>CalDAVPrincipalURL</key> <key>CalDAVPrincipalURL</key>
...@@ -30,29 +24,29 @@ echo "<?xml version="1.0" encoding="UTF-8"?> ...@@ -30,29 +24,29 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
<key>CalDAVUseSSL</key> <key>CalDAVUseSSL</key>
<true/> <true/>
<key>PayloadDescription</key> <key>PayloadDescription</key>
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string> <string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
<key>PayloadDisplayName</key> <key>PayloadDisplayName</key>
<string>$PRIMARY_HOSTNAME calendar</string> <string>PRIMARY_HOSTNAME calendar</string>
<key>PayloadIdentifier</key> <key>PayloadIdentifier</key>
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME.CalDAV</string> <string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.CalDAV</string>
<key>PayloadOrganization</key> <key>PayloadOrganization</key>
<string></string> <string></string>
<key>PayloadType</key> <key>PayloadType</key>
<string>com.apple.caldav.account</string> <string>com.apple.caldav.account</string>
<key>PayloadUUID</key> <key>PayloadUUID</key>
<string>$(cat /proc/sys/kernel/random/uuid)</string> <string>UUID1</string>
<key>PayloadVersion</key> <key>PayloadVersion</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
<dict> <dict>
<key>EmailAccountDescription</key> <key>EmailAccountDescription</key>
<string>$PRIMARY_HOSTNAME mail</string> <string>PRIMARY_HOSTNAME mail</string>
<key>EmailAccountType</key> <key>EmailAccountType</key>
<string>EmailTypeIMAP</string> <string>EmailTypeIMAP</string>
<key>IncomingMailServerAuthentication</key> <key>IncomingMailServerAuthentication</key>
<string>EmailAuthPassword</string> <string>EmailAuthPassword</string>
<key>IncomingMailServerHostName</key> <key>IncomingMailServerHostName</key>
<string>$PRIMARY_HOSTNAME</string> <string>PRIMARY_HOSTNAME</string>
<key>IncomingMailServerPortNumber</key> <key>IncomingMailServerPortNumber</key>
<integer>993</integer> <integer>993</integer>
<key>IncomingMailServerUseSSL</key> <key>IncomingMailServerUseSSL</key>
...@@ -60,7 +54,7 @@ echo "<?xml version="1.0" encoding="UTF-8"?> ...@@ -60,7 +54,7 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
<key>OutgoingMailServerAuthentication</key> <key>OutgoingMailServerAuthentication</key>
<string>EmailAuthPassword</string> <string>EmailAuthPassword</string>
<key>OutgoingMailServerHostName</key> <key>OutgoingMailServerHostName</key>
<string>$PRIMARY_HOSTNAME</string> <string>PRIMARY_HOSTNAME</string>
<key>OutgoingMailServerPortNumber</key> <key>OutgoingMailServerPortNumber</key>
<integer>587</integer> <integer>587</integer>
<key>OutgoingMailServerUseSSL</key> <key>OutgoingMailServerUseSSL</key>
...@@ -68,17 +62,17 @@ echo "<?xml version="1.0" encoding="UTF-8"?> ...@@ -68,17 +62,17 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
<key>OutgoingPasswordSameAsIncomingPassword</key> <key>OutgoingPasswordSameAsIncomingPassword</key>
<true/> <true/>
<key>PayloadDescription</key> <key>PayloadDescription</key>
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string> <string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
<key>PayloadDisplayName</key> <key>PayloadDisplayName</key>
<string>$PRIMARY_HOSTNAME mail</string> <string>PRIMARY_HOSTNAME mail</string>
<key>PayloadIdentifier</key> <key>PayloadIdentifier</key>
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME.E-Mail</string> <string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.E-Mail</string>
<key>PayloadOrganization</key> <key>PayloadOrganization</key>
<string></string> <string></string>
<key>PayloadType</key> <key>PayloadType</key>
<string>com.apple.mail.managed</string> <string>com.apple.mail.managed</string>
<key>PayloadUUID</key> <key>PayloadUUID</key>
<string>$(cat /proc/sys/kernel/random/uuid)</string> <string>UUID2</string>
<key>PayloadVersion</key> <key>PayloadVersion</key>
<integer>1</integer> <integer>1</integer>
<key>PreventAppSheet</key> <key>PreventAppSheet</key>
...@@ -90,9 +84,9 @@ echo "<?xml version="1.0" encoding="UTF-8"?> ...@@ -90,9 +84,9 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
</dict> </dict>
<dict> <dict>
<key>CardDAVAccountDescription</key> <key>CardDAVAccountDescription</key>
<string>$PRIMARY_HOSTNAME contacts</string> <string>PRIMARY_HOSTNAME contacts</string>
<key>CardDAVHostName</key> <key>CardDAVHostName</key>
<string>$PRIMARY_HOSTNAME</string> <string>PRIMARY_HOSTNAME</string>
<key>CardDAVPort</key> <key>CardDAVPort</key>
<integer>443</integer> <integer>443</integer>
<key>CardDAVPrincipalURL</key> <key>CardDAVPrincipalURL</key>
...@@ -100,27 +94,27 @@ echo "<?xml version="1.0" encoding="UTF-8"?> ...@@ -100,27 +94,27 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
<key>CardDAVUseSSL</key> <key>CardDAVUseSSL</key>
<true/> <true/>
<key>PayloadDescription</key> <key>PayloadDescription</key>
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string> <string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
<key>PayloadDisplayName</key> <key>PayloadDisplayName</key>
<string>$PRIMARY_HOSTNAME contacts</string> <string>PRIMARY_HOSTNAME contacts</string>
<key>PayloadIdentifier</key> <key>PayloadIdentifier</key>
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME.carddav</string> <string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.carddav</string>
<key>PayloadOrganization</key> <key>PayloadOrganization</key>
<string></string> <string></string>
<key>PayloadType</key> <key>PayloadType</key>
<string>com.apple.carddav.account</string> <string>com.apple.carddav.account</string>
<key>PayloadUUID</key> <key>PayloadUUID</key>
<string>$(cat /proc/sys/kernel/random/uuid)</string> <string>UUID3</string>
<key>PayloadVersion</key> <key>PayloadVersion</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
</array> </array>
<key>PayloadDescription</key> <key>PayloadDescription</key>
<string>$PRIMARY_HOSTNAME (Mail-in-a-Box)</string> <string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
<key>PayloadDisplayName</key> <key>PayloadDisplayName</key>
<string>$PRIMARY_HOSTNAME</string> <string>PRIMARY_HOSTNAME</string>
<key>PayloadIdentifier</key> <key>PayloadIdentifier</key>
<string>email.mailinabox.mobileconfig.$PRIMARY_HOSTNAME</string> <string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME</string>
<key>PayloadOrganization</key> <key>PayloadOrganization</key>
<string></string> <string></string>
<key>PayloadRemovalDisallowed</key> <key>PayloadRemovalDisallowed</key>
...@@ -128,8 +122,8 @@ echo "<?xml version="1.0" encoding="UTF-8"?> ...@@ -128,8 +122,8 @@ echo "<?xml version="1.0" encoding="UTF-8"?>
<key>PayloadType</key> <key>PayloadType</key>
<string>Configuration</string> <string>Configuration</string>
<key>PayloadUUID</key> <key>PayloadUUID</key>
<string>$(cat /proc/sys/kernel/random/uuid)</string> <string>UUID4</string>
<key>PayloadVersion</key> <key>PayloadVersion</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
</plist>" > "/var/lib/mailinabox/mobileconfig.xml"; </plist>
...@@ -125,7 +125,6 @@ source setup/webmail.sh ...@@ -125,7 +125,6 @@ source setup/webmail.sh
source setup/owncloud.sh source setup/owncloud.sh
source setup/zpush.sh source setup/zpush.sh
source setup/management.sh source setup/management.sh
source setup/mobileconfig.sh
# Write the DNS and nginx configuration files. # Write the DNS and nginx configuration files.
sleep 5 # wait for the daemon to start sleep 5 # wait for the daemon to start
......
...@@ -40,6 +40,19 @@ tools/editconf.py /etc/php5/fpm/pool.d/www.conf -c ';' \ ...@@ -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 # since it depends on what domains we're serving, which we don't know
# until mail accounts have been created. # 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 # make a default homepage
if [ -d $STORAGE_ROOT/www/static ]; then mv $STORAGE_ROOT/www/static $STORAGE_ROOT/www/default; fi # migration #NODOC 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 mkdir -p $STORAGE_ROOT/www/default
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment