From 622f71d9016e871d6b6a4fbb9e3d216187a42966 Mon Sep 17 00:00:00 2001 From: wpetit Date: Thu, 11 Jun 2020 14:59:52 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2de6bc2..67ec39e 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ L'interface Web sera accessible à l'adresse http://localhost:8080/. Le serveur SMTP sera accessible sur le port 2525. L'authentification est désactivée par défaut. +Voir la section "[Variables d'environnement](#variables-denvironnement)" pour voir comment personnaliser la configuration du service. + ### Avec les binaires > TODO From f2530bf3907cb9796784385e86d7b188d3172bcf Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 17 Jun 2020 23:48:32 +0200 Subject: [PATCH 3/4] Fix anonymous login --- cmd/fake-smtp/smtp.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/fake-smtp/smtp.go b/cmd/fake-smtp/smtp.go index 2963f0e..509dacc 100644 --- a/cmd/fake-smtp/smtp.go +++ b/cmd/fake-smtp/smtp.go @@ -43,7 +43,9 @@ func (b *Backend) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, err return nil, smtp.ErrAuthRequired } - return nil, nil + ctx := context.WithValue(context.Background(), container.KeyServiceContainer, b.ctn) + + return &Session{ctx, b.ctn, "anonymous"}, nil } // A Session is returned after successful login. @@ -105,6 +107,11 @@ func startSMTPServer(conf *config.Config, ctn *service.Container) { s.MaxMessageBytes = conf.SMTP.MaxMessageBytes s.MaxRecipients = conf.SMTP.MaxRecipients s.AllowInsecureAuth = conf.SMTP.AllowInsecureAuth + + if conf.SMTP.Username == "" && conf.SMTP.Password == "" { + s.AuthDisabled = true + } + if conf.SMTP.Debug { s.Debug = os.Stdout } From 88660cdd78809af937f3718ef5df817cc3d3881d Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 17 Jun 2020 23:48:56 +0200 Subject: [PATCH 4/4] Fix Docker packaging --- .dockerignore | 2 +- misc/docker/Dockerfile | 9 ++++++++- misc/docker/config-patch.yml | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 misc/docker/config-patch.yml diff --git a/.dockerignore b/.dockerignore index 279fc8e..e4adc91 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,6 @@ /vendor /data /bin -/misc/docker +/misc/docker/Dockerfile /.env /.env.dist \ No newline at end of file diff --git a/misc/docker/Dockerfile b/misc/docker/Dockerfile index 32e2447..ac5a441 100644 --- a/misc/docker/Dockerfile +++ b/misc/docker/Dockerfile @@ -14,8 +14,13 @@ COPY . /src WORKDIR /src +RUN cp -f misc/docker/config-patch.yml misc/release/config-patch.yml + +RUN go get github.com/krishicks/yaml-patch/cmd/yaml-patch + RUN npm install \ && make vendor \ + && echo "---" > ./misc/release/config-patch.yml \ && make ARCH_TARGETS=amd64 release FROM busybox @@ -24,4 +29,6 @@ COPY --from=build /src/release/fake-smtp-linux-amd64 /app WORKDIR /app -CMD ["bin/fake-smtp", "--config", "fake-smtp.yml"] \ No newline at end of file +RUN mkdir -p /app + +CMD ["bin/fake-smtp", "--config", "config.yml"] \ No newline at end of file diff --git a/misc/docker/config-patch.yml b/misc/docker/config-patch.yml new file mode 100644 index 0000000..cf67519 --- /dev/null +++ b/misc/docker/config-patch.yml @@ -0,0 +1,4 @@ +--- +- op: replace + path: /smtp/debug + value: false \ No newline at end of file