Re: [Nagios-devel] readonly user for cgis

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
Guest

Re: [Nagios-devel] readonly user for cgis

Post by Guest »

I have this change.

I should submit it. really.

In the config file I have two new options. readonly and readonly_for_all_=
hosts.
That's for managers who need to see but not touch.

Now my version also hides comments from read only users so the noc can be=
more=20
free in what they type there.

I will send the diff's to the list tommorow when I am back in the office.

Derrick

Quoting Dietmar Ruzicka :

> Hi,
>=20
> we need readonly users for the webinterface. readonly means the user
> (contact) should only see his hosts and services, but should not be abl=
e
> to execute any commands except creating comments.
>=20
> It did a very dirty quick patch to the current 1-x-cvs version. If the
> contact name ends with "_ro" (for readonly) the contact is not able to
> execute any commands except creating new comments.=20
>=20
> It think a good solution would be a configuration option in the cgi.cfg
> like=20
>=20
> Format: readonly_user=3D,,,...=20
> Example: readonly_user=3Dbob,alice
>=20
>=20
> Bye=20
>=20
> Dietmar
>=20
>=20
>=20
> cube1:/usr/local/src/nagios-1-x-cvs# diff -c
> /home/druzicka/nagios-all/cvs/123/nagios/cgi/cmd.c cgi/cmd.c
> *** /home/druzicka/nagios-all/cvs/123/nagios/cgi/cmd.c Fri May 30
> 21:25:55 2003
> --- cgi/cmd.c Wed Aug 6 17:23:53 2003
> ***************
> *** 556,562 ****
> time_t t;
> char buffer[MAX_INPUT_BUFFER];
> contact *temp_contact;
> !
> =20
> /* get default name to use for comment author */
> temp_contact=3Dfind_contact(current_authdata.username,NULL);
> --- 556,562 ----
> time_t t;
> char buffer[MAX_INPUT_BUFFER];
> contact *temp_contact;
> ! char *substr;
> =20
> /* get default name to use for comment author */
> temp_contact=3Dfind_contact(current_authdata.username,NULL);
> ***************
> *** 565,570 ****
> --- 565,585 ----
> else
> comment_author=3Dcurrent_authdata.username;
> =20
> +
> + if ((substr=3Dstrstr(comment_author,"_ro"))!=3DNULL) {
> + if (!strcmp(substr,"_ro")) {
> + printf("You, %s =
are
> requesting to ",comment_author);
> + switch(cmd){
> + case CMD_ADD_HOST_COMMENT:
> + case CMD_ADD_SVC_COMMENT:
> + printf("add a %s
> comment",(cmd=3D=3DCMD_ADD_HOST_COMMENT)?"host":"service");
> + break;
> + default:
> + printf("execute an command. This is not allowed! Sorry
> you are a readonly user!");
> + return;
> + } //case
> + } //if strcmp
> + } // if strstr
> =20
> printf("You are reques=
ting
> to ");
> =20
> cube1:/usr/local/src/nagios-1-x-cvs#
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100 ... _072303_0=
1/01
> _______________________________________________
> Nagios-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/lis ... gios-devel
>=20







This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked