Authentication with SQL

Everything else...

Authentication with SQL

Post by JeimyOliveira » Wed Apr 01, 2009 17:04

Hi, i'm from Brazil, the Amazon state...

In my company we use nagios and recently we start to testing the NCONF...

I did the installation and configuration problems and even without this working properly ... but I don't know how can created a SQL user account...

Someone help me...


User avatar
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland

Re: Authentication with SQL

Post by agargiulo » Wed Apr 01, 2009 17:48

Hello back to Brazil!

Auth by SQL:
NConf offers the possibility to use any existing (My)SQL database for user authentication. Have a look at the config/authentication.php file. There are several constants which you can use to define the database and credentials, as well as your own SQL queries.

But NConf also has built-in functionality to manage user accounts within NConf itself. We have predefined 3 attributes which allow you to control access to Nagios and NConf. Proceed like this:

in NConf, go to the menu "Administration" > "Attributes" > "Show" and select the "contact" attributes.
Edit the following attributes and set them to "visible = yes":
- user_password
- nc_permission
- nagios_access

Go to "Additional Items" > "Contacts" and set a password for your own user.

In authentication.php, set AUTH_TYPE to "sql", configure all 4 AUTH_DB... constants, don't change any of the AUTH_SQLQUERY constants.

Now you can set a password and the permissions for each user by editing your contacts in NConf.
You might also want to enable password encryption in nconf.php. Do this right from the beginning, because once you have already set several passwords, you will have to modify all of them, if you change the encryption type.

Also, if you would like to use the same accounts & passwords to control access to your Nagios webaccess, you must set the encryption type to "crypt", as that is what Apache uses by default in .htaccess files. As soon as you start using password, NConf will also generate a file called global/nagios.htpasswd containing your users/passwords.


Re: Authentication with SQL

Post by JeimyOliveira » Wed Apr 01, 2009 21:30

Hello buddy ...

Thanks for your help, I do the setup without any problems and authentication of users by the SQL working perfectly.