how to get rit of intruders

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

how to get rit of intruders

Post by BartSr »

Hi.

My Domoticz is running on Raspberry Pi 3.
I have for internet access login name and password.
Now in the logfile I regular find :

Incoming connection from: 139.162.79.87 [ but also from other IP's].

How can I 'keep the system closed'? Is this dangerous?

KR
-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: how to get rit of intruders

Post by woody4165 »

Do not open domoticz port to internet and install a VPN to access to it.
Or check the domoticz wiki, there should be some articles regarding security.
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
User avatar
jvdz
Posts: 2276
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: how to get rit of intruders

Post by jvdz »

I am using Nginx as reverse proxy with a SSL connection and use Fail2Ban to monitor the Nginx logs and ban any connection after 2 failed tries. This way you run pretty secure.
You could also use the buildin SSL option, but never use the clear-text connection over port 8080 over the internet.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: how to get rit of intruders

Post by Egregius »

Fail2ban is the best option, I use it on my web server and on Domoticz.
And as Jos said, use ssl.
lost
Posts: 660
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: how to get rit of intruders

Post by lost »

BartSr wrote: Saturday 28 October 2017 12:17 Incoming connection from: 139.162.79.87 [ but also from other IP's].
This kind of message is just a connection attempt, no login or even trying to do so.
You can't stop, for instance, web site indexing robots from trying to figure-out is there is something to index!

To avoid bruteforcers, fail2ban is a good option combined with a firewall to auto-buld temp rules to ban them.
Damoms
Posts: 2
Joined: Thursday 01 February 2018 7:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: how to get rit of intruders

Post by Damoms »

Are you sure that domoticz isn't already running?

royal1688
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: how to get rit of intruders

Post by tontze »

Egregius wrote: Saturday 28 October 2017 17:42 Fail2ban is the best option, I use it on my web server and on Domoticz.
And as Jos said, use ssl.
Can you post your fail2ban config on domoticz part ? What you have in filter file etc ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
jvdz
Posts: 2276
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: how to get rit of intruders

Post by jvdz »

This is the fail2ban (jail.local) config I use in combination with an nginx proxy setup:
You have to update in the red marked items to your purpose:
Spoiler: show
# Check HTTPS Authentication for invalid username/Password
# 2 failures in 10 minutes hours -> ban 10 minutes
[nginx-auth-10min]
enabled = true
filter = nginx-auth
action = iptables-multiport[name=NoAuthFailures, port="http,https,??port used by domoticz on the public side??"]
telegram10min
logpath = /var/log/nginx/domoticz.error.log
maxretry = 2
bantime = 600
findtime = 600

# Check HTTPS Authentication for invalid username/Password
# 5 failures in 24 hours -> ban 7 days
[nginx-auth-week]
enabled = true
filter = nginx-auth
action = iptables-multiport[name=NoAuthFailures, port="http,https,??port used by domoticz on the public side??"]
telegram1week
logpath = /var/log/nginx/domoticz.error.log
maxretry = 7
bantime = 604800
findtime = 86400

# Check tries HTTP over HTTPS ports and simply block after 2 tries
# 2 failures in 10 minutes hours -> ban 10 minutes
[nginx-login-10min]
enabled = true
filter = nginx-login
action = iptables-multiport[name=NoLoginFailures, port="http,https,??port used by domoticz on the public side??"]
telegram10min
logpath = /var/log/nginx/access.log
maxretry = 2
bantime = 600
findtime = 600

# Check tries HTTP over HTTPS ports and simply block after 2 tries
# 5 failures in 24 hours -> ban 7 days
[nginx-login2-week]
enabled = true
filter = nginx-login
action = iptables-multiport[name=NoLoginFailures, port="http,https,??port used by domoticz on the public side??"]
telegram1week
logpath = /var/log/nginx/access.log
maxretry = 7
bantime = 604800
findtime = 86400
I have also setup the telegram1week.conf and telegram10min.conf in the actions.d directory to inform me about this ban via telegram.
The iptables-multiport.conf should come standard with fail2ban

The filters I use located in filters.d are:
nginx-auth.conf:
Spoiler: show
# fail2ban filter configuration for nginx

[Definition]

failregex = ^ \[error\] \d+#\d+: \*\d+ user "\S+":? (password mismatch|was not found in ".*"), client: <HOST>, server: \S+, request: "\S+ \S+ HTTP/\d+\.\d+", host: "\S+"\s*$
^ \[error\] \d+#\d+: \*\d+ no user/password was provided for basic authentication, client: <HOST>, server: \S+, request: "\S+ \S+ HTTP/\d+\.\d+", host: "\S+"\s*$
^ \[error\] \d+#\d+: \*\d+ no user/password was provided for basic authentication, client: <HOST>, server: \S+, request: "\S+ \S+ HTTP/\d+\.\d+"$

ignoreregex =
nginx-login.conf:
Spoiler: show
[Definition]
failregex = ^<HOST> -.*$
ignoreregex =
As you can see I have set the rules very strickt so 2 errors will ban an IP for 10 minutes and another 5 (7 in total) will get the IP banned for a week.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest