diff --git a/actions/radicale b/actions/radicale index 85d503e55..05d0b7b67 100755 --- a/actions/radicale +++ b/actions/radicale @@ -77,7 +77,7 @@ def subcommand_setup(_): action_utils.service_enable('radicale') action_utils.service_restart('radicale') - action_utils.webserver_enable('radicale-plinth') + action_utils.webserver_enable(_get_web_config(current_version)) def subcommand_configure(arguments): @@ -92,12 +92,12 @@ def subcommand_configure(arguments): def subcommand_enable(_): """Start service.""" action_utils.service_enable('radicale') - action_utils.webserver_enable('radicale-plinth') + action_utils.webserver_enable(_get_web_config()) def subcommand_disable(_): """Stop service.""" - action_utils.webserver_disable('radicale-plinth') + action_utils.webserver_disable(_get_web_config()) action_utils.service_disable('radicale') @@ -113,6 +113,17 @@ def _get_version(): return LV(version) +def _get_web_config(current_version=None): + """Return the name of the webserver configuration based on version.""" + if current_version is None: + current_version = _get_version() + + if current_version and current_version < VERSION_2: + return 'radicale-plinth' + + return 'radicale2-freedombox' + + def load_augeas(): """Initialize Augeas.""" aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + diff --git a/data/etc/apache2/conf-available/radicale-plinth.conf b/data/etc/apache2/conf-available/radicale-plinth.conf index fe4bbaad9..ed6ba9f59 100644 --- a/data/etc/apache2/conf-available/radicale-plinth.conf +++ b/data/etc/apache2/conf-available/radicale-plinth.conf @@ -6,19 +6,8 @@ Redirect 301 /.well-known/carddav /radicale/.well-known/carddav Redirect 301 /.well-known/caldav /radicale/.well-known/caldav - - RewriteEngine On - RewriteCond %{REQUEST_URI} ^/radicale$ - RewriteRule .* /radicale/ [R=301,L] - - + ProxyPass http://localhost:5232 - Include includes/freedombox-auth-ldap.conf Require valid-user - - ProxyPass http://localhost:5232/ - ProxyPassReverse http://localhost:5232/ - RequestHeader set X-Script-Name /radicale/ - RequestHeader set X-Remote-User %{REMOTE_USER}s diff --git a/data/etc/apache2/conf-available/radicale2-freedombox.conf b/data/etc/apache2/conf-available/radicale2-freedombox.conf new file mode 100644 index 000000000..2219e1846 --- /dev/null +++ b/data/etc/apache2/conf-available/radicale2-freedombox.conf @@ -0,0 +1,24 @@ +## +## On all sites, provide Radicale on a path: /radicale +## Allow all valid users. +## +Redirect 301 /.well-known/carddav /radicale/ +Redirect 301 /.well-known/caldav /radicale/ + + + + RewriteEngine On + RewriteCond %{REQUEST_URI} ^/radicale$ + RewriteRule .* /radicale/ [R=301,L] + + + + + Include includes/freedombox-auth-ldap.conf + Require valid-user + + ProxyPass http://localhost:5232/ + ProxyPassReverse http://localhost:5232/ + RequestHeader set X-Script-Name /radicale/ + RequestHeader set X-Remote-User expr=%{REMOTE_USER} +