Login attempt for nonexistent user from

Dear all, i notice in system logs some lines like attack.

Tue Mar 18 21:51:52 2025 authpriv.warn dropbear[2011]: Login attempt for nonexistent user from 185.7.214.37:52328
Tue Mar 18 21:51:52 2025 authpriv.info dropbear[2011]: Exit before auth from <185.7.214.37:52328>: Error reading: Connection reset by peer
Tue Mar 18 21:51:52 2025 authpriv.info dropbear[2012]: Child connection from 185.7.214.37:52334
Tue Mar 18 21:51:53 2025 authpriv.warn dropbear[2012]: Login attempt for nonexistent user from 185.7.214.37:52334
Tue Mar 18 21:51:54 2025 authpriv.info dropbear[2012]: Exit before auth from <185.7.214.37:52334>: Error reading: Connection reset by peer
Tue Mar 18 21:51:54 2025 authpriv.info dropbear[2013]: Child connection from 185.7.214.37:52352
Tue Mar 18 21:51:54 2025 authpriv.warn dropbear[2013]: Login attempt for nonexistent user from 185.7.214.37:52352
Tue Mar 18 21:51:55 2025 authpriv.info dropbear[2013]: Exit before auth from <185.7.214.37:52352>: Error reading: Connection reset by peer
Tue Mar 18 21:51:55 2025 authpriv.info dropbear[2014]: Child connection from 185.7.214.37:52376
Tue Mar 18 21:51:55 2025 authpriv.warn dropbear[2014]: Login attempt for nonexistent user from 185.7.214.37:52376
Tue Mar 18 21:51:56 2025 authpriv.info dropbear[2014]: Exit before auth from <185.7.214.37:52376>: Error reading: Connection reset by peer

what to do in this case ?
Sincerly,
Arnaud

I'd recommend not having ssh open to the wan, instead accessing your network via wireguard instead.

7 Likes

done, and added banIP.
no more messages !
But am i safed ?

Arnaud

Let's review your firewall config so we can help determine if you have any problems.

cat /etc/config/firewall
2 Likes

By default, the firewall should have never allowed ssh (or anything) from wan coming in, so either you or something else opened (at least-) port 22 to the outside. As you've seen, these are being hammered constantly from the shadier sides of the internet - and we have no idea if any of those succeeded (especially if your passwords were too weak).

You should really think twice before opening any ports to the outside, maybe a roadwarrior style VPN (wireguard) will offer you the same capabilities, just a lot safer than exposing the ports directly to everyone around the world.

3 Likes

here it is.


config defaults
	option syn_flood '1'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'

config zone
	option name 'lan'
	list network 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone
	option name 'wan'
	list network 'wan'
	list network 'wan6'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'

config forwarding
	option src 'lan'
	option dest 'wan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config redirect
	option dest_port '53'
	option src 'wan'
	option name 'DNS'
	option src_dport '53'
	option target 'DNAT'
	option dest_ip '192.168.1.101'
	option dest 'lan'

config redirect
	option src 'wan'
	option target 'DNAT'
	option dest_ip '192.168.1.1'
	option dest 'lan'
	option name 'openwrt http'
	option dest_port '80'
	option src_dport '180'
	option enabled '0'

config redirect
	option src 'wan'
	option target 'DNAT'
	option dest 'lan'
	option name 'openwrt https'
	option dest_port '443'
	option dest_ip '192.168.1.1'
	option src_dport '1443'
	option enabled '0'

config redirect
	option src 'wan'
	option target 'DNAT'
	option dest_ip '192.168.1.1'
	option dest 'lan'
	option src_dport '1022'
	option dest_port '122'
	option name 'openwrt ssh'
	option enabled '0'

config redirect
	option dest 'lan'
	option target 'DNAT'
	option name 'Http HA'
	option src 'wan'
	option src_dport '8123'
	option dest_ip '192.168.1.199'
	option dest_port '8123'

config redirect
	option src 'wan'
	option target 'DNAT'
	option dest 'lan'
	option dest_port '8123'
	option name 'Home Assistant'
	option dest_ip '192.168.1.199'
	option src_dport '80'
	option enabled '0'

config redirect
	option dest 'lan'
	option target 'DNAT'
	option name 'https HA'
	option src 'wan'
	option src_dport '443'
	option dest_ip '192.168.1.199'
	option dest_port '443'
	option enabled '0'

