Nagios Backup from GUI via ssh

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Nagios Backup from GUI via ssh

Post by absarcompass »

Hi team,
I am using nagiosxi version 5.6.8 with PHP version 5.3.3.
Nagiosxi has version OpenSSH_5.3p1, OpenSSL 1.0.1e-fips and remote server is OpenSSH_8.0p1, OpenSSL 1.1.1d
the ssh backup is failing from gui.
I have tried on gentoo and ubunto box it works from command line using SCP and SFTP but it doesn't work from Web. gives generic error of permission and directory.

does it use scp ? or sftp? does web uses PHP separately without using either scp or sftp? what could be the issue here?? I am not sure where and what to look at

below are the ssh logs from remote server.
Feb 19 13:57:45 mgmt-tori sshd[24319]: PAM unable to resolve symbol: pam_sm_chauthtok
Feb 19 13:57:45 mgmt-tori sshd[201]: Accepted publickey for nagiosxi from 192.168.x.x port 46139 ssh2: RSA SHA*******************
Feb 19 13:57:45 mgmt-tori sshd[24319]: pam_unix(sshd:session): session opened for user nagiosxi by (uid=0)
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: [start] called (pam_tacplus v1.3.7)
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: tac_srv_no=1
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: username [nagiosxi] obtained
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: tty [ssh] obtained
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: rhost [192.168.x.x] obtained
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: connected with fd=5 (srv 0)
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: [start] for [nagiosxi] sent
Feb 19 13:57:45 mgmt-tori sshd[201]: Received disconnect from 192.168.x.x port 46139:11: PECL/ssh2 (http://pecl.php.net/packages/ssh2)
Feb 19 13:57:45 mgmt-tori sshd[201]: Disconnected from user nagiosxi 192.168.x.x port 46139
Feb 19 13:57:45 mgmt-tori sshd[24319]: pam_unix(sshd:session): session closed for user nagiosxi
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: [stop] called (pam_tacplus v1.3.7)
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: tac_srv_no=1
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: username [nagiosxi] obtained
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: tty [ssh] obtained
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: rhost [192.168.x.x] obtained
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: connected with fd=5 (srv 0)
Feb 19 13:57:45 mgmt-tori sshd[24319]: _pam_account: [stop] for [nagiosxi] sent
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios Backup from GUI via ssh

Post by benjaminsmith »

Hello,

The ssh backup uses scp. Let's start within the GUI, have you tried testing the connection and sending test transfer? Are they both failing?
test-ssh-connections.png
Did you follow our instructions for setting this up ( see page 9). If not, there are two ways to authenticate, public ssh keys or password.

Backing Up and Restoring Nagios XI
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: Nagios Backup from GUI via ssh

Post by absarcompass »

Hi thanks for reply
I have tested it. connection authentication works for both password base and public key base but file transfer fails.
using same credentials, public key or password, file transfer works fine via scp and sftp.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios Backup from GUI via ssh

Post by benjaminsmith »

Hello,

Just to verify, are you using the same login (nagiosxi) when testing from the command line? It's possible it's a permissions issue. Authentication is working but the user account is not able to write files.

For example, on the remote server:

Code: Select all

chown -R nagios:nagios /backups/nagiosxi
chmod o+w /backups/nagiosxi
Also, run a yum update on the Nagios XI server to make sure you have the current ssh, OpenSSL and pecl ssh2 packages on the Nagios XI server and then test again.

If it's still failing what is the output of the following commands on the XI server?

Code: Select all

yum list installed | grep 'ssh\|ssl'
Lastly, what operating system is the remote host using ( if possible I would like to test this on my end)? Thanks.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: Nagios Backup from GUI via ssh

Post by absarcompass »

HI,
yes credentials are same and permissions are fine too.
remote server is gentoo rolling release.
meanwhile i'll do yum update and let you know
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: Nagios Backup from GUI via ssh

Post by absarcompass »

nagiosxi ~]# yum list installed | grep 'ssh\|ssl'
libssh2.x86_64 1.4.2-1.el6 @base
mod_ssl.x86_64 1:2.2.15-60.el6.centos.5 @updates
openssh.x86_64 5.3p1-94.el6 @base
openssh-clients.x86_64 5.3p1-94.el6 @base
openssh-server.x86_64 5.3p1-94.el6 @base
openssl.x86_64 1.0.1e-57.el6 @base
openssl-devel.x86_64 1.0.1e-57.el6 @base
php-pecl-ssh2.x86_64 0.11.0-7.el6 @epel
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios Backup from GUI via ssh

Post by benjaminsmith »

Hello @absarcompaass,

Did you try running the yum update? Also, what version of Nagios XI are your running and which Linux distribution?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: Nagios Backup from GUI via ssh

Post by absarcompass »

Hi @benjaminsmith
Before yum update I have updated NagiosXi to 5.6.11
Yum update has been done and linux is running on Centos 6.10 now
below are the ssh\ssl on the server.
nagiosxi log]# yum list installed | grep 'ssh\|ssl'
libssh2.x86_64 1.4.2-3.el6_10.1 @updates
mod_ssl.x86_64 1:2.2.15-69.el6.centos @base
openssh.x86_64 5.3p1-124.el6_10 @updates
openssh-clients.x86_64 5.3p1-124.el6_10 @updates
openssh-server.x86_64 5.3p1-124.el6_10 @updates
openssl.x86_64 1.0.1e-58.el6_10 @updates
openssl-devel.x86_64 1.0.1e-58.el6_10 @updates
php-pecl-ssh2.x86_64 0.11.0-7.el6 @epel
python-backports-ssl_match_hostname.noarch


AND.. ssh\scp transfer is still NOT working via Web Inerface.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios Backup from GUI via ssh

Post by lmiltchev »

I have tried on gentoo and ubunto box it works from command line using SCP and SFTP but it doesn't work from Web. gives generic error of permission and directory.
Can you show us a successful log in from the CLI?

Also, go to Admin > System Backups > Scheduled Backups > SSH tab, and show us a screenshot of the page.

Let's do some more troubleshooting.

1. Make sure you don't have any folders (unfinished backups) under the /store/backups/nagiosxi directory on the Nagios XI server. If you do, remove them:

Code: Select all

cd /store/backups/nagiosxi
rm -rf <directory>
2. Make sure that the permissions on the scheduledbackups.log are correct (user and group can write to the log):

Code: Select all

ls -la /usr/local/nagiosxi/var/components/scheduledbackups.log
3. Enable debugging for scheduled backups by following the steps, outlined in the KB article below:
https://support.nagios.com/kb/article/n ... l-578.html

Example:

Code: Select all

define('SB_LOGLEVEL', 0);
4. Increase the backup timeout in the "/usr/local/nagiosxi/html/config.inc.php" file, but adding this line (if you don't already have it):

Code: Select all

$cfg['backup_timeout'] = <seconds>;
Note: User a value that is relevant to your environment.

5. Restart apache:

Code: Select all

service httpd restart
6. Schedule a SSH backup from the GUI for a few minutes in the future.

7. Start a running tail on cmdsubsys.log:

Code: Select all

tail -f /usr/local/nagiosxi/var/cmdsubsys.log
and watch the log as the backup starts.

8. Post the output from the "/usr/local/nagiosxi/var/cmdsubsys.log" on the forum.

9. Post the "/usr/local/nagiosxi/var/components/scheduledbackups.log" on the forum.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios Backup from GUI via ssh

Post by lmiltchev »

After some more digging into this, we found out that we introduced a bug in Nagios XI 5.6.11, which will be fixed in the next release. There is an easy fix (workaround) - read more on the issue here:

https://support.nagios.com/kb/article/b ... s-867.html

If the backup script works correctly, but files are still not transferred to the remote server, you would still need to perform the steps from my previous post in order to troubleshoot the issue. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked