small www/apache-httpd fixes: rc script and readme

2013-09-11 Thread Stefan Sperling
This fixes two small issues with www/apache-httpd:

 - The rc script doesn't work out of the box because it doesn't pass
   the -k option needed for 'start|stop|...' arguments. I hope my
   way of fixing it is appropriate, and welcome other suggestions.

 - The readme implies that chroot is not available, while it has
   been available since 2.2.10 and does indeed work as advertised.
   http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir

ok?

Index: Makefile
===
RCS file: /cvs/ports/www/apache-httpd/Makefile,v
retrieving revision 1.38
diff -u -p -r1.38 Makefile
--- Makefile12 Jul 2013 13:21:25 -  1.38
+++ Makefile11 Sep 2013 19:39:40 -
@@ -3,6 +3,7 @@
 COMMENT=   apache HTTP server
 
 V= 2.2.25
+REVISION=  1
 PKGNAME=   apache-httpd-${V}
 DISTNAME=  httpd-${V}
 
Index: pkg/MESSAGE
===
RCS file: /cvs/ports/www/apache-httpd/pkg/MESSAGE,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 MESSAGE
--- pkg/MESSAGE 14 Dec 2006 07:14:21 -  1.1.1.1
+++ pkg/MESSAGE 11 Sep 2013 19:40:48 -
@@ -3,6 +3,5 @@ provided as a port for those who, for va
 version 2. 
 
 OpenBSD provides a custom Apache server, httpd(8), in the base system
-which has been audited for security and may run in a chroot(2)
-environment.  Users are STRONGLY encouraged to use the system httpd
-rather than this port.
+which has been audited for security. Users are STRONGLY encouraged to
+use the system httpd rather than this port.
Index: pkg/httpd2.rc
===
RCS file: /cvs/ports/www/apache-httpd/pkg/httpd2.rc,v
retrieving revision 1.1
diff -u -p -r1.1 httpd2.rc
--- pkg/httpd2.rc   18 Jul 2012 08:45:42 -  1.1
+++ pkg/httpd2.rc   11 Sep 2013 19:40:21 -
@@ -10,4 +10,6 @@ rc_pre() {
rm -f /var/apache2/logs/{ssl_mutex,httpd.lock,accept.lock}.*
 }
 
+daemon_flags="${daemon_flags} -k"
+
 rc_cmd $1



Re: small www/apache-httpd fixes: rc script and readme

2013-09-11 Thread Antoine Jacoutot
On Wed, Sep 11, 2013 at 09:50:14PM +0200, Stefan Sperling wrote:
> This fixes two small issues with www/apache-httpd:
> 
>  - The rc script doesn't work out of the box because it doesn't pass
>the -k option needed for 'start|stop|...' arguments. I hope my
>way of fixing it is appropriate, and welcome other suggestions.

Hmm... it works fine for me. What error are you running into exactly?


