FS#16554 - [network-ups-tools] is being built without cgi-bin, html interface or documentation

Attached to Project: Community Packages
Opened by David C. Rankin (drankinatty) - Saturday, 10 October 2009, 05:16 GMT
Last edited by Dan Griffiths (Ghost1227) - Saturday, 13 March 2010, 04:23 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Ionut Biru (wonder)
Dan Griffiths (Ghost1227)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

network-ups-tools (nut) is currently being built without the cgi-bin and html interface. The web interface is a normal part of nut that allows you to view and set ups parameters. It doesn't look like any of that is enabled in the current arch package. Additionally, the package does not contain any of the documentation provided along with the source such as the "Upgrade" notes, etc.

It looks like the following configure parameters will provide the missing pieces:

./configure '--prefix=/usr' \
'--sysconfdir=/etc' \
'--localstatedir=/var' \
'--mandir=/usr/share/man' \
'--datadir=/usr/share' \
'--docdir=/usr/share/doc/nut' \
'--with-all' \
'--with-cgipath=/srv/http/cgi-bin/nut' \
'--with-htmlpath=/srv/http/nut'


Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
This task depends upon

Closed by  Dan Griffiths (Ghost1227)
Saturday, 13 March 2010, 04:23 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed based on drankinatty's pkgbuiild, please test and advise
Comment by David C. Rankin (drankinatty) - Saturday, 10 October 2009, 05:57 GMT
Here is how I have modified my PKGBUILD:

build() {
cd $srcdir/nut-$pkgver
./configure --with-user=nut \
--prefix=/usr \
--datadir=/usr/share/ups \
--sysconfdir=/etc/ups \
--with-group=nut \
--with-hal \
--with-usb \
--with-cgi \
--with-cgipath=/srv/http/cgi-bin/nut \
--with-htmlpath=/srv/http/nut \
--with-udev-dir=/etc/udev || return 1
<snip>

I'll see how this works
Comment by David C. Rankin (drankinatty) - Sunday, 11 October 2009, 08:23 GMT
It works perfect when built with the options above:

http://www.3111skyline.com/download/screenshots/archlinux/network-ups-tools-rebuilt.jpg

Now it somebody could just make those the defaults, you wouldn't have to rebuild the package to get the web interface working. Let me know if you need anything else. Thanks.
Comment by Ionut Biru (wonder) - Sunday, 11 October 2009, 08:39 GMT
a webapps should never write data on /srv

http://wiki.archlinux.org/index.php/Web_application_package_guidelines

lets try to improve it based on this guide
Comment by David C. Rankin (drankinatty) - Sunday, 11 October 2009, 22:32 GMT
Hmm,

My bad on the issue of writing to srv. I modeled it on the openSuSE package which put the cgi files in /srv/www/cgi-bin/nut and the html files in /srv/www/htdocs/nut. Initially when I set up my Arch server I just moved my web apps from suse to Arch under /srv/www and the edited the httpd.conf file accordingly. I have since moved all web apps to /srv/http which seems to be the Arch standard. For web apps, especially with the tighter security required by php 5.3, it is difficult to install them anywhere without placing the web parts under the web server document root or needing to modify the apache config and add a new directory definition and then if php is required editing php.ini.

Arch defaults to /srv/http/cgi-bin for cgi files in its httpd.conf, see line 316:

316 ScriptAlias /cgi-bin/ "/srv/http/cgi-bin/"

so with the nut application needing to install both the cgi file and html files, the directory choices of /srv/http/cgi-bin/nut and /srv/http/nut, respectively, seemed appropriate. The files can go anywhere of course, so long as the web server can reach and use the files provided. Biru, what are your thought on how we can make it comply with the guidelines? Thanks.
Comment by David C. Rankin (drankinatty) - Sunday, 11 October 2009, 23:01 GMT
I'm not sure what the solution to this will be, but with the new security restrictions in php 5.3, the proposed Web_application_package_guidelines do not seem to be workable without disabling the php protections that prevent following sym links or potentially exposing the entire /etc directory to php. The php settings that seem to cause the most grief with the guidelines are 'open_basedir' and 'include_path'. (note: for open_basedir, All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.)

I'll be happy with whatever decision of web app file placement is made by Arch, but it seems like not putting the cgi and web pages under /srv is a departure even from Arch's norm. The only other place for the cgi or web pages that strikes me as making sense is under /var like /var/srv/{cgi-bin/pkgname,htdocs/pkgname}. That way apache and php could be configured with /var/srv as a directory so config changes wouldn't be required with every web app installed. That would just mean changing the default httpd.conf and php.ini, but web apps will install OK.
Comment by Dan Griffiths (Ghost1227) - Monday, 18 January 2010, 23:55 GMT
Possibly installing to /usr/share/webapps/nut similarly to how phpmyadmin is handled?
Comment by Ionut Biru (wonder) - Wednesday, 20 January 2010, 19:17 GMT
that will be the case
Comment by David C. Rankin (drankinatty) - Friday, 12 March 2010, 05:49 GMT
OK Dan, the PKGBUILD with cgi & html going in /usr/share/webapps/nut. Hope it helps.
   PKGBUILD (1.7 KiB)

Loading...