From f823af740ddde2f3361ae9de6c4c49f19e091cea Mon Sep 17 00:00:00 2001 From: jabertwo <git@jabertwo.de> Date: Sun, 2 Feb 2025 01:19:01 +0100 Subject: [PATCH] WIP: testserver dokuwiki --- testserver/docker_dokuwiki/tasks/main.yml | 33 ++++++++++++++++++- .../docker_dokuwiki/templates/Dockerfile | 10 ------ .../templates/authuffd_vars.php | 9 ----- .../docker_dokuwiki/templates/oauth_vars.php | 14 ++++++++ .../templates/oauthgeneric_vars.php | 22 +++++++++++++ 5 files changed, 68 insertions(+), 20 deletions(-) delete mode 100644 testserver/docker_dokuwiki/templates/authuffd_vars.php create mode 100644 testserver/docker_dokuwiki/templates/oauth_vars.php create mode 100644 testserver/docker_dokuwiki/templates/oauthgeneric_vars.php diff --git a/testserver/docker_dokuwiki/tasks/main.yml b/testserver/docker_dokuwiki/tasks/main.yml index 86f84531..a48f0ed5 100644 --- a/testserver/docker_dokuwiki/tasks/main.yml +++ b/testserver/docker_dokuwiki/tasks/main.yml @@ -12,6 +12,10 @@ - "{{ basedir }}" - "{{ basedir }}/data" - "{{ basedir }}/pdftemplate" + - "{{ basedir }}/data/lib" + - "{{ basedir }}/data/lib/plugins" + - "{{ basedir }}/data/lib/plugins/oauth" + - "{{ basedir }}/data/lib/plugins/oauthgeneric" - name: Docker Compose Konfig-Datei erstellen template: @@ -20,9 +24,36 @@ with_items: - docker-compose.yml - Dockerfile - - authuffd_vars.php register: config +- name: oauth plugin clonen + ansible.builtin.git: + repo: https://github.com/cosmocode/dokuwiki-plugin-oauth.git + dest: "{{ basedir }}/data/lib/plugins/oauth" + force: true + +- name: config für oauth kopieren + ansible.builtin.template: + src: oauth_vars.php + dest: "{{ basedir }}/data/lib/plugins/oauth/conf/default.php" + +- name: oauthgeneric plugin clonen + ansible.builtin.git: + repo: https://github.com/cosmocode/dokuwiki-plugin-oauthgeneric.git + dest: "{{ basedir }}/data/lib/plugins/oauthgeneric" + force: true + +- name: config für oauthgeneric kopieren + ansible.builtin.template: + src: oauthgeneric_vars.php + dest: "{{ basedir }}/data/lib/plugins/oauthgeneric/conf/default.php" + +- name: oauth provider aktivieren + ansible.builtin.lineinfile: + path: "{{ basedir }}/data/conf/local.php" + regexp: "^$conf['authtype'] = " + line: "$conf['authtype'] = 'oauth';" + - name: "stop {{ servicename}} docker" community.docker.docker_compose_v2: project_src: "{{ basedir }}" diff --git a/testserver/docker_dokuwiki/templates/Dockerfile b/testserver/docker_dokuwiki/templates/Dockerfile index c8d7a90f..7a1e5107 100644 --- a/testserver/docker_dokuwiki/templates/Dockerfile +++ b/testserver/docker_dokuwiki/templates/Dockerfile @@ -25,16 +25,6 @@ RUN apt-get update && apt-get install -y wget unzip git \ && tar -xvzf dokuwiki-stable.tgz -C /var/www/html --strip-components=1 \ && rm dokuwiki-stable.tgz -# Plugin-Verzeichnis erstellen und das Authentifizierungs-Plugin hinzufügen -RUN mkdir -p /var/www/html/lib/plugins/authuffd \ - && git clone https://git.cccv.de/uffd/dokuwiki-plugin-authuffd.git /var/www/html/lib/plugins/authuffd - -# Konfigurationsdatei für das Plugin anpassen -COPY authuffd_vars.php /var/www/html/lib/plugins/authuffd/conf/default.php - -# DokuWiki Konfiguration anpassen -RUN echo "\$conf['authtype'] = 'authuffd';" >> /var/www/html/conf/local.php - # Setzen der richtigen Berechtigungen RUN chown -R www-data:www-data /var/www/html diff --git a/testserver/docker_dokuwiki/templates/authuffd_vars.php b/testserver/docker_dokuwiki/templates/authuffd_vars.php deleted file mode 100644 index df9a1fc7..00000000 --- a/testserver/docker_dokuwiki/templates/authuffd_vars.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -$conf['name'] = 'uffd'; -$conf['baseurl'] = '{{ oidc_global.provider_url }}'; -$conf['oauth2_client_id'] = '{{ servicename }}'; -$conf['oauth2_client_secret'] = '{{ oauth_secret }}'; -$conf['oauth2_redirect_uri'] = '{{ domain }}/dokuwiki/doku.php?id=authredirect'; -#$conf['api_username'] = ''; -#$conf['api_password'] = ''; diff --git a/testserver/docker_dokuwiki/templates/oauth_vars.php b/testserver/docker_dokuwiki/templates/oauth_vars.php new file mode 100644 index 00000000..a1da0e0e --- /dev/null +++ b/testserver/docker_dokuwiki/templates/oauth_vars.php @@ -0,0 +1,14 @@ +<?php + +/** + * Default settings for the oauth plugin + * + * @author Andreas Gohr <andi@splitbrain.org> + */ + +$conf['info'] = ''; +$conf['custom-redirectURI'] = ''; +$conf['mailRestriction'] = ''; +$conf['singleService'] = ''; +$conf['register-on-auth'] = 1; +$conf['overwrite-groups'] = 0; \ No newline at end of file diff --git a/testserver/docker_dokuwiki/templates/oauthgeneric_vars.php b/testserver/docker_dokuwiki/templates/oauthgeneric_vars.php new file mode 100644 index 00000000..2dce5ec6 --- /dev/null +++ b/testserver/docker_dokuwiki/templates/oauthgeneric_vars.php @@ -0,0 +1,22 @@ +<?php +/** + * Default settings for the oauthgeneric plugin + */ + +$conf['key'] = 'dokuwiki'; +$conf['secret'] = '{{ oauth_secret }}'; + +$conf['authurl'] = '{{ oauth_global.authorize_url }}'; +$conf['tokenurl'] = '{{ oauth_global.token_url }}'; +$conf['userurl'] = '{{ oauth_global.userinfo_url }}'; +$conf['authmethod'] = '1'; +$conf['scopes'] = 'email, openid, profile, groups'; +$conf['needs-state'] = 0; + +$conf['json-user'] = 'prefered_username'; +$conf['json-name'] = 'name'; +$conf['json-mail'] = 'email'; +$conf['json-grps'] = 'groups'; + +$conf['label'] = 'uffd'; +$conf['color'] = '#ff3d00'; \ No newline at end of file -- GitLab