Ejemplo n.º 1
0
 net_utils.get_ips_by_host(addr.exchange, (err2, addresses2) => {
     pending_queries--;
     if (!txn) return;
     if (err2 && err2.length === 2) {
         results.add(plugin, {msg: err2[0].message});
         connection.logdebug(plugin, domain + ': MX ' +
                 addr.priority + ' ' + addr.exchange +
                 ' => ' + err2[0].message);
         check_results();
         return;
     }
     connection.logdebug(plugin, domain + ': MX ' + addr.priority +
             ' ' + addr.exchange + ' => ' + addresses2);
     for (let i=0; i < addresses2.length; i++) {
         // Ignore anything obviously bogus
         if (net.isIPv4(addresses2[i])){
             if (plugin.re_bogus_ip.test(addresses2[i])) {
                 connection.logdebug(plugin, addr.exchange +
                         ': discarding ' + addresses2[i]);
                 continue;
             }
         }
         if (net.isIPv6(addresses2[i])){
             if (net_utils.ipv6_bogus(addresses2[i])) {
                 connection.logdebug(plugin, addr.exchange +
                         ': discarding ' + addresses2[i]);
                 continue;
             }
         }
         records[addresses2[i]] = 1;
     }
     check_results();
 });
Ejemplo n.º 2
0
    net_utils.get_ips_by_host(domain, (err, addresses) => {
        if (!txn) return;
        if (!addresses || !addresses.length) {
            txn.results.add(plugin, {fail: 'has_fwd_dns'});
            return mxDone(((plugin.cfg.main.reject_no_mx) ? DENY : DENYSOFT),
                'No MX for your FROM address');
        }

        connection.logdebug(plugin, domain + ': A/AAAA => ' + addresses);
        let records = {};
        for (let i=0; i < addresses.length; i++) {
            const addr = addresses[i];
            // Ignore anything obviously bogus
            if (net.isIPv4(addr)){
                if (plugin.re_bogus_ip.test(addr)) {
                    connection.logdebug(plugin, domain + ': discarding ' + addr);
                    continue;
                }
            }
            if (net.isIPv6(addr)){
                if (net_utils.ipv6_bogus(addr)) {
                    connection.logdebug(plugin, domain + ': discarding ' + addr);
                    continue;
                }
            }
            records[addr] = true;
        }

        records = Object.keys(records);
        if (records && records.length) {
            txn.results.add(plugin, {pass: '******'});
            return mxDone();
        }

        txn.results.add(plugin, {fail: 'implicit_mx('+domain+')'});
        return mxDone();
    });