config redirect
	option src 'wan'
	option target 'DNAT'
	option dest 'lan'
	list proto 'tcp'
	option dest_port '5001'
	option src_dport '5901'
	option dest_ip '192.168.1.159'
	option name 'AT9129 https'
	option enabled '0'

config redirect
	option dest_port '5000'
	option src 'wan'
	option target 'DNAT'
	option dest 'lan'
	option src_dport '5900'
	option dest_ip '192.168.1.159'
	option name 'AT9192 http'
	option enabled '0'

config redirect
	option dest 'lan'
	option target 'DNAT'
	option name 'https AT9192'
	option src 'wan'
	option dest_ip '192.168.1.159'
	option dest_port '5001'
	option src_dport '59443'
	option enabled '0'

config redirect
	option dest_port '80'
	option src 'wan'
	option src_dport '9080'
	option target 'DNAT'
	option dest_ip '192.168.1.190'
	option dest 'lan'
	option name 'Jeedom http'
	option enabled '0'

config redirect
	option dest_port '6690'
	option src 'wan'
	option name 'drive'
	option src_dport '6690'
	option target 'DNAT'
	option dest 'lan'
	option dest_ip '192.168.1.159'
	option enabled '0'

config redirect
	option dest_port '802'
	option src 'wan'
	option name 'CozyTouch'
	option src_dport '802'
	option target 'DNAT'
	option dest_ip '192.168.1.133'
	option dest 'lan'

config redirect
	option dest_port '123'
	option src 'wan'
	option name 'CozyTouch'
	option src_dport '123'
	option target 'DNAT'
	option dest_ip '192.168.1.133'
	option dest 'lan'

config redirect
	option src 'wan'
	option name 'Cozytouch'
	option src_dport '18888'
	option target 'DNAT'
	option dest_ip '192.168.1.133'
	option dest 'lan'
	option dest_port '18888'
	list proto 'udp'

config redirect
	option dest_port '993'
	option src 'wan'
	option name 'smtp in'
	option src_dport '59993'
	option target 'DNAT'
	option dest 'lan'
	option dest_ip '192.168.1.159'

config redirect
	option dest_port '587'
	option src 'wan'
	option name 'snmp out'
	option src_dport '59587'
	option target 'DNAT'
	option dest 'lan'
	option dest_ip '192.168.1.159'

config redirect
	option dest 'lan'
	option target 'DNAT'
	option name 'port 80'
	option src 'wan'
	option src_dport '80'
	option dest_port '80'
	option dest_ip '192.168.1.159'
	option enabled '0'

config redirect
	option src 'wan'
	option name 'cozytouch'
	option src_dport '443'
	option target 'DNAT'
	option dest_ip '192.168.1.133'
	option dest 'lan'
	option dest_port '443'
	list proto 'tcp'
	list proto 'udp'
	option enabled '0'

config redirect
	option dest_port '51023'
	option src 'wan'
	option name 'Lifedomus'
	option src_dport '51023'
	option target 'DNAT'
	option dest_ip '192.168.1.126'
	option dest 'lan'
	list proto 'tcp'
	option enabled '0'

config redirect
	option dest_port '8090'
	option src 'wan'
	option name 'LifeDomus'
	option src_dport '8090'
	option target 'DNAT'
	option dest_ip '192.168.1.126'
	option dest 'lan'
	list proto 'tcp'
	option enabled '0'

config redirect
	option dest_port '8443'
	option src 'wan'
	option name 'Lifedomus'
	option src_dport '8443'
	option target 'DNAT'
	option dest_ip '192.168.1.126'
	option dest 'lan'
	list proto 'tcp'
	option enabled '0'

config redirect
	option dest_port '8181'
	option src 'wan'
	option name 'squash'
	option src_dport '8181'
	option target 'DNAT'
	option dest_ip '192.168.1.185'
	option dest 'lan'
	option enabled '0'

config redirect
	option dest_port '8080'
	option src 'wan'
	option name 'jenkins'
	option src_dport '8080'
	option target 'DNAT'
	option dest_ip '192.168.1.185'
	option dest 'lan'
	option enabled '0'

config redirect
	option dest_port '443'
	option src 'wan'
	option target 'DNAT'
	option dest_ip '192.168.1.190'
	option dest 'lan'
	option enabled '0'
	option src_dport '9043'
	option name 'jeedom https'

config redirect
	option dest_port '80'
	option src 'wan'
	option name 'rpi'
	option src_dport '4080'
	option target 'DNAT'
	option dest_ip '192.168.1.140'
	option dest 'lan'
	option enabled '0'

