diff --git a/data/Dockerfiles/sogo/Dockerfile b/data/Dockerfiles/sogo/Dockerfile index 88617816..b9dcf5a7 100644 --- a/data/Dockerfiles/sogo/Dockerfile +++ b/data/Dockerfiles/sogo/Dockerfile @@ -11,12 +11,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ cron \ gnupg \ + make \ mysql-client \ supervisor \ syslog-ng \ syslog-ng-core \ syslog-ng-mod-redis \ + tar \ wget \ + zip \ && rm -rf /var/lib/apt/lists/* \ && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \ diff --git a/data/Dockerfiles/sogo/reconf-domains.sh b/data/Dockerfiles/sogo/reconf-domains.sh index 9ea2f6dd..1f33d97e 100755 --- a/data/Dockerfiles/sogo/reconf-domains.sh +++ b/data/Dockerfiles/sogo/reconf-domains.sh @@ -93,6 +93,9 @@ echo ' chown sogo:sogo -R /var/lib/sogo/ chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist +# Regenerate the SOGo Integrator plugin +/thunderbird/build-plugins.sh $MAILCOW_HOSTNAME < <(mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT domain FROM domain;" -B -N) + sleep 99999 done diff --git a/data/web/thunderbird-plugins.php b/data/web/thunderbird-plugins.php new file mode 100644 index 00000000..8a1a7e9b --- /dev/null +++ b/data/web/thunderbird-plugins.php @@ -0,0 +1,96 @@ + 'thunderbird', + 'version' => $row[1], + 'filename' => str_replace('__DOMAIN__', $_GET["domain"], $row[2]), + ); + } + fclose($fh); + } +} + +$applications += array( "thunderbird" => "{3550f703-e582-4d05-9a08-453d09bdfdc6} + 31.0 + 31.*" ); + +$pluginname = $_GET["plugin"]; +$plugin =& $plugins[$pluginname]; +$application =& $applications[$plugin["application"]]; + +if ( $plugin ) { + $platform = $_GET["platform"]; + if ( $platform + && file_exists( $platform . "/" . $plugin["filename"] ) ) { + $plugin["filename"] = $platform . "/" . $plugin["filename"]; + } + elseif ( !file_exists( $plugin["filename"] ) ) { + $plugin = false; + } +} + +if ( $plugin ) { + header("Content-type: text/xml; charset=utf-8"); + echo ('' . "\n"); +?> + + + + + +
  • + + + + + + + + + + +
  • +
    +
    +
    +
    + diff --git a/data/web/thunderbird-plugins/.gitignore b/data/web/thunderbird-plugins/.gitignore new file mode 100644 index 00000000..9146c321 --- /dev/null +++ b/data/web/thunderbird-plugins/.gitignore @@ -0,0 +1,4 @@ +*.zip +sogo-*-master +version.csv +*.xpi diff --git a/data/web/thunderbird-plugins/build-plugins.sh b/data/web/thunderbird-plugins/build-plugins.sh new file mode 100755 index 00000000..f0ea14e4 --- /dev/null +++ b/data/web/thunderbird-plugins/build-plugins.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -e + +MAILHOST=$1 + +cd $(dirname $0) + +wget -O integrator.tar.gz https://github.com/inverse-inc/sogo-integrator.tb31/archive/master.tar.gz +wget -O connector.tar.gz https://github.com/inverse-inc/sogo-connector.tb31/archive/master.tar.gz + +mkdir -p integrator connector +tar --strip-components=1 -C integrator -xf integrator.tar.gz +tar --strip-components=1 -C connector -xf connector.tar.gz + +# build custom integrator +while read DOMAIN; do + echo "Building SOGo Integrator for $DOMAIN hosted on $MAILHOST" + cd integrator + echo > defaults/preferences/site.js + mkdir -p custom/${DOMAIN} + cp -r custom/sogo-demo/* custom/${DOMAIN}/ + sed -i "s/http:\/\/sogo-demo\.inverse\.ca/https:\/\/${MAILHOST}/g" custom/${DOMAIN}/chrome/content/extensions.rdf + sed -i "s/plugins\/updates\.php[?]/thunderbird-plugins.php?domain=${DOMAIN}\&/g" custom/${DOMAIN}/chrome/content/extensions.rdf + echo 'pref("sogo-integrator.autocomplete.server.urlid", "'${DOMAIN}'");' > custom/${DOMAIN}/defaults/preferences/site.js + echo 'pref("mail.collect_email_address_outgoing", false);' >> custom/${DOMAIN}/defaults/preferences/site.js + sed -i 's/<\/Seq>/
  • <\/li>
  • <\/li><\/Seq>/g' custom/${DOMAIN}/chrome/content/extensions.rdf + make build=${DOMAIN} + INTEGRATOR_VER=$(grep em:version install.rdf | awk -F '"' '{print $2}') + cp sogo-integrator-*-${DOMAIN}.xpi ../sogo-integrator-${INTEGRATOR_VER}-${DOMAIN}.xpi + cd .. +done + +# build connector +cd connector +make +CONNECTOR_VER=$(grep em:version install.rdf | awk -F '"' '{print $2}') +cp sogo-connector-*.xpi ../sogo-connector-${CONNECTOR_VER}.xpi +cd .. + +# download Sieve plugin +SIEVE_RELEASES=$(wget -qO - https://api.github.com/repos/thsmi/sieve/releases) +SIEVE_VER=$(echo "$SIEVE_RELEASES" | grep '"tag_name": ' | head -n 1 | awk -F '"' '{print $4}') +wget -O sieve-${SIEVE_VER}.xpi $(echo "$SIEVE_RELEASES" | grep '"browser_download_url": ' | head -n 1 | awk -F '"' '{print $4}') +unset SIEVE_RELEASES + +# download ACL plugin +IMAP_ACL_VER=0.2.7 +wget -O imap_acl_extension-${IMAP_ACL_VER}-tb.xpi https://addons.cdn.mozilla.net/user-media/addons/_attachments/176736/imap_acl_extension-${IMAP_ACL_VER}-tb.xpi + +# update version file +echo "sogo-connector@inverse.ca;${CONNECTOR_VER};sogo-connector-${CONNECTOR_VER}.xpi" > version.csv +echo "sogo-integrator@inverse.ca;${INTEGRATOR_VER};sogo-integrator-${INTEGRATOR_VER}-__DOMAIN__.xpi" >> version.csv +echo "sieve@mozdev.org;${SIEVE_VER};sieve-${SIEVE_VER}.xpi" >> version.csv +echo "imap-acl@sirphreak.com;${IMAP_ACL_VER};imap_acl_extension-${IMAP_ACL_VER}-tb.xpi" >> version.csv + +rm -rf connector integrator *.tar.gz diff --git a/docker-compose.yml b/docker-compose.yml index f3e373bb..eda7ccd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -135,6 +135,7 @@ services: - TZ=${TZ} volumes: - ./data/conf/sogo/:/etc/sogo/ + - ./data/web/thunderbird-plugins:/thunderbird restart: always dns: - 172.22.1.254