Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 3.3 KB

server.md

File metadata and controls

116 lines (90 loc) · 3.3 KB

Server

Rudimentary debug server. It supports user authentication and EHLO scenarios. Outside of the given scenarios will accept everything.

Configuration

server.json5

{
    // Hostname to declare in welcome message.
    hostname: "example.com",

    // Interface the server will bind too (default: ::).
    bind: "::",

    // Port the server will listen too (default: 25).
    port: 25,

    // Number of connections to be allowed in the backlog (default: 25).
    backlog: 25,

    // Maximum number of SMTP transactions to process ofver a connection.
    transactionsLimit: 200,

    // Number of SMTP errors to allow before terminating connection (default: 3).
    errorLimit: 3,

    // Advertise AUTH support (default: true).
    auth: true,

    // Advertise STARTTLS support (default: true).
    starttls: true,

    // Advertise CHUNKING support (default: true).
    chunking: true,

    // Java keystore (default: /usr/local/keystore.jks).
    keystore: "/usr/local/keystore",

    // Keystore password.
    keystorepassword: "avengers",

    // Email storage configuration.
    storage: {
        enabled: true,

        // Path to storage folder.
        path: "/usr/local/store",

        // Auto clean storage on service start.
        clean: true,

        // Auto clean delete matching filenames only.
        patterns: [
        "^([0-9]{8}\\.)"
      ]
    },
  
    // Users allowed to authorize to the server.
    users: [
        {
            name: "[email protected]",
            pass: "giveHerTheRing"
        }
    ],

    // Predefined server response scenarios based on EHLO value.
    scenarios: {

        // Default scenario to use if no others match.
        "*": {
            rcpt: [
                // Custom response for addresses matching value regex.
                {
                    value: "friday\\-[0-9]+@example\\.com",
                    response: "252 I think I know this user"
                }
            ]
        },

        // How to reject mail at different commands.
        "reject.com": {
            // Custom response for EHLO.
            ehlo: "501 Not talking to you",

            // Custom response for MAIL.
            mail: "451 I'm not listening to you",

            // Custom response for given recipients.
            rcpt: [
                {
                    value: "ultron@reject\\.com",
                    response: "501 Heart not found"
                }
            ],

            // Custom response for DATA.
            data: "554 Your data is corrupted"
        },

        // How to configure TLS for failure using a deprecated version and weak cipher.
        "failtls.com": {
        
            // Custom response for STARTTLS.
            // STARTTLS also supports a list of protocols and ciphers to use handshake. 
            starttls: {
                response: "220 You will fail",
                protocols: ["TLSv1.0"],
                ciphers: ["TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"],
            }
        }
    }
}