Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2486869b6b | |||
| 327173c8f6 | |||
| dcb007f8b8 | |||
| 607ac0803b |
@@ -12,6 +12,11 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
|
# Optional SES SMTP relay settings (FLOCI_SERVICES_SES_SMTP_*), kept outside the repo
|
||||||
|
# because they hold a password. Without the file, sent emails stay in the SES mailbox.
|
||||||
|
env_file:
|
||||||
|
- path: ${HOME}/.config/thecloud/ses-smtp.env
|
||||||
|
required: false
|
||||||
environment:
|
environment:
|
||||||
FLOCI_SERVICES_DOCKER_NETWORK: floci_default
|
FLOCI_SERVICES_DOCKER_NETWORK: floci_default
|
||||||
FLOCI_SERVICES_RDS_PROXY_BASE_PORT: "7001"
|
FLOCI_SERVICES_RDS_PROXY_BASE_PORT: "7001"
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class SmtpRelay {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(SmtpRelay.class);
|
private static final Logger LOG = Logger.getLogger(SmtpRelay.class);
|
||||||
private static final long RELAY_TIMEOUT_SECONDS = 30;
|
private static final long RELAY_TIMEOUT_SECONDS = 30;
|
||||||
|
/** Every SASL method the mail client supports except XOAUTH2, which expects a token. */
|
||||||
|
static final String PASSWORD_AUTH_METHODS = "CRAM-SHA256 CRAM-SHA1 CRAM-MD5 DIGEST-MD5 LOGIN PLAIN";
|
||||||
|
|
||||||
/** SES control header naming the configuration set to apply to a raw send. */
|
/** SES control header naming the configuration set to apply to a raw send. */
|
||||||
public static final String HEADER_CONFIGURATION_SET = "X-SES-CONFIGURATION-SET";
|
public static final String HEADER_CONFIGURATION_SET = "X-SES-CONFIGURATION-SET";
|
||||||
@@ -118,6 +120,9 @@ public class SmtpRelay {
|
|||||||
.filter(u -> !u.isBlank())
|
.filter(u -> !u.isBlank())
|
||||||
.ifPresent(u -> {
|
.ifPresent(u -> {
|
||||||
mailConfig.setUsername(u);
|
mailConfig.setUsername(u);
|
||||||
|
// smtp-pass is a password, never an OAuth token: without this the client prefers
|
||||||
|
// XOAUTH2 whenever the server offers it (Gmail does) and the login is refused.
|
||||||
|
mailConfig.setAuthMethods(PASSWORD_AUTH_METHODS);
|
||||||
config.services().ses().smtpPass()
|
config.services().ses().smtpPass()
|
||||||
.filter(p -> !p.isBlank())
|
.filter(p -> !p.isBlank())
|
||||||
.ifPresent(mailConfig::setPassword);
|
.ifPresent(mailConfig::setPassword);
|
||||||
|
|||||||
@@ -287,7 +287,8 @@ class SmtpRelayServerTest {
|
|||||||
String command = line.toUpperCase(Locale.ROOT);
|
String command = line.toUpperCase(Locale.ROOT);
|
||||||
if (command.startsWith("EHLO")) {
|
if (command.startsWith("EHLO")) {
|
||||||
reply(out, "250-floci-stub");
|
reply(out, "250-floci-stub");
|
||||||
reply(out, "250 AUTH PLAIN");
|
// Gmail also offers OAuth sign-in, which a password must never be sent as.
|
||||||
|
reply(out, "250 AUTH PLAIN XOAUTH2 OAUTHBEARER");
|
||||||
} else if (command.startsWith("HELO")) {
|
} else if (command.startsWith("HELO")) {
|
||||||
reply(out, "250 floci-stub");
|
reply(out, "250 floci-stub");
|
||||||
} else if (command.startsWith("AUTH")) {
|
} else if (command.startsWith("AUTH")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user