diff --git a/testing/z-push/APKBUILD b/testing/z-push/APKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..965f8a69c2cefde7f49b64858af03602ae6a591d --- /dev/null +++ b/testing/z-push/APKBUILD @@ -0,0 +1,80 @@ +# Maintainer: Noel Kuntze <noel.kuntze@thermi.consulting> +pkgname=z-push +pkgver=2.6.2 +pkgrel=0 +pkgdesc="open-source implementation of the ActiveSync protocol" +arch="noarch" +url="https://z-push.org/" +license="GPL-3.0-only" +options="!check" # No test suite +depends="php7 php7-fpm php7-shmop php7-sysvsem php7-sysvshm" +pkgusers="z-push" +pkggroups="z-push" + +install="z-push.pre-install" + +source="$pkgname-$pkgver.tar.gz::https://github.com/Z-Hub/Z-Push/archive/refs/tags/$pkgver.tar.gz + apache.example.conf + htaccess + z-push.ini + z-push.conf + nginx-location.conf + nginx-ssl.example.conf + php-fpm.example.conf + z-push-admin + z-push-top + " + +builddir="$srcdir/Z-Push-$pkgver" + +prepare() { + default_prepare + sed "s/ZPUSHVERSION/$pkgver/" build/version.php.in > src/version.php + sed -i -e "s|\('MAPI_SERVER', \).*$|\1'file:///var/run/kopano/server.sock'\);|" src/backend/kopano/config.php + sed -i -e "s|\('BACKEND_PROVIDER', \).*$|\1'BackendKopano'\);|" src/config.php +} + +package() { + install -d "$pkgdir/etc/webapps/z-push" "$pkgdir/etc/php7/conf.d/" \ + "$pkgdir/etc/php7/php-fpm.d/" "$pkgdir/usr/share/webapps/z-push/" \ + "$pkgdir/usr/bin/" + + cp "$srcdir/z-push-admin" "$srcdir/z-push-top" "$pkgdir/usr/bin/" + + cp -r src/* "$pkgdir/usr/share/webapps/z-push/" + + install -Dm 0640 "$srcdir/htaccess" "$pkgdir/usr/share/webapps/z-push/.htaccess" + + install -Dm 0755 "$srcdir/z-push-admin" "$srcdir/z-push-top" "$pkgdir/usr/bin/" + + install -Dm 0644 "$srcdir/apache.example.conf" "$srcdir/php-fpm.example.conf" "$srcdir/nginx-ssl.example.conf" "$srcdir/nginx-location.conf" "$pkgdir/etc/webapps/z-push/" + install -g z-push -m 0750 src/config.php "$pkgdir/etc/webapps/z-push/config.php" + install -g z-push -m 0750 src/policies.ini "$pkgdir/etc/webapps/z-push/policies.ini" + + install -g z-push -dm 0750 "$pkgdir/etc/webapps/z-push/backends" + + cd src/backend + for config_file in */config.php + do + install -Dm 0750 -g z-push "$config_file" "$pkgdir/etc/webapps/z-push/backends/$config_file" + ln -sf "/etc/webapps/z-push/backends/$config_file" "$config_file" + done + + ln -sf /etc/webapps/z-push/config.php "$pkgdir/usr/share/webapps/z-push/config.php" + ln -sf /etc/webapps/z-push/policies.ini "$pkgdir/usr/share/webapps/z-push/policies.ini" + + install -Dm 0644 "$srcdir/z-push.ini" "$pkgdir/etc/php7/conf.d/" + install -Dm 0644 "$srcdir/z-push.conf" "$pkgdir/etc/php7/php-fpm.d/" + install -dm 0750 -o z-push -g z-push "$pkgdir/var/log/z-push/" "$pkgdir/var/lib/z-push" +} + +sha512sums="deb7735e4eb296584d9ad9626d962068154794265233a5a0c5b057055bc92d31187667e00ce570545b17fb2502343305b75996625d6451bc2837901afecdde9a z-push-2.6.2.tar.gz +cffa906fdf147e8e81ae5a6033762f5a0f5f33e718dca86b12aab973123d2ce094b8e3e7cffe4880403fb961626dc33cf54bb6b2d8a7a376976cdfc5ec4b9cf9 apache.example.conf +f6f71969576b5f4524d980cca55ae445691d3ce1a35973657770a631fb8e0a17375d67245802eaf1a5b819528602ba88165e6fa873db5462937087521aee394d htaccess +ebdcb8905f6fd49bc073aa7e884252daae1c7b6865bfd5cf7ce3ecd889d78a57a4979b09a8b02fbf16cdd8dbb236de8493b1896ac2f0693ddf41bd8bf87df11d z-push.ini +7d77fedb1f22ee77ba091d54051b946ad048c4f63d83a27585e95b68f46eebc2376032cf3c7d8112205736dd1fd4e2fb0c976cc7b510796b79109b146469208d z-push.conf +e39d2c101708274e02923869083ed613c1ad1d8df574ca4f1f01f0a0ed7c044a7422bd8532e52d0db8f8279dc04506582747ac83cac978044db62fb7e213c200 nginx-location.conf +dad272b51824f21bfc2a5f41731cd20bca6e877b15756e1115304e9c353fbc4c98cbd1c66661e0974685d1a01e94b933d5c380c8a6b17aa18b65ab86cbfb4971 nginx-ssl.example.conf +bad70098b919c4cacce3152b276da489d7a36ca195b607508ad316211401dc98f07433ef505deb82a91388993e58b398cce2bc3eb295cf812362bae96b40fb35 php-fpm.example.conf +4f85dc2a316f2e5cce82c4a8b7310d5c8e8970c18d8726f9dec6bd5b5a6c657f4dd2f7f62dfead25be3c95dc26526c86f79ee1e7f6fd15248ad0429d0342b6dc z-push-admin +1c21e770e2206b46e4950be7da3067fad6ee2bb2481156e50b169b93d155b89385003975aabeda3bd14fb4727bd26b518f7e370cb79ddad5a7786ef456d30e13 z-push-top" diff --git a/testing/z-push/apache.example.conf b/testing/z-push/apache.example.conf new file mode 100644 index 0000000000000000000000000000000000000000..3815e9844960e0482efac3dc4e99f362373be146 --- /dev/null +++ b/testing/z-push/apache.example.conf @@ -0,0 +1,8 @@ +Alias /Microsoft-Server-ActiveSync /usr/share/webapps/z-push/index.php + +<Directory /usr/share/webapps/z-push/> + DirectoryIndex index.php + AllowOverride Options + + Require all granted +</Directory> diff --git a/testing/z-push/htaccess b/testing/z-push/htaccess new file mode 100644 index 0000000000000000000000000000000000000000..5968acaa485fb67c042a85a842b105c3169bfe5a --- /dev/null +++ b/testing/z-push/htaccess @@ -0,0 +1,4 @@ +php_flag magic_quotes_gpc off +php_flag register_globals off +php_flag magic_quotes_runtime off +php_flag short_open_tag on diff --git a/testing/z-push/nginx-location.conf b/testing/z-push/nginx-location.conf new file mode 100644 index 0000000000000000000000000000000000000000..2ea6a503598c9b8b2c7af1e3ff4ace82d0e8d7db --- /dev/null +++ b/testing/z-push/nginx-location.conf @@ -0,0 +1,32 @@ + + ### + ## In order to run this component you need to define a server-context in. + ## /etc/nginx/nginx.conf: + ## + ## http { + ## server { + ## listen 80; + ## include ${PATH_TO_THIS_LOCATION_FILE}; + ## } + ## } + ## + ## Or include this file in your existing server-context. + ## + location /Microsoft-Server-ActiveSync { + root /usr/share/webapps/z-push; + + ## [WARNING] The following header states that the browser should only communicate + ## with your server over a secure connection for the next 24 months. + add_header Strict-Transport-Security max-age=63072000; + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + + fastcgi_connect_timeout 65; + fastcgi_send_timeout 6000; + fastcgi_read_timeout 6000; + + fastcgi_pass unix:/run/php-fpm/z-push.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root/index.php; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; + } diff --git a/testing/z-push/nginx-ssl.example.conf b/testing/z-push/nginx-ssl.example.conf new file mode 100644 index 0000000000000000000000000000000000000000..c2b0fef339b50879701ccab08c6283df8f8cd5b9 --- /dev/null +++ b/testing/z-push/nginx-ssl.example.conf @@ -0,0 +1,56 @@ + + server { + # server_name YOUR_SERVER_FQDN; ## uncomment replace this with something like www.example.com + listen 443; + + server_tokens off; ## Don't show the nginx version number, a security best practice + root /usr/share/nginx/html; + index index.html index.htm; + + ## Strong SSL Security + ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/ + ## + ## Generate a strong SSL-Certificate and DHE parameter: + ## openssl genrsa -out /etc/ssl/private/kopano.key 4096 + ## openssl req -new -sha512 -key /etc/ssl/private/kopano.key -out /tmp/kopano.csr + ## openssl x509 -req -days 3650 -in /tmp/kopano.csr -signkey /etc/ssl/private/kopano.key -out /etc/ssl/private/kopano.crt + ## openssl dhparam -out /etc/ssl/private/kopano.dh 4096 + ## chmod go-rwx /etc/ssl/private/kopano.*; + ## chmod u+rw /etc/ssl/private/kopano.* + ## chown root:root /etc/ssl/private/kopano.* + ## + ssl on; + ssl_certificate_key /etc/ssl/private/kopano.key; + ssl_certificate /etc/ssl/private/kopano.crt; + ssl_dhparam /etc/ssl/private/kopano.dh; + + ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html + ## The recommended cipher suite for backwards compatibility (IE6/WinXP): + ssl_ciphers 'AES256+EECDH:AES256+EDH:!aNULL'; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:50m; + ssl_session_timeout 5m; + + ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL. + ## Replace with your ssl_trusted_certificate. For more info see: + ## - https://medium.com/devops-programming/4445f4862461 + ## - https://www.ruby-forum.com/topic/4419319 + ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx + ## - https://raymii.org/s/tutorials/OCSP_Stapling_on_nginx.html + ## - http://freiburg79.de/ocsp-stapling-mit-nginx/ + # ssl_stapling on; + # ssl_stapling_verify on; + # ssl_stapling_file /etc/ssl/private/de-autorisation-m.ocsp; + # resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired + # resolver_timeout 5s; + + # HIDDEN FILES AND FOLDERS + rewrite ^(.*)\/\.(.*)$ @404 break; + + location = @404 { + return 404; + } + + include ${PATH_TO_ATTACHED_LOCATION_FILE}; + } diff --git a/testing/z-push/php-fpm.example.conf b/testing/z-push/php-fpm.example.conf new file mode 100644 index 0000000000000000000000000000000000000000..97b9777f10937e5348c11888e92a1cf89f298a84 --- /dev/null +++ b/testing/z-push/php-fpm.example.conf @@ -0,0 +1,6 @@ +include = /etc/php/fpm.d/*.conf + +[global] +pid = /run/php-fpm/php-fpm.pid +error_log = syslog +log_level = notice diff --git a/testing/z-push/z-push-admin b/testing/z-push/z-push-admin new file mode 100755 index 0000000000000000000000000000000000000000..8f875e2f208130755588697c38ea661fc54502df --- /dev/null +++ b/testing/z-push/z-push-admin @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/share/webapps/z-push/z-push-admin.php "$@" diff --git a/testing/z-push/z-push-top b/testing/z-push/z-push-top new file mode 100755 index 0000000000000000000000000000000000000000..e71b216f8d2cf8348e83d6f5b6072216d04f1378 --- /dev/null +++ b/testing/z-push/z-push-top @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/share/webapps/z-push/z-push-top.php "$@" diff --git a/testing/z-push/z-push.conf b/testing/z-push/z-push.conf new file mode 100644 index 0000000000000000000000000000000000000000..1140875acd46f84b1806533f4a54b548ed91dff1 --- /dev/null +++ b/testing/z-push/z-push.conf @@ -0,0 +1,35 @@ +[z-push] +listen = /var/lib/php7/fpm/z-push.sock +listen.owner = z-push +listen.group = http +listen.mode = 0660 + + +user = z-push +group = http + +; z-push for 5 users +pm = ondemand +pm.max_children = 15 +pm.max_requests = 500 + +env[HOSTNAME] = $HOSTNAME +env[PATH] = /usr/local/bin:/usr/bin:/bin +env[TMP] = /tmp +env[TMPDIR] = /tmp +env[TEMP] = /tmp +env[HOME] = /home + +php_admin_value[memory_limit] = 128M +php_admin_value[open_basedir] = ${open_basedir}:/usr/share/webapps/z-push:/etc/webapps/z-push:/var/lib/z-push:/var/log/z-push:/usr/share/php/mapi + +php_admin_value[upload_max_filesize] = 20M +php_admin_value[post_max_size] = 20M +;; php_admin_value[date.timezone] = Europe/Berlin + +;; https://z-push.org/svn/z-push/trunk/src/INSTALL +;; +php_flag[magic_quotes_gpc] = off +php_flag[register_globals] = off +php_flag[magic_quotes_runtime] = off +php_flag[short_open_tag] = on diff --git a/testing/z-push/z-push.ini b/testing/z-push/z-push.ini new file mode 100644 index 0000000000000000000000000000000000000000..adbdf833cc33a9f0e957aa28280981b3534dc538 --- /dev/null +++ b/testing/z-push/z-push.ini @@ -0,0 +1,9 @@ +extension=mapi.so +extension=iconv.so +extension=shmop.so +extension=soap.so +extension=sysvsem.so +extension=sysvshm.so + +; in order to use the utils this system wide is needed +open_basedir=${open_basedir}:/usr/share/webapps/z-push:/etc/webapps/z-push:/var/lib/z-push:/var/log/z-push:/usr/share/php/mapi diff --git a/testing/z-push/z-push.pre-install b/testing/z-push/z-push.pre-install new file mode 100644 index 0000000000000000000000000000000000000000..f9b256c16a679f927654b1650a60349a34d85d84 --- /dev/null +++ b/testing/z-push/z-push.pre-install @@ -0,0 +1,8 @@ +#!/bin/sh + +addgroup -S z-push >/dev/null 2>/dev/null +addgroup -S kopano >/dev/null 2>/dev/null +adduser -S -D -H -h /var/lib/z-push -s /sbin/nologin -G z-push -g z-push z-push >/dev/null 2>/dev/null +# for access to server.sock +addgroup -S z-push kopano >/dev/null 2>/dev/null +exit 0