Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mailet/api/src/main/java/org/apache/mailet/Mail.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public interface Mail extends Serializable, Cloneable {

AttributeName SMTP_AUTH_USER = AttributeName.of("org.apache.james.SMTPAuthUser");
AttributeName SMTP_HELO = AttributeName.of("org.apache.james.HELO");
AttributeName SSL_PROTOCOL = AttributeName.of("org.apache.james.ssl.protocol");
AttributeName SSL_CIPHER = AttributeName.of("org.apache.james.ssl.cipher");
AttributeName SMTP_SESSION_ID = AttributeName.of("org.apache.james.SMTPSessionID");
AttributeName MAILET_ERROR = AttributeName.of("org.apache.james.MailetError");
Attribute SENT_BY_MAILET_ATTRIBUTE = Attribute.convertToAttribute("org.apache.james.SentByMailet", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public HookResult onMessage(SMTPSession session, Mail mail) {
session.getAttachment(SMTPSession.CURRENT_HELO_NAME, ProtocolSession.State.Connection)
.ifPresent(helo -> mail.setAttribute(new Attribute(Mail.SMTP_HELO, AttributeValue.of(helo))));

session.getSSLSession().ifPresent(sslSession -> {
mail.setAttribute(new Attribute(Mail.SSL_PROTOCOL, AttributeValue.of(sslSession.getProtocol())));
mail.setAttribute(new Attribute(Mail.SSL_CIPHER, AttributeValue.of(sslSession.getCipherSuite())));
});

if (session.getUsername() != null) {
mail.setAttribute(new Attribute(Mail.SMTP_AUTH_USER, AttributeValue.of(session.getUsername().asString())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ private void transportInformationToHeaders(Mail mail, io.netty.handler.codec.htt
.filter(String.class::isInstance)
.map(String.class::cast)
.ifPresent(user -> headers.add("User", user));

// SSL details
mail.getAttribute(Mail.SSL_PROTOCOL)
.map(attr -> attr.getValue().value())
.filter(String.class::isInstance)
.map(String.class::cast)
.ifPresent(tlsVersion -> headers.add("TLS-Version", tlsVersion));
mail.getAttribute(Mail.SSL_CIPHER)
.map(attr -> attr.getValue().value())
.filter(String.class::isInstance)
.map(String.class::cast)
.ifPresent(cipher -> headers.add("TLS-Cipher", cipher));
}

private HttpClient buildReactorNettyHttpClient(RspamdClientConfiguration configuration) {
Expand Down