Confused.."It appears as though you do not have permission."

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
tb1985
Posts: 4
Joined: Mon May 07, 2018 7:04 pm

Confused.."It appears as though you do not have permission."

Post by tb1985 »

Hi
I've just installed Nagios core from the EPEL repository on CentOS 7.

I modified the included Apache config file to authenticate to our LDAP database with a restricted set of users. Apache is sufficiently protecting our Nagios.

The issue is that I have three users: nagiosadmin (predefined), then teddy, and steve (both from LDAP). Using the configuration below, teddy has full access to Nagios but steve gets messages like "It appears as though you do not have permission to view information for any of the hosts you requested..."

I can't find any rhyme or reason. The contactgroup named admins doesn't seem to be referenced anywhere but the notifications. When I add steve to the contactgroup named admins he has full access.


This is in /etc/nagios/objects/contacts.cfg (included by nagios.conf)

Code: Select all

define contact{
  contact_name nagiosadmin             ; Short name of user
  use generic-contact         ; Inherit default values from generic-contact template (defined above)
  alias Nagios Admin            ; Full name of user
  email support@mydomain.com    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS *****
}

define contact {
  contact_name teddy
  use generic-contact
  alias Teddy User
  email teddy@mydomain.com
}
define contact {
  contact_name steve
  use generic-contact
  alias Steve User
  email steve@mydomain.com
}
define contactgroup{
  contactgroup_name admins
  alias Nagios Administrators
  members nagiosadmin,teddy
}  
and in /etc/nagios/cgi.cfg, I added default_user_name=nagiosadmin (all permissions are assigned to nagiosadmin).

Any help is appreciated, thanks.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Confused.."It appears as though you do not have permissi

Post by npolovenko »

Hello, @tb1985. Could you post the whole cgi.cgf file either in this thread or send to me in a private message? If you send it in a private message please write something in this thread to bring it back up in the support queue.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tb1985
Posts: 4
Joined: Mon May 07, 2018 7:04 pm

Re: Confused.."It appears as though you do not have permissi

Post by tb1985 »

Thanks. File is attached.
Attachments
cgi.cfg
(12.69 KiB) Downloaded 501 times
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Confused.."It appears as though you do not have permissi

Post by npolovenko »

@tb1985, Try changing all the following lines in cgi.cfg file by replacing "=nagiosadmin" with "=*":

Code: Select all

authorized_for_system_information=*
 
authorized_for_configuration_information=*
 
authorized_for_system_commands=*
 
authorized_for_all_services=*

authorized_for_all_hosts=*
 
authorized_for_all_service_commands=*
 
authorized_for_all_host_commands=*
When done go ahead and restart the nagios server, as well as the apache:

Code: Select all

service httpd restart
 service nagios restart
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tb1985
Posts: 4
Joined: Mon May 07, 2018 7:04 pm

Re: Confused.."It appears as though you do not have permissi

Post by tb1985 »

I had considered that but I'd rather have a better understanding of what is happening.

Why does my user "teddy" have access without being specified in cgi.conf?

Removing myself from the admins contactgroup revokes my access, but adding it to the admins contactgroup grant it. I don't understand why.

Anyway, I did as suggested and we are OK now. Will see if I can read the docs to understand how permissions are applied better.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Confused.."It appears as though you do not have permissi

Post by npolovenko »

@tb1985, Probably because all hosts and services are subscribed to the admins contact group by default with the installation. Take a look at your service and host definitions and you'll probably see a lot of:

Code: Select all

contact_groups		admins		; 
If your hosts and services inherit from templates then I'd take a look at the templates.

By default, unless you modify the cgi.cgf file a particular contact can only see hosts and services that have him as a contact. Does this make sense? Wherever its:

Code: Select all

contact_groups admins	
or
contacts admins
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tb1985
Posts: 4
Joined: Mon May 07, 2018 7:04 pm

Re: Confused.."It appears as though you do not have permissi

Post by tb1985 »

Ah that's the missing link. I'm using templates for all my services which includes contact_groups admins.
Thanks for your help!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Confused.."It appears as though you do not have permissi

Post by npolovenko »

@tb1985, Glad I could help. I will be closing this thread as resolved.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked