mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-27 02:10:52 +08:00
Allow disabling STARTTLS
This commit is contained in:
parent
eb3c5cca67
commit
7613356cb8
9 changed files with 34 additions and 11 deletions
|
@ -70,7 +70,7 @@ bugsnagCode=""
|
|||
# @include "sender.toml"
|
||||
|
||||
[smtp.setup]
|
||||
# Public configuration for SMTP MDA
|
||||
hostname="localtest.me"
|
||||
secure=false
|
||||
port=2587
|
||||
# Public configuration for SMTP MDA, needed for mobileconfig files
|
||||
hostname="localhost"
|
||||
secure=false
|
||||
port=2587
|
||||
|
|
|
@ -17,6 +17,14 @@ retention=30
|
|||
# if `true` then do not autodelete expired messages
|
||||
disableRetention=false
|
||||
|
||||
# If true, then disables STARTTLS support
|
||||
disableSTARTTLS=false
|
||||
|
||||
[id]
|
||||
#name="Wild Duck IMAP"
|
||||
#version="1.0.0"
|
||||
#vendor="Wild Duck"
|
||||
|
||||
[setup]
|
||||
# Public configuration for IMAP
|
||||
hostname="localhost"
|
||||
|
|
|
@ -7,6 +7,15 @@ host="127.0.0.1"
|
|||
# Max accepted size for messages pushed via LMTP
|
||||
maxMB=25
|
||||
|
||||
# If true then disables STARTTLS usage
|
||||
disableSTARTTLS=false
|
||||
|
||||
# Greeting message for connecting client
|
||||
banner="Welcome to Wild Duck Mail Server"
|
||||
|
||||
# Server hostname. Defaults to os.hostname() if false
|
||||
name=false
|
||||
|
||||
[tls]
|
||||
# If certificate path is not defined, use global or built-in self-signed certs for STARTTLS
|
||||
#key="/path/to/server/key.pem"
|
||||
|
|
|
@ -8,6 +8,9 @@ host="127.0.0.1"
|
|||
# POP3 server is limited and does not support the STLS command
|
||||
secure=true
|
||||
|
||||
# If true, then do not show server info in CAPA response
|
||||
disableVersionString=false
|
||||
|
||||
# How many latest messages to list for LIST and UIDL
|
||||
# POP3 server never lists all messages but only a limited length list
|
||||
maxMessages=250
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
handler(command, callback, next) {
|
||||
let token = ((command.attributes && command.attributes[0] && command.attributes[0].value) || '').toString().trim();
|
||||
|
||||
if (!this.secure && !this._server.options.ignoreSTARTTLS) {
|
||||
if (!this.secure && !this._server.options.disableSTARTTLS && !this._server.options.ignoreSTARTTLS) {
|
||||
// Only allow authentication using TLS
|
||||
return callback(null, {
|
||||
response: 'BAD',
|
||||
|
|
|
@ -5,9 +5,11 @@ module.exports = {
|
|||
let capabilities = [];
|
||||
|
||||
if (!this.secure) {
|
||||
capabilities.push('STARTTLS');
|
||||
if (!this._server.options.ignoreSTARTTLS) {
|
||||
capabilities.push('LOGINDISABLED');
|
||||
if (!this._server.options.disableSTARTTLS) {
|
||||
capabilities.push('STARTTLS');
|
||||
if (!this._server.options.ignoreSTARTTLS) {
|
||||
capabilities.push('LOGINDISABLED');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = {
|
|||
let username = Buffer.from((command.attributes[0].value || '').toString().trim(), 'binary').toString();
|
||||
let password = Buffer.from((command.attributes[1].value || '').toString().trim(), 'binary').toString();
|
||||
|
||||
if (!this.secure && !this._server.options.ignoreSTARTTLS) {
|
||||
if (!this.secure && !this._server.options.disableSTARTTLS && !this._server.options.ignoreSTARTTLS) {
|
||||
// Only allow authentication using TLS
|
||||
return callback(null, {
|
||||
response: 'BAD',
|
||||
|
|
1
imap.js
1
imap.js
|
@ -41,6 +41,7 @@ const onGetQuota = require('./lib/handlers/on-get-quota');
|
|||
// Setup server
|
||||
const serverOptions = {
|
||||
secure: config.imap.secure,
|
||||
disableSTARTTLS: config.imap.disableSTARTTLS,
|
||||
ignoreSTARTTLS: config.imap.ignoreSTARTTLS,
|
||||
|
||||
id: {
|
||||
|
|
4
lmtp.js
4
lmtp.js
|
@ -41,12 +41,12 @@ const serverOptions = {
|
|||
}
|
||||
},
|
||||
|
||||
name: false,
|
||||
name: config.lmtp.name || false,
|
||||
|
||||
// not required but nice-to-have
|
||||
banner: config.lmtp.banner || 'Welcome to Wild Duck Mail Server',
|
||||
|
||||
disabledCommands: ['AUTH'],
|
||||
disabledCommands: ['AUTH'].concat(config.lmtp.disableSTARTTLS ? 'STARTTLS' : []),
|
||||
|
||||
onMailFrom(address, session, callback) {
|
||||
// reset session entries
|
||||
|
|
Loading…
Reference in a new issue