diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 95ced80..0795e31 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -133,7 +133,7 @@ jobs: with: context: ./portal build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -177,7 +177,7 @@ jobs: with: context: ./uwsgi-portal build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -211,7 +211,7 @@ jobs: with: context: ./cron build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -255,7 +255,7 @@ jobs: with: context: ./cron-task build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -299,7 +299,7 @@ jobs: with: context: ./sessions-backup build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -343,7 +343,7 @@ jobs: with: context: ./manager build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -387,7 +387,7 @@ jobs: with: context: ./full build-args: | - "PORTALBASE=yadd/lemonldap-ng-portal:experimental" + PORTALBASE=yadd/lemonldap-ng-portal:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -431,7 +431,7 @@ jobs: with: context: ./ssoaas-fastcgi-server build-args: | - "BASE=yadd/lemonldap-ng-base:experimental" + BASE=yadd/lemonldap-ng-base:experimental platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -507,7 +507,7 @@ jobs: with: context: ./portal build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -541,7 +541,7 @@ jobs: with: context: ./uwsgi-portal build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -575,7 +575,7 @@ jobs: with: context: ./cron build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -609,7 +609,7 @@ jobs: with: context: ./cron-task build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -643,7 +643,7 @@ jobs: with: context: ./sessions-backup build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -677,7 +677,7 @@ jobs: with: context: ./manager build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -711,7 +711,7 @@ jobs: with: context: ./full build-args: | - "PORTALBASE=yadd/lemonldap-ng-portal:experimental-no-s6" + PORTALBASE=yadd/lemonldap-ng-portal:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | @@ -745,7 +745,7 @@ jobs: with: context: ./ssoaas-fastcgi-server build-args: | - "BASE=yadd/lemonldap-ng-base:experimental-no-s6" + BASE=yadd/lemonldap-ng-base:experimental-no-s6 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x push: true tags: | diff --git a/Changes.md b/Changes.md index 6b9f517..72db17d 100644 --- a/Changes.md +++ b/Changes.md @@ -1,8 +1,9 @@ # Changes -* 2024-08-14: add message-broker -* 2024-08-16(v2.19.1-3): - * add `TLS_CERT_FILE` and `TLS_KEY_FILE` variables (v2.19.1-3) +* 2024-08-18: add --json option to lmConfigEditor +* 2024-08-18: add message-broker +* 2024-08-18(v2.19.1-3): + * add `TLS_CERT_FILE` and `TLS_KEY_FILE` variables * preserve requests in RELAY * 2024-08-14: add RELAY variable (v2.19.1-2) * 2024-08-13: add reCaptcha plugin diff --git a/full/Dockerfile b/full/Dockerfile index 797e97d..c3778e3 100644 --- a/full/Dockerfile +++ b/full/Dockerfile @@ -26,6 +26,7 @@ RUN \ echo patch crowdsec.patch && patch -p1 < crowdsec.patch && \ echo patch recaptcha.patch && patch -p1 < recaptcha.patch && \ echo patch msg-broker.patch && patch -p1 < msg-broker.patch && \ + echo patch lmConfigEditor.patch && patch -p1 < lmConfigEditor.patch && \ rm -f *.patch && \ LLNG_DEFAULTCONFFILE=/etc/lemonldap-ng/lemonldap-ng.ini \ perl -MLemonldap::NG::Manager::Build -e 'Lemonldap::NG::Manager::Build->run( \ diff --git a/full/lmConfigEditor.patch b/full/lmConfigEditor.patch new file mode 100644 index 0000000..11c61d8 --- /dev/null +++ b/full/lmConfigEditor.patch @@ -0,0 +1,55 @@ +--- a/usr/share/lemonldap-ng/bin/lmConfigEditor ++++ b/usr/share/lemonldap-ng/bin/lmConfigEditor +@@ -18,10 +18,12 @@ my $cli = Lemonldap::NG::Manager::Cli::Lib->new; + + our $opt_user = 'www-data'; + our $opt_group = 'www-data'; ++our $opt_json; + + GetOptions( + "user=s" => \$opt_user, +- "group=s" => \$opt_group ++ "group=s" => \$opt_group, ++ "json" => \$opt_json, + ) or die("Error in command line arguments\n"); + + eval { +@@ -45,10 +47,17 @@ delete $refConf->{cfgAuthorIP}; + delete $refConf->{cfgDate}; + $refConf->{cfgLog} = ''; + +-# Sort keys +-$Data::Dumper::Sortkeys = 1; +-$Data::Dumper::Useperl = 1; +-my $tmp = Dumper($refConf); ++my $tmp; ++if ($opt_json) { ++ require JSON; ++ $tmp = JSON->new->pretty->canonical->encode($refConf); ++} ++else { ++ # Sort keys ++ $Data::Dumper::Sortkeys = 1; ++ $Data::Dumper::Useperl = 1; ++ $tmp = Dumper($refConf); ++} + + my $refFile = File::Temp->new( UNLINK => 1 ); + my $editFile = File::Temp->new( UNLINK => 1 ); +@@ -73,8 +82,14 @@ if ( $rc == 0 and compare( $refFile->filename, $editFile->filename ) == 1 ) { + my $buf = join( '', <$F1> ); + close $F1; + +- my $newConf = Safe->new->reval($buf); +- die $EVAL_ERROR if $EVAL_ERROR; ++ my $newConf; ++ if ($opt_json) { ++ $newConf = JSON::from_json($buf); ++ } ++ else { ++ $newConf = Safe->new->reval($buf); ++ die $EVAL_ERROR if $EVAL_ERROR; ++ } + + # Update author and date + $newConf->{cfgAuthor} = diff --git a/manager/Dockerfile b/manager/Dockerfile index cb2122a..250d677 100644 --- a/manager/Dockerfile +++ b/manager/Dockerfile @@ -33,6 +33,7 @@ RUN \ echo patch crowdsec.patch && patch -p1 < crowdsec.patch && \ echo patch recaptcha.patch && patch -p1 < recaptcha.patch && \ echo patch msg-broker.patch && patch -p1 < msg-broker.patch && \ + echo patch lmConfigEditor.patch && patch -p1 < lmConfigEditor.patch && \ rm -f *.patch && \ LLNG_DEFAULTCONFFILE=/etc/lemonldap-ng/lemonldap-ng.ini \ perl -MLemonldap::NG::Manager::Build -e 'Lemonldap::NG::Manager::Build->run( \ diff --git a/manager/lmConfigEditor.patch b/manager/lmConfigEditor.patch new file mode 100644 index 0000000..11c61d8 --- /dev/null +++ b/manager/lmConfigEditor.patch @@ -0,0 +1,55 @@ +--- a/usr/share/lemonldap-ng/bin/lmConfigEditor ++++ b/usr/share/lemonldap-ng/bin/lmConfigEditor +@@ -18,10 +18,12 @@ my $cli = Lemonldap::NG::Manager::Cli::Lib->new; + + our $opt_user = 'www-data'; + our $opt_group = 'www-data'; ++our $opt_json; + + GetOptions( + "user=s" => \$opt_user, +- "group=s" => \$opt_group ++ "group=s" => \$opt_group, ++ "json" => \$opt_json, + ) or die("Error in command line arguments\n"); + + eval { +@@ -45,10 +47,17 @@ delete $refConf->{cfgAuthorIP}; + delete $refConf->{cfgDate}; + $refConf->{cfgLog} = ''; + +-# Sort keys +-$Data::Dumper::Sortkeys = 1; +-$Data::Dumper::Useperl = 1; +-my $tmp = Dumper($refConf); ++my $tmp; ++if ($opt_json) { ++ require JSON; ++ $tmp = JSON->new->pretty->canonical->encode($refConf); ++} ++else { ++ # Sort keys ++ $Data::Dumper::Sortkeys = 1; ++ $Data::Dumper::Useperl = 1; ++ $tmp = Dumper($refConf); ++} + + my $refFile = File::Temp->new( UNLINK => 1 ); + my $editFile = File::Temp->new( UNLINK => 1 ); +@@ -73,8 +82,14 @@ if ( $rc == 0 and compare( $refFile->filename, $editFile->filename ) == 1 ) { + my $buf = join( '', <$F1> ); + close $F1; + +- my $newConf = Safe->new->reval($buf); +- die $EVAL_ERROR if $EVAL_ERROR; ++ my $newConf; ++ if ($opt_json) { ++ $newConf = JSON::from_json($buf); ++ } ++ else { ++ $newConf = Safe->new->reval($buf); ++ die $EVAL_ERROR if $EVAL_ERROR; ++ } + + # Update author and date + $newConf->{cfgAuthor} = diff --git a/portal/haproxy b/portal/haproxy deleted file mode 120000 index fe582ed..0000000 --- a/portal/haproxy +++ /dev/null @@ -1 +0,0 @@ -../manager/haproxy \ No newline at end of file diff --git a/uwsgi-portal/haproxy b/uwsgi-portal/haproxy deleted file mode 120000 index fe582ed..0000000 --- a/uwsgi-portal/haproxy +++ /dev/null @@ -1 +0,0 @@ -../manager/haproxy \ No newline at end of file