My SSH and SFTP sensors are in an Unknown status and are not able to connect. What is causing this issue?
This article applies to PRTG Network Monitor 19 or later
SSH and SFTP sensors in Unknown status due to Fail2ban
While 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.
What is fail2ban? It is an intrusion prevention software framework for protecting 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 inside of PRTG.
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 PRTG sensors as unusual behavior and prevent the sensors from connecting.
Note: In the following examples, 172.16.1.20 is the local IP for the PRTG monitoring 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 : INFO [sshd] Found 172.16.1.20 2018-04-06 16:05:34,046 fail2ban.filter : INFO [sshd] Found 172.16.1.20 2018-04-06 16:05:42,968 fail2ban.filter : INFO [sshd] Found 172.16.1.20 2018-04-06 16:05:43,332 fail2ban.actions : 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 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 for your server being ignored by fail2ban.
2018-04-06 17:00:50,624 fail2ban.filter : INFO [sshd] Ignore 172.16.1.20 by ip 2018-04-06 17:01:32,169 fail2ban.filter : INFO [sshd] Ignore 172.16.1.20 by ip 2018-04-06 17:01:32,170 fail2ban.filter : INFO [sshd] Ignore 172.16.1.20 by ip 2018-04-06 17:01:32,175 fail2ban.filter : INFO [sshd] Ignore 172.16.1.20 by ip