> 
>  - The readme implies that chroot is not available, while it has
>been available since 2.2.10 and does indeed work as advertised.
>http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir
> 
> ok?
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/www/apache-httpd/Makefile,v
> retrieving revision 1.38
> diff -u -p -r1.38 Makefile
> --- Makefile  12 Jul 2013 13:21:25 -  1.38
> +++ Makefile  11 Sep 2013 19:39:40 -
> @@ -3,6 +3,7 @@
>  COMMENT= apache HTTP server
>  
>  V=   2.2.25
> +REVISION=1
>  PKGNAME= apache-httpd-${V}
>  DISTNAME=httpd-${V}
>  
> Index: pkg/MESSAGE
> ===
> RCS file: /cvs/ports/www/apache-httpd/pkg/MESSAGE,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 MESSAGE
> --- pkg/MESSAGE   14 Dec 2006 07:14:21 -  1.1.1.1
> +++ pkg/MESSAGE   11 Sep 2013 19:40:48 -
> @@ -3,6 +3,5 @@ provided as a port for those who, for va
>  version 2. 
>  
>  OpenBSD provides a custom Apache server, httpd(8), in the base system
> -which has been audited for security and may run in a chroot(2)
> -environment.  Users are STRONGLY encouraged to use the system httpd
> -rather than this port.
> +which has been audited for security. Users are STRONGLY encouraged to
> +use the system httpd rather than this port.
> Index: pkg/httpd2.rc
> ===
> RCS file: /cvs/ports/www/apache-httpd/pkg/httpd2.rc,v
> retrieving revision 1.1
> diff -u -p -r1.1 httpd2.rc
> --- pkg/httpd2.rc 18 Jul 2012 08:45:42 -  1.1
> +++ pkg/httpd2.rc 11 Sep 2013 19:40:21 -
> @@ -10,4 +10,6 @@ rc_pre() {
>   rm -f /var/apache2/logs/{ssl_mutex,httpd.lock,accept.lock}.*
>  }
>  
> +daemon_flags="${daemon_flags} -k"
> +
>  rc_cmd $1
> 

-- 
Antoine



Re: small www/apache-httpd fixes: rc script and readme

2013-09-11 Thread Stuart Henderson
On 2013/09/11 22:26, Antoine Jacoutot wrote:
> On Wed, Sep 11, 2013 at 09:50:14PM +0200, Stefan Sperling wrote:
> > This fixes two small issues with www/apache-httpd:
> > 
> >  - The rc script doesn't work out of the box because it doesn't pass
> >the -k option needed for 'start|stop|...' arguments. I hope my
> >way of fixing it is appropriate, and welcome other suggestions.
> 
> Hmm... it works fine for me. What error are you running into exactly?

It works for me as-is too, though I think -k is more correct (the usage
text implies that you have to use it)

> >  - The readme implies that chroot is not available, while it has
> >been available since 2.2.10 and does indeed work as advertised.
> >http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir

How about removing MESSAGE? We're trying to get rid of base httpd..



Re: small www/apache-httpd fixes: rc script and readme

2013-09-11 Thread Antoine Jacoutot
On Wed, Sep 11, 2013 at 09:38:54PM +0100, Stuart Henderson wrote:
> On 2013/09/11 22:26, Antoine Jacoutot wrote:
> > On Wed, Sep 11, 2013 at 09:50:14PM +0200, Stefan Sperling wrote:
> > > This fixes two small issues with www/apache-httpd:
> > > 
> > >  - The rc script doesn't work out of the box because it doesn't pass
> > >the -k option needed for 'start|stop|...' arguments. I hope my
> > >way of fixing it is appropriate, and welcome other suggestions.
> > 
> > Hmm... it works fine for me. What error are you running into exactly?
> 
> It works for me as-is too, though I think -k is more correct (the usage
> text implies that you have to use it)

Sure but in this case, specific rc_ functions must be written.

> > >  - The readme implies that chroot is not available, while it has
> > >been available since 2.2.10 and does indeed work as advertised.
> > >http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir
> 
> How about removing MESSAGE? We're trying to get rid of base httpd..

+1

-- 
Antoine



Re: small www/apache-httpd fixes: rc script and readme

2013-09-12 Thread Stefan Sperling
On Wed, Sep 11, 2013 at 10:52:36PM +0200, Antoine Jacoutot wrote:
> On Wed, Sep 11, 2013 at 09:38:54PM +0100, Stuart Henderson wrote:
> > On 2013/09/11 22:26, Antoine Jacoutot wrote:
> > > On Wed, Sep 11, 2013 at 09:50:14PM +0200, Stefan Sperling wrote:
> > > > This fixes two small issues with www/apache-httpd:
> > > > 
> > > >  - The rc script doesn't work out of the box because it doesn't pass
> > > >the -k option needed for 'start|stop|...' arguments. I hope my
> > > >way of fixing it is appropriate, and welcome other suggestions.
> > > 
> > > Hmm... it works fine for me. What error are you running into exactly?

