Config writing issue

Pax
2007-04-02
2013-04-15
  • Pax
    Pax
    2007-04-02

    This is probably a simple issue, but I cannot figure it out. When the dbconfig.php points at the correct location for the nagios config files (/usr/local/nagios/etc) the web interface will not write out to the files, complaining of not enough permissions for the fopen command. If I change the directory to a newly created /var/www/html/nagiosweb/etc, it writes the files fine. su into the apache account and I can edit the files fine. An output for ls -al is below for the /var/www/html/nagiosweb/etc where it writes fine.

    total 164
    drwxr-xr-x 2 root   root    4096 Apr  2 14:20 .
    drwxr-xr-x 5   1000 users   4096 Apr  2 14:20 ..
    -rw-r--r-- 1 apache nagios  9583 Apr  2 13:03 cgi.cfg
    -rw-r--r-- 1 apache nagios  1396 Apr  2 14:12 checkcommands.cfg
    -rw-r--r-- 1 apache nagios   235 Apr  2 14:12 contactgroups.cfg
    -rw-r--r-- 1 apache nagios  1446 Apr  2 14:12 contacts.cfg
    -rw-r--r-- 1 apache nagios    49 Apr  2 14:12 dependencies.cfg
    -rw-r--r-- 1 apache nagios    96 Apr  2 14:12 downtimeschedhst.cfg
    -rw-r--r-- 1 apache nagios   775 Apr  2 14:12 hostextinfo.cfg
    -rw-r--r-- 1 apache nagios   177 Apr  2 14:12 hostgroups.cfg
    -rw-r--r-- 1 apache nagios  2700 Apr  2 14:12 hosts.cfg
    -rw-r--r-- 1 apache nagios     0 Apr  2 13:03 localhost.cfg
    -rw-r--r-- 1 apache nagios 31647 Apr  2 14:20 nagios.cfg
    -rw-r--r-- 1 apache nagios     0 Apr  2 13:03 serviceextinfo.cfg
    -rw-r--r-- 1 apache nagios    49 Apr  2 14:12 servicegroups.cfg
    -rw-r--r-- 1 apache nagios   686 Apr  2 14:12 services.cfg
    -rw-r--r-- 1 apache nagios   277 Apr  2 14:12 timeperiods.cfg

    Below is the output for ls -al for /usr/local/nagios/etc where it won't write to

    [root@alonl01 etc]# ls -al
    total 176
    drwxrwxr-x 2 nagios nagios  4096 Apr  2 14:12 .
    drwxr-xr-x 7 nagios nagios  4096 Mar 30 04:59 ..
    -rw-r--r-- 1 apache nagios  9583 Apr  2 14:12 cgi.cfg
    -rw-r--r-- 1 apache nagios  1396 Apr  2 14:12 checkcommands.cfg
    -rw-r--r-- 1 apache nagios   235 Apr  2 14:12 contactgroups.cfg
    -rw-r--r-- 1 apache nagios  1446 Apr  2 14:12 contacts.cfg
    -rw-r--r-- 1 apache nagios    49 Apr  2 14:12 dependencies.cfg
    -rw-r--r-- 1 apache nagios    96 Apr  2 14:12 downtimeschedhst.cfg
    -rw-r--r-- 1 apache nagios   775 Apr  2 14:12 hostextinfo.cfg
    -rw-r--r-- 1 apache nagios   177 Apr  2 14:12 hostgroups.cfg
    -rw-r--r-- 1 apache nagios  2700 Apr  2 14:12 hosts.cfg
    -rw-r--r-- 1 root   root     111 Mar 30 05:44 htpasswd.users
    -rw-r--r-- 1 apache nagios     0 Apr  2 14:12 localhost.cfg
    -rw-r--r-- 1 apache nagios 31647 Apr  2 14:20 nagios.cfg
    -rw-r--r-- 1 apache nagios     0 Apr  2 14:12 serviceextinfo.cfg
    -rw-r--r-- 1 apache nagios    49 Apr  2 14:12 servicegroups.cfg
    -rw-r--r-- 1 apache nagios   686 Apr  2 14:12 services.cfg
    -rw-r--r-- 1 apache nagios   277 Apr  2 14:12 timeperiods.cfg

    One other thing I also noticed that is that nagiosweb also tries to write to the files checkcommands.cfg and downtimeschedhst.cfg and these are not referenced in the README, and downtimeschedhst.cfg cannot be read into Nagios and the verify complains when referencing this file in nagios.cfg.

    Also, if I use the web interface to run the verification after writing the files (write the files out, copy them across to /usr/local/nagios/etc, edit dbconfig.php repointing it) it fails, but running the command fromcommand prompt su'd into the apache account succeeds.

    Pax

     
    • Pax
      Pax
      2007-04-19

      Issue resolved by disabling SE Linux ... I could have spent time fixing it all using chcon commands, but this server is only available internally behind multiple firewalls, so I don't have as many security concerns with it as many,

      Pax