Re: OpenBSD's HTTPD - I can't figure out how to disable the chroot

2017-02-13 Thread Solène Rapenne

Le 2017-02-13 00:03, tec...@protonmail.com a écrit :

Hello,

I have a special use case for the HTTPD server, I would like to
disable the chroot but can't seem to get it working correctly. Within
httpd.conf, I have tried to set:

chroot "/" ## Instead of default which is: /var/www


root "/var/www/htdocs/web"
#root "/htdocs/web" # Disabled

location "/" {
directory {
index "index.html"
}
}



But I can't access my page until I put it back to normal (uncomment
the # lines and remove the new ones)


Any help would be greatly appreciated. Thanks


hello
the following works for me on -current

chroot "/"
logdir "/var/www/logs/"

server "*" {
listen on * port 8080
root "/var/www/htdocs/"

location "/solene/" {
directory auto index
}
}



Re: OpenBSD's HTTPD - I can't figure out how to disable the chroot

2017-02-13 Thread Kenneth Gober
On Sun, Feb 12, 2017 at 6:03 PM,   wrote:
> I have a special use case for the HTTPD server, I would like to disable
> the chroot but can't seem to get it working correctly.

While I can't help you with your httpd chroot issue, I can suggest that
if you need to access a part of the filesystem outside of /var/www, you
can NFS mount it from yourself.

For example, suppose you have a directory /nfs/archive/dist/OpenBSD, and
you want to serve it via httpd.  You can do something like this:

1. add a line to /etc/exports:
   /nfs/archive/dist/OpenBSD -ro 127.0.0.1

2. start nfsd:
   # rcctl start nfsd

3. remount your data under /var/www:
   # mkdir -p /var/www/htdocs/pub/OpenBSD
   # mount -r 127.0.0.1:/nfs/archive/dist/OpenBSD /var/www/htdocs/pub/OpenBSD

At this point you should be able to chroot to /var/www, and still be able
to access files under /htdocs/pub/OpenBSD.

This may not be the prettiest way to achieve your goal but it's simple
and it works for ftpd.  I assume it would work just as well for httpd.

-ken