config redirect
	option dest_port '16881'
	option src 'wan'
	option name 'BT'
	option src_dport '16881'
	option target 'DNAT'
	option dest 'lan'
	list proto 'tcp'
	option dest_ip '192.168.1.29'
	option enabled '0'

config redirect
	option dest_port '80'
	option src 'wan'
	option name 'mobotix'
	option src_dport '2880'
	option target 'DNAT'
	option dest_ip '192.168.1.128'
	option dest 'lan'
	option enabled '0'

config redirect
	option src 'wan'
	option name 'StockServer Agapes'
	option target 'DNAT'
	option dest 'lan'
	option dest_port '8090'
	option src_dport '8090'
	option dest_ip '192.168.1.170'
	option enabled '0'

config redirect
	option dest_port '5922'
	option src 'wan'
	option dest 'lan'
	option target 'DNAT'
	option name 'ssh AT9192'
	option src_dport '5922'
	option enabled '0'
	option dest_ip '192.168.1.159'

config rule
	option src_port '802'
	option src 'wan'
	option name 'CozyTouch'
	option dest 'lan'
	option target 'ACCEPT'
	option dest_port '802'
	list dest_ip '192.168.1.1'
	option enabled '0'

config rule
	option src_port '443'
	option src 'wan'
	option name 'CozyTouch'
	option dest 'lan'
	list dest_ip '192.168.1.1'
	option target 'ACCEPT'
	option dest_port '433'
	option enabled '0'

config rule
	option src_port '123'
	option src 'wan'
	option name 'CozyTouch'
	option dest 'lan'
	list dest_ip '192.168.1.1'
	option target 'ACCEPT'
	option dest_port '123'
	option enabled '0'

config rule
	option name 'Allow-OpenVPN'
	option target 'ACCEPT'
	option src 'wan'
	option proto 'udp'
	option dest_port '1194'

config redirect
	option dest 'lan'
	option target 'DNAT'
	option name 'influxDB'
	option src 'wan'
	option src_dport '8086'
	option dest_ip '192.168.1.199'
	option dest_port '8086'
	option enabled '0'

config zone
	option name 'vpn'
	option input 'ACCEPT'
	option forward 'ACCEPT'
	option output 'ACCEPT'
	option masq '1'
	list network 'vpn0'

config forwarding
	option src 'vpn'
	option dest 'wan'

config forwarding
	option src 'vpn'
	option dest 'lan'

config zone 'guest'
	option name 'guest'
	option network 'guest'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'

config rule 'guest_dns'
	option name 'Allow-DNS-Guest'
	option src 'guest'
	option dest_port '53'
	option proto 'tcp udp'
	option target 'ACCEPT'

config rule 'guest_dhcp'
	option name 'Allow-DHCP-Guest'
	option src 'guest'
	option dest_port '67'
	option proto 'udp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule 'guest_fwd'
	option name 'Allow-HTTP/HTTPS-Guest-Forward'
	option src 'guest'
	option dest 'wan'
	list dest_port '80'
	list dest_port '443'
	option proto 'tcp'
	option target 'ACCEPT'

config include 'ovpn_1194'
	option path '/etc/openvpn/firewall.ovpn_1194'


Everything with source wan and destination lan is potentially dangerous, your firewall got more "holes" than a Swiss cheese.

2 Likes

ok, what do you suggest to do ? Is there a best practice somewhere ?
Tks, Arnaud

wireguard ...

1 Like

I use openvpn on smartphone and computer

then why would you need all those firewall openings ?

1 Like

i don t use it because i have not already been able to use with multiple connection (computer + android) as the same time.
Maybe i have to explore that ...
Many Thanks.
Arnaud

Little late to the party, but it doesn't look like you ever got a full answer.

So for Wireguard, you need to create seperate peers for each device, then you'll be able to use both at the same time.

As for your core issue, you have tons and tons of stuff on your network exposed straight to the internet for anyone to poke at, including (seemingly) a home automation system and InfluxDB.

If I were you, I'd wipe it all and start over. If you don't, sooner or later you're gonna get hacked. I'll give you a framework to start with below. It looks very overwhelming, but just stick to it, and it should start to make sense as you go.

Notes:

  • You don't need to understand all of these notes, they'll become more clear as you move through the steps
  • All values will be marked like this
  • Some textboxes won't accept the /24 notation used below. You must empty the box then click the green + beside it. After doing this it will work. Leave the additional newly created field blank.
  • OpenWRT's firewall is stateful. Zone forwardings only apply in one direction, so allowing one zone to initate a connection to another zone will cause the firewall to track the state of the connection and allow related return traffic back through.
    • As such, you SHOULD NOT allow zone forwardings both to and from a zone unless you really do need both sides to be able to initate connections at any time. Traffic rules can and should be used to more precisely allow certain traffic through to an otherwise unreachable zone when needed.
  • You can make changes to the zone forwardings below if you want to adjust which traffic is allowed. The forwardings in step 8 are good safe examples, but if for some reason you decide you want to allow the lan zone to reach the guest zone, you can add the guest zone to the lan zone's forwardings and nothing bad will happen.
  • You should not edit the wan zone
    • If you're doing something that you think needs the wan zone to be changed, you're actually looking for a port forward (for allowing traffic from the internet to services) or traffic rule (for allowing traffic from the internet to OpenWRT) instead.
    • Zone forwardings on the wan zone behave differently from the other's due to masquerading. You don't need to understand this yet, just trust me when I say you should leave it be unless you know exactly what you're doing.
  • If you can't reach forwarded ports from inside your network, you need to configure Reflection zones in the Advanced Settings for your port forward. Add the zones that you want to allow to reach the forwarded port here. You don't need to add the Destination zone (e.g. wan) to Reflection zones, as it's already implied and will work by default

Instructions:

  1. Copy these instructions to a text file on your machine. Take a config backup of your router, then reset it to factory defaults
  2. Set a static IP on your workstation in 192.168.1.0/24, and add a secondary IP address in 192.168.2.0/24.
  • The steps for this vary based on your OS. Let me know which one you use, and I'll do my best to help.
  • If 192.168.1.2 and 192.168.2.2 are unused, you can use those. Any address from 2 to 254 will work as long as it's not used by something else.
  1. Adjust the IPv4 address on your lan interface to 192.168.2.1/24:
  • We have to do this because 192.168.1.0/24 is extremely commonly used, and when using a VPN, it may collide with the network you're connecting from.
  • If it won't let you enter /24, empty the box and click the green + first
  • After you do this, navigate to the new IP address in your web browser to pick up where you left off. If you did step 1 correctly, this should just work. If you didn't you'll need to wait 90 seconds for it to revert back to the old IP before you can try again.
  1. Install the needed components for Wireguard:
  • Use the package manager UI or opkg update && opkg install luci-app-wireguard then restart your device.
  1. Create 4 new firewall zones, but leave the settings empty (we'll finish them later):
  • Name them vpn, guest, services, and iot
  • Save and apply when finished
  1. Create a new interface named vpn:
  • Protocol: Wireguard VPN
  • General Settings:
    • Click Generate new key pair
    • Listen Port: 51820
    • IP Addresses: 192.168.3.1/32
  • Firewall Settings:
    • Zone: vpn
  1. Create a new interface named guest:
  • Protocol: Static Address
  • Device: Unspecified
  • General Settings:
    • IPv4 Address: 192.168.4.1/24
  • Firewall Settings:
    • Zone: guest
  1. Create a new interface named services:
  • Protocol: Static Address
  • Device: Unspecified
  • General Settings:
    • IPv4 Address: 192.168.5.1/24
  • Firewall Settings:
    • Zone: services
  1. Create a new interface named iot:
  • Protocol: Static Address
  • Device: Unspecified
  • General Settings:
    • IPv4 Address: 192.168.6.1/24
  • Firewall Settings:
    • Zone: iot
  1. Configure the following firewall rules:
  • This one allows inbound Wireguard traffic to be accepted and handled by your router.
    • Name: Allow-Wireguard
      • Protocol: UDP
      • Source zone: Any zone
      • Destination zone: Device
      • Destination port: 51820
      • Action: accept
  • These ones ensure that all devices in each network are able to request IP addresses. They're all the same, with only the source zone modified.
    • Name: Allow-Guest-DHCP
      • Protocol: UDP
      • Source zone: guest
      • Output zone: Device
      • Destination port: 67
      • Action: accept
    • Name: Allow-IoT-DHCP
      • Protocol: UDP
      • Source zone: iot
      • Output zone: Device
      • Destination port: 67
      • Action: accept
    • Name: Allow-Services-DHCP
      • Protocol: UDP
      • Source zone: services
      • Output zone: Device
      • Destination port: 67
      • Action: accept
  • These ones ensure that all devices can reach the built-in DNS server. Your devices should be configured to use this, as it enables a lot of fancy features. Once again, only the source zone changes for each rule.
    • Name: Allow-Guest-DNS
      • Protocol: TCP, UDP
      • Source zone: guest
      • Output zone: Device
      • Destination port: 53
      • Action: accept
    • Name: Allow-IoT-DNS
      • Protocol: TCP, UDP
      • Source zone: iot
      • Output zone: Device
      • Destination port: 53
      • Action: accept
    • Name: Allow-Services-DNS
      • Protocol: TCP, UDP
      • Source zone: services
      • Output zone: Device
      • Destination port: 53
      • Action: accept
  1. Configure each zone as follows so we can control how they talk to each other:
  • Zone Name: lan
    • Input: accept
    • Output: accept
    • Forward: accept
    • Allow forward to destination zones: wan, vpn, iot, services
  • Zone Name: wan
    • Do not make any changes. The defaults are fine.
  • Zone Name: vpn
    • Input: accept
    • Output: accept
    • Forward: accept
    • Allow forward to destination zones: lan, wan, iot, services
  • Zone Name: guest
    • Input: reject
    • Output: accept
    • Forward: reject
    • Allow forward to destination zones: wan
  • Zone Name: iot
    • Input: reject
    • Output: accept
    • Forward: reject
    • Allow forward to destination zones: wan
  • Zone Name: services
    • Input: reject
    • Output: accept
    • Forward: reject
    • Allow forward to destination zones: wan
  1. Take a configuration backup and put it somewhere safe so you don't have to do this again.
  2. Remove the static 192.168.1.0/24 address, and switch to DHCP or just use the 192.168.2.0/24 address set above

You should now be at the point where you can configure any Wi-Fi networks, VLANs, and/or Wireguard peers you need. For Wi-Fi networks, simply select the network you want to attach it to when creating the SSID. If you need help with VLANs or wireguard peers, let me know, as we'll need more info.

I'll dissent from the crowd here and say exposing SSH is safe as long as you disable password authentication, use a strong key (ssh-ed25519), and (optionally) use a non-default port. SSH is a very well tested piece of software, and it's unlikely that you will have any security issues as long as you follow basic best practices. I would go so far as to recommend doing this, as it's extremely handy if your VPN breaks for some reason and you have no other way in. You can use SSH local forwarding to connect to the OpenWRT Web UI over an SSH connection and fix any issues. You can also proxy traffic to other SSH servers on your network. I can elaborate more on this if you want me to

You can do the same with Wireguard, as it's also extremely well-designed and safe.

Final recommendation, with the exception of Wireguard and SSH, don't port forward anything that shouldn't be publicly-accessible. Every forwarded port means potential security issues. Everything should be accessible from the Wireguard tunnel. If for some reason you do need to port forward something, create another network/interface/zone called dmz with very limited rules (forward only to wan etc), and stick everything that must be exposed in there before forwarding it. That way if a service does get compromised, it will only be able to do limited damage.

I know this is a lot to read, but it will get you up and running. Let me know if you need help, or if anything isn't clear or doesn't work right.

3 Likes

Thank you @tyami94 for all of this ! It is really nice to read it !

I have begin to do all off the configuration that you propose.

Actually, LAN is

* Zone Name: `lan`
  * Input: `accept`
  * Output: `accept`
  * Forward: `accept`
  * Allow forward to destination zones: `wan`, `vpn`

i tryied with your configuration
(

  • Input: reject
  • Output: accept
  • Forward: reject
    )
    , and i loosed completly OpeWRT, needing to access it in failsafe mode to restore it.
2 Likes

Good catch, missed that one when I was writing it. Fixed it.

Let me know how it works out for you

2 Likes

Configure access only from certain IP

yes, it does, it is working fine with OpenVPN for now & DDNS, i will migrate later with wireguard.

Thank you.
Arnaud

Dear @fkl7834456 , like this ?

Thanks for your help.
Arnaud

No, I definitely wouldn't do that. I'm not quite sure what they're telling you to do, because if you do that nothing is going to work right. You shouldn't have masquerading at all on your VPN interface, it should just be configured in it's own zone with a different subnet and the appropriate forwarding rules in place.

You're gonna want to move the OpenVPN tun device to the VPN zone and configure the appropriate forwardings. The VPN clients should all get IP's starting with 192.168.3.x. Having it in the lan zone defeats the purpose of having a vpn zone

All is so complicated while you are not easy with concepts.

you said

The VPN clients should all get IP's starting with 192.168.3.x. Having it in the lan zone defeats the purpose of having a vpn zone

that is not clear for me !
Sincerly,
Arnaud