From a75593f852c9c1771101fce522212399c2633dfa Mon Sep 17 00:00:00 2001 From: David Prevot Date: Thu, 30 Jun 2022 11:49:29 +0200 Subject: [PATCH 1/9] CI: Clean up before build --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index d81733a..2c4a6e9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,6 +13,7 @@ steps: - debian commands: - mk-build-deps --install --remove debian/control + - git clean --force - gbp buildpackage -us -uc when: branch: From 1a90dff7f133480c6ebe471cb720cf9dd7ba8f02 Mon Sep 17 00:00:00 2001 From: David Prevot Date: Mon, 11 Jul 2022 14:37:36 +0200 Subject: [PATCH 2/9] CI: Drop .git directory that was not present during first build --- .Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.Jenkinsfile b/.Jenkinsfile index 7947dcb..daf22bf 100644 --- a/.Jenkinsfile +++ b/.Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { script { sh 'mk-build-deps --install --remove debian/control' - sh 'rm -rf {source,*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,*.buildinfo,lintian.txt}' + sh 'rm -rf {source,*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,*.buildinfo,lintian.txt,.git}' sh "gbp clone --debian-branch=$GIT_BRANCH $GIT_URL source" sh 'cd source && git checkout $GIT_BRANCH && gbp buildpackage -us -uc' } From 66c12fa61fe8a3e4afff137bfb09340b62124542 Mon Sep 17 00:00:00 2001 From: David Prevot Date: Fri, 15 Jul 2022 10:29:30 +0200 Subject: [PATCH 3/9] docs: tfix --- README.md | 10 +++++----- docs/install.md | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7fe61ba..6bea525 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,20 @@ Evoadmin-mail requirements are an LDAP server, a web server and PHP. See [INSTALL](docs/install.md) for instructions. Multiples services can be configured to use the LDAP directory -managed by Evoadmin-mail : +managed by Evoadmin-mail: - TODO ## Test -You can deploy a test environment with Vagrant : +You can deploy a test environment with Vagrant: ~~~ vagrant up ~~~ Evoadmin-mail uses the evoadminmail.packmail.example.com domain -on localhost, so update your /etc/hosts : +on localhost, so update your /etc/hosts: ~~~ 127.0.0.1 evoadminmail.packmail.example.com @@ -34,7 +34,7 @@ https://evoadminmail.packmail.example.com:8443 ### Authentication The default admin user is "evoadmin", the password is randomly -generated and can be recovered from LDAP : +generated and can be recovered from LDAP: ~~~ vagrant ssh @@ -45,7 +45,7 @@ ldapvi --ldapsearch "(uid=evoadmin)" | grep userPassword | awk '{ print $2 }' ### Deployment Launch rsync-auto in a terminal to automatically synchronise your -local code with the Vagrant VM : +local code with the Vagrant VM: ~~~ vagrant rsync-auto diff --git a/docs/install.md b/docs/install.md index 1d457ef..75bbd89 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,8 +1,8 @@ # Install -Evoadmin-mail need an LDAP server, a Web server and PHP. This documentation explain how to configure OpenLDAP and Apache with mod_php. +Evoadmin-mail needs an LDAP server, a Web server and PHP. This documentation explains how to configure OpenLDAP and Apache with mod_php. -Following files extract are [Jinja2](http://jinja.pocoo.org) templates, **{{ varname }}** must be replaced by custom value, eg. +Following files extract are [Jinja2](http://jinja.pocoo.org) templates, **{{ varname }}** must be replaced by custom value, e.g. ~~~ ldap_hostname: "mailserver" @@ -237,7 +237,7 @@ git clone https://forge.evolix.org/evoadmin-mail.git /home/evoadmin-mail/www ; ; You need to copy and edit config-sample.ini to config.ini. ; This INI file is loaded by evoadmin-mail and contains the -; following configurations : +; following configurations: ; ; * Global settings ; * LDAP settings @@ -257,4 +257,4 @@ admin_pass = "{{ ldap_admin_password }}" superadmin[] = "evoadmin" ~~~ -You can now connect to your Evoadmin-mail with **evoadmin** user and your precedently defined password ! +You can now connect to your Evoadmin-mail with **evoadmin** user and your previously defined password! From b8578ebb278238c1ad6ee24f44ad0a80cdcdc14d Mon Sep 17 00:00:00 2001 From: David Prevot Date: Mon, 12 Dec 2022 17:00:07 +0100 Subject: [PATCH 4/9] CI: Upload to pub2 --- .Jenkinsfile | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/.Jenkinsfile b/.Jenkinsfile index daf22bf..e6c89b9 100644 --- a/.Jenkinsfile +++ b/.Jenkinsfile @@ -1,24 +1,15 @@ pipeline { - agent { label 'docker' } + agent { label 'sbuild' } stages { stage('Build Debian package') { - agent { - docker { - image 'evolix/gbp:bullseye' - args '-u root --privileged' - } - } when { branch 'debian' } steps { script { - sh 'mk-build-deps --install --remove debian/control' - sh 'rm -rf {source,*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,*.buildinfo,lintian.txt,.git}' - sh "gbp clone --debian-branch=$GIT_BRANCH $GIT_URL source" - sh 'cd source && git checkout $GIT_BRANCH && gbp buildpackage -us -uc' + sh 'gbp buildpackage' } - archiveArtifacts allowEmptyArchive: true, artifacts: '*.gz,*.bz2,*.xz,*.deb,*.dsc,*.changes,*.buildinfo,lintian.txt' + archiveArtifacts allowEmptyArchive: true, artifacts: 'build-area/*.gz,build-area/*.bz2,build-area/*.xz,build-area/*.deb,build-area/*.dsc,build-area/*.changes,build-area/*.buildinfo,build-area/*.build,build-area/lintian.txt' } } @@ -28,10 +19,7 @@ pipeline { } steps { script { - sh 'echo Dummy line to remove once something actually happens.' - /* No crendentials yet. - sh 'rsync -avP evoadmin-mail* droneci@pub.evolix.net:/home/droneci/evoadmin-mail/' - */ + sh 'rsync -avP build-area/evoadmin-mail*.deb build-area/evoadmin-mail*.changes pub.evolix.org:/srv/upload/' } } } From 7dfc671fc21fba96ace96d13f6e4495580323ad4 Mon Sep 17 00:00:00 2001 From: David Prevot Date: Mon, 12 Dec 2022 17:28:01 +0100 Subject: [PATCH 5/9] =?UTF-8?q?CI:=20Don=E2=80=99t=20use=20Drone=20CI=20an?= =?UTF-8?q?ymore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 2c4a6e9..0000000 --- a/.drone.yml +++ /dev/null @@ -1,35 +0,0 @@ -kind: pipeline -name: default - -steps: -- name: fetch - image: alpine/git - commands: - - git fetch --tags - -- name: build debian package - image: evolix/gbp:bullseye - branches: - - debian - commands: - - mk-build-deps --install --remove debian/control - - git clean --force - - gbp buildpackage -us -uc - when: - branch: - - debian - -- name: upload debian package - image: drillster/drone-rsync - settings: - hosts: ["pub.evolix.net"] - port: 22 - user: droneci - key: - from_secret: drone_private_key - target: /home/droneci/evoadmin-mail/ - source: ../evoadmin-mail* - delete: true - when: - branch: - - debian From bc29eadd15ea5cac8c2229bb6bd56fa4dc830d0e Mon Sep 17 00:00:00 2001 From: David Prevot Date: Thu, 22 Dec 2022 11:38:11 +0100 Subject: [PATCH 6/9] CI: Push *.buildinfo too --- .Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.Jenkinsfile b/.Jenkinsfile index e6c89b9..7f72f3d 100644 --- a/.Jenkinsfile +++ b/.Jenkinsfile @@ -19,7 +19,7 @@ pipeline { } steps { script { - sh 'rsync -avP build-area/evoadmin-mail*.deb build-area/evoadmin-mail*.changes pub.evolix.org:/srv/upload/' + sh 'rsync -avP build-area/evoadmin-mail*.deb build-area/evoadmin-mail*.buildinfo build-area/evoadmin-mail*.changes pub.evolix.org:/srv/upload/' } } } From 145b406c4823c5e9c9b09ec1831016756611710f Mon Sep 17 00:00:00 2001 From: David Prevot Date: Mon, 24 Jul 2023 17:51:03 +0200 Subject: [PATCH 7/9] tfix --- htdocs/lib/FormController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/lib/FormController.php b/htdocs/lib/FormController.php index d484547..3f16e8c 100644 --- a/htdocs/lib/FormController.php +++ b/htdocs/lib/FormController.php @@ -139,7 +139,7 @@ class FormController { PageController::$alerts[] = array('type' => 1, 'message' => 'Suppression du domaine '.self::$form['cn'].' ...'); try { self::$server->delDomain(self::$form['cn']); - PageController::$alerts[] = array('type' => 0, 'message' => 'Suppression effectué.'); + PageController::$alerts[] = array('type' => 0, 'message' => 'Suppression effectuée.'); } catch (Exception $e_ad) { PageController::$alerts[] = array('type' => 2, 'message' => $e_ad->getMessage()); } @@ -150,7 +150,7 @@ class FormController { PageController::$alerts[] = array('type' => 1, 'message' => 'Suppression du compte '.self::$form['uid'].'...'); try { self::$domain->delAccount(self::$form['uid'],self::$form['cn']); - PageController::$alerts[] = array('type' => 0, 'message' => "Suppression effectué."); + PageController::$alerts[] = array('type' => 0, 'message' => "Suppression effectuée.")); } catch (Exception $e) { PageController::$alerts[] = array('type' => 2, 'message' => $e->getMessage()); } From c7a83045fcf94f888df618e351ec71466f213b3d Mon Sep 17 00:00:00 2001 From: David Prevot Date: Mon, 24 Jul 2023 17:58:22 +0200 Subject: [PATCH 8/9] =?UTF-8?q?[WIP]=20sudo=20script=20doesn=E2=80=99t=20w?= =?UTF-8?q?ork=20yet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/lib/Config.php | 3 ++- htdocs/lib/FormController.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/lib/Config.php b/htdocs/lib/Config.php index bdf2907..f979136 100644 --- a/htdocs/lib/Config.php +++ b/htdocs/lib/Config.php @@ -1,7 +1,7 @@ 1, 'message' => 'Suppression du compte '.self::$form['uid'].'...'); try { - self::$domain->delAccount(self::$form['uid'],self::$form['cn']); + self::$domain->delAccount(self::$form['uid'],self::$form['domain']); PageController::$alerts[] = array('type' => 0, 'message' => "Suppression effectuée.")); } catch (Exception $e) { PageController::$alerts[] = array('type' => 2, 'message' => $e->getMessage()); From cf873c35ebd47a659c9053b022cf3e5072f4d85e Mon Sep 17 00:00:00 2001 From: David Prevot Date: Wed, 26 Jul 2023 15:08:11 +0200 Subject: [PATCH 9/9] Fix USERDIR to delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not sure why we didn’t use directly the homeDirectory ldap entry, but just trying to minimize the patch by trying to figure out the path from the uid and domain… --- scripts/evoadmin.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/evoadmin.sh b/scripts/evoadmin.sh index eb36b53..3dbbddc 100755 --- a/scripts/evoadmin.sh +++ b/scripts/evoadmin.sh @@ -39,11 +39,12 @@ if [ "$PASSWORD" != "$READPASS" ]; then fi # mv pseudo-homeDir to directory. for deleted users +USERDIR=${USERIS%%@$DOMAINIS} if [ "$DEL" == "on" ]; then - if [[ -n $USERIS && -n $DOMAINIS && -e "/home/vmail/$DOMAINIS" && -e "/home/vmail/$DOMAINIS/$USERIS" ]]; then - mv /home/vmail/$DOMAINIS/$USERIS /home/vmail/$DOMAINIS/$USERIS.$DATE - chown -R root:root /home/vmail/$DOMAINIS/$USERIS.$DATE - chmod -R 700 /home/vmail/$DOMAINIS/$USERIS.$DATE + if [[ -n $USERIS && -n $DOMAINIS && -n $USERDIR && -e "/home/vmail/$DOMAINIS" && -e "/home/vmail/$DOMAINIS/$USERDIR" ]]; then + mv /home/vmail/$DOMAINIS/$USERDIR /home/vmail/$DOMAINIS/$USERDIR.$DATE + chown -R root:root /home/vmail/$DOMAINIS/$USERDIR.$DATE + chmod -R 700 /home/vmail/$DOMAINIS/$USERDIR.$DATE fi exit 0 fi