The rc script prints httpd2(failed). If I manually run the command run
by the script ('/usr/local/sbin/httpd2 start') httpd2 prints its usage.

The script only works without modification if I set
httpd2_daemon_flags="-k" in /etc/rc.conf.local.

> > It works for me as-is too, though I think -k is more correct (the usage
> > text implies that you have to use it)
> 
> Sure but in this case, specific rc_ functions must be written.

See below. HTTPD wants TERM instead of KILL when stopping, so I've
also added an rc_stop() override. Restart via HUP works fine.
See http://httpd.apache.org/docs/2.2/stopping.html for details.

> > > >  - The readme implies that chroot is not available, while it has
> > > >been available since 2.2.10 and does indeed work as advertised.
> > > >http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir
> > 
> > How about removing MESSAGE? We're trying to get rid of base httpd..
> 
> +1

Removing MESSAGE works for me, too.

Index: Makefile
===
RCS file: /cvs/ports/www/apache-httpd/Makefile,v
retrieving revision 1.38
diff -u -p -r1.38 Makefile
--- Makefile12 Jul 2013 13:21:25 -  1.38
+++ Makefile11 Sep 2013 20:18:53 -
@@ -3,6 +3,7 @@
 COMMENT=   apache HTTP server
 
 V= 2.2.25
+REVISION=  0
 PKGNAME=   apache-httpd-${V}
 DISTNAME=  httpd-${V}
 
Index: pkg/MESSAGE
===
RCS file: pkg/MESSAGE
diff -N pkg/MESSAGE
--- pkg/MESSAGE 14 Dec 2006 07:14:21 -  1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,8 +0,0 @@
-This is the official httpd distributed by the Apache Server Project,
-provided as a port for those who, for various reasons, need to run
-version 2. 
-
-OpenBSD provides a custom Apache server, httpd(8), in the base system
-which has been audited for security and may run in a chroot(2)
-environment.  Users are STRONGLY encouraged to use the system httpd
-rather than this port.
Index: pkg/httpd2.rc
===
RCS file: /cvs/ports/www/apache-httpd/pkg/httpd2.rc,v
retrieving revision 1.1
diff -u -p -r1.1 httpd2.rc
--- pkg/httpd2.rc   18 Jul 2012 08:45:42 -  1.1
+++ pkg/httpd2.rc   12 Sep 2013 14:22:32 -
@@ -10,4 +10,12 @@ rc_pre() {
rm -f /var/apache2/logs/{ssl_mutex,httpd.lock,accept.lock}.*
 }
 
+rc_start() {
+   ${rcexec} "${daemon} -k start ${daemon_flags} ${_bg}"
+}
+
+rc_stop() {
+   ${rcexec} "${daemon} -k stop ${daemon_flags} ${_bg}"
+}
+
 rc_cmd $1



Re: small www/apache-httpd fixes: rc script and readme

2013-09-12 Thread Antoine Jacoutot
On Thu, Sep 12, 2013 at 04:28:59PM +0200, Stefan Sperling wrote:
> On Wed, Sep 11, 2013 at 10:52:36PM +0200, Antoine Jacoutot wrote:
> > On Wed, Sep 11, 2013 at 09:38:54PM +0100, Stuart Henderson wrote:
> > > On 2013/09/11 22:26, Antoine Jacoutot wrote:
> > > > On Wed, Sep 11, 2013 at 09:50:14PM +0200, Stefan Sperling wrote:
> > > > > This fixes two small issues with www/apache-httpd:
> > > > > 
> > > > >  - The rc script doesn't work out of the box because it doesn't pass
> > > > >the -k option needed for 'start|stop|...' arguments. I hope my
> > > > >way of fixing it is appropriate, and welcome other suggestions.
> > > > 
> > > > Hmm... it works fine for me. What error are you running into exactly?
> 
> The rc script prints httpd2(failed). If I manually run the command run
> by the script ('/usr/local/sbin/httpd2 start') httpd2 prints its usage.

