My SSH and SFTP sensors are in the Unknown status and are not able to connect. What is causing this issue?
SSH and SFTP sensors in Unknown status
Votes:
0
1 Reply
Votes:
0
This article applies as of PRTG 22
SSH and SFTP sensors in Unknown status because of fail2ban
While we were trying to set up SSH sensors on an Ubuntu server, we encountered the following issues. The SSH sensors in question went from Up to Unknown to Warning and then Down status after four scanning intervals. After troubleshooting this extensively by adding and removing sensors and changing the authentication options, we discovered that PRTG was on the fail2ban list.
Fail2ban
What is fail2ban? It is an intrusion prevention software framework that protects systems from brute force attacks. When installed, it protects the SSH service on your Linux OS but can be easily forgotten when troubleshooting SSH sensors.
In this example, we used Ubuntu Server 16.04 LTS running SSH/SCP Server with fail2ban and mysecureshell installed and configured. We configured the device using the default credentials for SSH/WBEM systems.
When attempting to use SSH-based sensors, the fail2ban configuration may detect the sensors of PRTG as unusual behavior and prevent the sensors from connecting.
Note: In the following examples, 172.16.1.20 is the local IP address for the PRTG core server. Change this to the IP address of your server.
Here's an excerpt from /var/log/fail2ban.log after creating the device and sensor:
2018-04-06 16:05:31,930 fail2ban.filter [1271]: INFO [sshd] Found 172.16.1.20 2018-04-06 16:05:34,046 fail2ban.filter [1271]: INFO [sshd] Found 172.16.1.20 2018-04-06 16:05:42,968 fail2ban.filter [1271]: INFO [sshd] Found 172.16.1.20 2018-04-06 16:05:43,332 fail2ban.actions [1271]: NOTICE [sshd] Ban 172.16.1.20
Solution: Whitelist IP addresses
Fail2ban allows for whitelisting IP addresses. Follow these steps to whitelist your IP address:
1. Using a text editor, open /etc/fail2ban/jail.conf and look for this section:
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not # ban a host which matches an address in this list. Several addresses can be # defined using space separator. ignoreip = 127.0.0.1/8
2. Add your PRTG core server's IP address to the 'ignoreip' line, for example
ignoreip = 127.0.0.1/8 172.16.1.20
3. Save and close the file.
4. Restart the fail2ban services using the following command
- service fail2ban restart
5. Refresh the sensor. You should see the IP address for your PRTG core server being ignored by fail2ban.
2018-04-06 17:00:50,624 fail2ban.filter [24886]: INFO [sshd] Ignore 172.16.1.20 by ip 2018-04-06 17:01:32,169 fail2ban.filter [24886]: INFO [sshd] Ignore 172.16.1.20 by ip 2018-04-06 17:01:32,170 fail2ban.filter [24886]: INFO [sshd] Ignore 172.16.1.20 by ip 2018-04-06 17:01:32,175 fail2ban.filter [24886]: INFO [sshd] Ignore 172.16.1.20 by ip
Created on Apr 27, 2018 9:39:37 AM by
Brandy Greger [Paessler Support]
Last change on Jun 15, 2022 10:32:43 AM by
Brandy Greger [Paessler Support]
Add comment