r/Ubiquiti•
msemack2

EdgeRouter Pro Config Hardening Tips?

I am planning to deploy an EdgeRouter Pro for our DIA Ethernet connection. I have a pair of UTM firewalls for the firewalling/NAT/VPN. So the router will be used JUST for routing.

Since this is my first project using EdgeOS, I am looking for any recommendations on securing the router. My basic thoughts:

  • eth0 is the WAN port for the ISP's Ethernet handoff.

  • eth1 and eth2 are bridged and provide the LAN side of the router. One port to each firewall in the HA pair.

  • eth3 will be for management (10.1.1.x/24) and will be plugged into the local network.

  • Non-default username and PW.

  • Disable telnet and snmp.

  • Disable lldp on eth0.

  • Use service gui listen-address & service ssh listen-address so the management services only listen on eth3.

  • Set firewall policies to drop any http/https/telnet/ssh/snmp/ntp requests to eth0/1/2.

Since I will have a "real" firewall to protect the network, so the only firewall policies I need on the router would be to protect the router itself.

Anything else I am missing? Any other protections I should/shouldn't apply?

EDIT 11/07/2016: Ok, this is what I came up with so far, does anyone have any feedback? I have not tested it yet. The router is still on my desk.

Some things I am still shaky on:

  • Traffic limiting. I want to perform some basic sanity checks on the WAN interface to guard against a simple ICMP flood. I don't really need a full QoS policy. I have that handled with the UTM firewall that sits behind the router. I am not sure if the policy I have in place will achieve that.

  • Power loss protection. Ubiquiti's docs say that an improper shutdown can lead to data loss. This seems rather unfortunate for a network device. Are there any configuration changes I can make so it is more tolerant of power interruptions?

  • User login limits/lockouts/timeouts. I do not see anything to limit brute force login attempts, or timeout idle connections. Is there anything in EdgeOS to do this?

Things I haven't setup yet:

  • config archiving via ftp/whatever

  • syslog to an external server

  • SSH key authentication

Here is my (sanitized) config:

firewall {
    all-ping enable
    broadcast-ping disable
    group {
        address-group MARTIAN_ADDRESSES {
            address 0.0.0.0/8
            address 10.0.0.0/8
            address 100.64.0.0/10
            address 127.0.0.0/8
            address 127.0.53.53
            address 169.254.0.0/16
            address 172.16.0.0/12
            address 192.0.0.0/24
            address 192.0.2.0/24
            address 192.168.0.0/16
            address 198.18.0.0/15
            address 198.51.100.0/24
            address 203.0.113.0/24
            address 224.0.0.0/4
            address 240.0.0.0/4
            address 255.255.255.255
            description "IPs that should never be seen on a public interface"
        }
    }
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    name PROTECT_ROUTER {
        default-action drop
        description "Filter traffic aimed at the router itself"
        enable-default-log
        rule 1 {
            action drop
            description "Block Invalid"
            log enable
            protocol all
            state {
                established disable
                invalid enable
                new disable
                related disable
            }
        }
        rule 2 {
            action accept
            description "Allow ICMP"
            log disable
            protocol icmp
        }
    }
    name WAN_TO_LAN {
        default-action accept
        description "Filter traffic destined for our network"
        rule 1 {
            action drop
            description "Block Invalid"
            log enable
            protocol all
            state {
                established disable
                invalid enable
                new disable
                related disable
            }
        }
        rule 5 {
            action drop
            description "Block Martians"
            log enable
            protocol all
            source {
                group {
                    address-group MARTIAN_ADDRESSES
                }
            }
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    bridge br0 {
        address XXX.XXX.XXX.222/27
        aging 300
        bridged-conntrack disable
        description "Router LAN to Firewall"
        firewall {
            local {
                name PROTECT_ROUTER
            }
        }
        hello-time 2
        max-age 20
        priority 32768
        promiscuous enable
        stp false
    }
    ethernet eth0 {
        address YYY.YYY.YYY.174/30
        description "Router WAN to Level3"
        duplex full
        firewall {
            in {
                name WAN_TO_LAN
            }
            local {
                name PROTECT_ROUTER
            }
        }
        speed 100
        traffic-policy {
            in WAN_LIMITER
        }
    }
    ethernet eth1 {
        bridge-group {
            bridge br0
        }
        description "Router LAN to Firewall"
        duplex auto
        firewall {
            local {
                name PROTECT_ROUTER
            }
        }
        speed auto
    }
    ethernet eth2 {
        bridge-group {
            bridge br0
        }
        description "Router LAN to Firewall"
        duplex auto
        firewall {
            local {
                name PROTECT_ROUTER
            }
        }
        speed auto
    }
    ethernet eth3 {
        address 10.1.2.3/24
        description "Management"
        duplex auto
        speed auto
    }
    ethernet eth4 {
        disable
        duplex auto
        speed auto
    }
    ethernet eth5 {
        disable
        duplex auto
        speed auto
    }
    ethernet eth6 {
        disable
        duplex auto
        speed auto
    }
    ethernet eth7 {
        disable
        duplex auto
        speed auto
    }
    loopback lo {
    }
}
port-forward {
    auto-firewall disable
    hairpin-nat disable
    wan-interface eth0
}
protocols {
    igmp-proxy {
        disable
    }
    static {
        interface-route 10.0.0.0/8 {
            next-hop-interface eth3 {
                description "Private network via eth3"
            }
        }
    }
}
service {
    dhcp-server {
        disabled true
        hostfile-update disable
        use-dnsmasq disable
    }
    gui {
        http-port 80
        https-port 443
        listen-address 10.1.2.3
        older-ciphers disable
    }
    lldp {
        interface eth0 {
            disable
        }
    }
    ssh {
        listen-address 10.1.2.3
        port 22
        protocol-version v2
    }
    ubnt-discover {
        disable
    }
}
system {
    config-management {
        commit-revisions 64
    }
    domain-name mydomain.com
    gateway-address YYY.YYY.YYY.173
    host-name router1
    ipv6 {
        disable
    }
    login {
        banner {
            pre-login "\nTHIS IS A PRIVATE COMPUTER SYSTEM BLAH BLAH\n\n"
        }
        user whatever {
            authentication {
                encrypted-password WHATEVERPW
            }
            full-name "Admin Account"
            level admin
        }
    }
    name-server 10.1.2.XXX
    name-server 10.1.2.YYY
    ntp {
        server ntp1.mydomain.com {
        }
    }
    offload {
        hwnat disable
        ipv4 {
            forwarding enable
        }
    }
    options {
        reboot-on-panic true
    }
    syslog {
        file router1.log {
            archive {
                files 8
                size 1024
            }
            facility all {
                level info
            }
        }
        global {
            archive {
                files 8
                size 1024
            }
            facility all {
                level info
            }
        }
    }
    time-zone America/New_York
}
traffic-policy {
    limiter WAN_LIMITER {
        class 10 {
            bandwidth 512
            burst 15k
            description "Prevent ICMP from flooding connection"
            match ICMP {
                ip {
                    protocol icmp
                }
            }
            priority 20
        }
    }
}

Posted Nov 4, 2016, 2:11 AM UTC · edited

33
imjustmatthew•

I would change your firewall config for the router itself to only allow DHCP and whatever else you need incoming to the router itself -- default deny rather than default allow. Also, zone-firewall is awesome if you can tolerate the longer boot times, even just for firewalling the router.

You may want to disable ubnt-discover.

Use config-management, both archive and revisions, so that you can monitor yourself and others, and revert temporary "testing" changes easily when troubleshooting.

Set the ssh server to protocol 2 only and, if possible, to use ssh-keys. Even on your management network I'd be wary of password based SSH.

The traffic analysis functions aren't really a security feature, but are nice to enable and shouldn't really impact performance since they're fully compatible with offload.

2
msemack2OP•

Thanks for the tips. I have edited my post with the config I have so far. Would appreciate any feedback.

1
imjustmatthew•

Traffic limiting. I want to perform some basic sanity checks on the WAN interface to guard against a simple ICMP flood. I don't really need a full QoS policy. I have that handled with the UTM firewall that sits behind the router. I am not sure if the policy I have in place will achieve that.

I think doing this disables offload (hardware acceleration of packet processing). You may want to look into this. Offload is critical for my applications but may not be for yours depending on the throughput you need.

Power loss protection. Ubiquiti's docs say that an improper shutdown can lead to data loss. This seems rather unfortunate for a network device. Are there any configuration changes I can make so it is more tolerant of power interruptions?

In my experience this was a greater problem with early units that had flaky USB drives inside. I have not seen this occur on newer units.

User login limits/lockouts/timeouts. I do not see anything to limit brute force login attempts, or timeout idle connections. Is there anything in EdgeOS to do this?

I'm unaware of anything like that on EdgeOS except in the firewall layer. If you're restricting remote access to an isolated management network and requiring SSH keys for SSH I'd personally be fairly comfortable. What's your threat model?

file router1.log {

I think that whole stanza is unnecessary unless you have a specific need for a second log file. /var/log/messages seems to still contain all the syslog data.

1