But this is not the command run by the script.
The command run by the script is:
$daemon $daemon_flags
i.e.
'/usr/local/sbin/httpd2'




> The script only works without modification if I set
> httpd2_daemon_flags="-k" in /etc/rc.conf.local.
> 
> > > It works for me as-is too, though I think -k is more correct (the usage
> > > text implies that you have to use it)
> > 
> > Sure but in this case, specific rc_ functions must be written.
> 
> See below. HTTPD wants TERM instead of KILL when stopping, so I've
> also added an rc_stop() override. Restart via HUP works fine.
> See http://httpd.apache.org/docs/2.2/stopping.html for details.
> 
> > > > >  - The readme implies that chroot is not available, while it has
> > > > >been available since 2.2.10 and does indeed work as advertised.
> > > > >http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir
> > > 
> > > How about removing MESSAGE? We're trying to get rid of base httpd..
> > 
> > +1
> 
> Removing MESSAGE works for me, too.
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/www/apache-httpd/Makefile,v
> retrieving revision 1.38
> diff -u -p -r1.38 Makefile
> --- Makefile  12 Jul 2013 13:21:25 -  1.38
> +++ Makefile  11 Sep 2013 20:18:53 -
> @@ -3,6 +3,7 @@
>  COMMENT= apache HTTP server
>  
>  V=   2.2.25
> +REVISION=0
>  PKGNAME= apache-httpd-${V}
>  DISTNAME=httpd-${V}
>  
> Index: pkg/MESSAGE
> ===
> RCS file: pkg/MESSAGE
> diff -N pkg/MESSAGE
> --- pkg/MESSAGE   14 Dec 2006 07:14:21 -  1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -
> @@ -1,8 +0,0 @@
> -This is the official httpd distributed by the Apache Server Project,
> -provided as a port for those who, for various reasons, need to run
> -version 2. 
> -
> -OpenBSD provides a custom Apache server, httpd(8), in the base system
> -which has been audited for security and may run in a chroot(2)
> -environment.  Users are STRONGLY encouraged to use the system httpd
> -rather than this port.
> Index: pkg/httpd2.rc
> ===
> RCS file: /cvs/ports/www/apache-httpd/pkg/httpd2.rc,v
> retrieving revision 1.1
> diff -u -p -r1.1 httpd2.rc
> --- pkg/httpd2.rc 18 Jul 2012 08:45:42 -  1.1
> +++ pkg/httpd2.rc 12 Sep 2013 14:22:32 -
> @@ -10,4 +10,12 @@ rc_pre() {
>   rm -f /var/apache2/logs/{ssl_mutex,httpd.lock,accept.lock}.*
>  }
>  
> +rc_start() {
> + ${rcexec} "${daemon} -k start ${daemon_flags} ${_bg}"
> +}
> +
> +rc_stop() {
> + ${rcexec} "${daemon} -k stop ${daemon_flags} ${_bg}"
> +}
> +
>  rc_cmd $1
> 

-- 
Antoine



Re: small www/apache-httpd fixes: rc script and readme

2013-09-16 Thread Stefan Sperling
On Thu, Sep 12, 2013 at 04:40:47PM +0200, Antoine Jacoutot wrote:
> On Thu, Sep 12, 2013 at 04:28:59PM +0200, Stefan Sperling wrote:
> > The rc script prints httpd2(failed). If I manually run the command run
> > by the script ('/usr/local/sbin/httpd2 start') httpd2 prints its usage.
> 
> But this is not the command run by the script.
> The command run by the script is:
> $daemon $daemon_flags
> i.e.
> '/usr/local/sbin/httpd2'

Right. Forget about this. I cannot reproduce the issue anymore, it must
have been due to a broken httpd config file or similar.