#
# Parameterized Apache Config for WebDAV File Sharing,
# symlinked to /etc/apache2/other/ when enabled.
# Uses environment variables set by wfsctl(8).
#
LoadModule ssl_module libexec/apache2/mod_ssl.so
SSLPassPhraseDialog exec:/etc/wfs/getSSLPassPhrase.sh
SSLSessionCache shmcb:/var/run/ssl_scache(512000)
SSLSessionCacheTimeout 300
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
Define _WFS_PROTO 'https'
Define _WFS_SSL_ENGINE 'On'
Define _WFS_PROTO 'http'
Define _WFS_SSL_ENGINE 'Off'
Listen ${WFS_SERVER_ADDR}:${WFS_SERVER_PORT} ${_WFS_PROTO}
CustomLog "/var/log/apache2/wfs_access_log" common
ErrorLog "/var/log/apache2/wfs_error_log"
LogLevel info
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule substitute_module libexec/apache2/mod_substitute.so
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
ServerName ${WFS_SERVER_NAME}:${WFS_SERVER_PORT}
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
AddType application/x-x509-ca-cert crt
AddType application/x-pkcs7-crl crl
SSLEngine ${_WFS_SSL_ENGINE}
SSLProtocol -all +TLSv1.2
SSLCertificateFile "/etc/wfs/${WFS_CERT_ID}.cert.pem"
SSLCertificateKeyFile "/etc/wfs/${WFS_CERT_ID}.key.pem"
SSLProxyEngine Off
SSLProxyProtocol -all +TLSv1.2
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
LoadModule authnz_od_apple_module libexec/apache2/mod_authnz_od_apple.so
RewriteEngine On
RewriteMap webdavmap prg:/usr/libexec/wfs/webdavsharing_mapper
Allow from all
AuthType Basic
AuthName "UserWebDAV Gateway"
AuthBasicProvider od_apple
Require od_group ${WFS_ACCESS_GROUP}
RewriteEngine On
RewriteRule (.*)/webdav/(.*) /$2 [DPI]
RewriteCond %{REMOTE_USER} (.+)
RewriteRule (.*) ${webdavmap:%1}$1 [P,DPI,CO=WebDAVClient:TRUE:${WFS_SERVER_NAME},L]
# Recognize a WebDAV File Sharing client by its first OPTIONS or PROPFIND,
# but exclude other WebDAV clients
RewriteRule ^/webdav$ /
RewriteCond %{HTTP_COOKIE} WebDAVClient [OR]
RewriteCond %{REQUEST_METHOD} (OPTIONS|PROPFIND)
RewriteCond %{REQUEST_URI} !^/principals/.*
RewriteCond %{REQUEST_URI} !^/calendars/.*
RewriteCond %{REQUEST_URI} !^/addressbooks/.*
RewriteCond %{REQUEST_URI} !^/.well-known/.*
RewriteCond %{REQUEST_URI} !^/timezones/.*
RewriteCond %{REQUEST_URI} !^/webcal/.*
RewriteCond %{REQUEST_URI} !^/directory/.*
RewriteCond %{REQUEST_URI} !^/svn/.*
RewriteRule (.*) /webdav/$1 [PT,DPI]