how to basic auth by httpd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to basic auth by httpd

Tuyosi Takesima
Hi all .

i set up sshd server & www server by raspberry pi 3 .

it is difficult to use nginx , so i use httpd (openbsd's default www
server) .

but i cannot setup  basic auth .
please show some hints .
---
regards
http://openbsd-akita.blogspot.jp/2017/05/arm-server.html
http://openbsd-akita.blogspot.jp/2017/03/openbsd-61-on-raspberry-pi-3.html
Reply | Threaded
Open this post in threaded view
|

Re: how to basic auth by httpd

Wiremu Demchick
Tēnā koe,

Would be helpful if you could post your httpd.conf file.  Also, you
may wish to consider posting to the misc@ group for this issue, as I
doubt it is ARM-specific.  But, they will definitely want to see your
config file.

Best regards

On 5/18/17, Tuyosi T <[hidden email]> wrote:

> Hi all .
>
> i set up sshd server & www server by raspberry pi 3 .
>
> it is difficult to use nginx , so i use httpd (openbsd's default www
> server) .
>
> but i cannot setup  basic auth .
> please show some hints .
> ---
> regards
> http://openbsd-akita.blogspot.jp/2017/05/arm-server.html
> http://openbsd-akita.blogspot.jp/2017/03/openbsd-61-on-raspberry-pi-3.html
>

Reply | Threaded
Open this post in threaded view
|

Re: how to basic auth by httpd

Wiremu Demchick
In reply to this post by Tuyosi Takesima
You'll find what you need to add here:
    http://man.openbsd.org/httpd.conf.5#SERVERS

So, for example, you might have in your configuration:
    server "default" {
        listen on * port 80
        authenticate "secure area" with "/htpasswd.conf"
    }

You then need to setup the htpasswd.conf file with the credentials you
want.  Remember that "/htpasswd.conf" is relative to the chroot
directory, so (assuming you don't change the default chroot settings)
that means you want to edit "/var/www/htpasswd.conf".  You do this
using the htpasswd utility like so:
    htpasswd /var/www/htpasswd.conf username

Where username is whatever username you want.

Also, make sure that htpasswd.conf is readable by the www user, and
only by the www user.

The commands "man httpd" and "man httpd.conf" will get you the full
documentation.  Or, you can go to:
    http://man.openbsd.org

On 5/18/17, Tuyosi T <[hidden email]> wrote:

> thx  demchick .
>
> my /etc/httpd.conf   is very simple .
>
> -----------------
> ext_addr="*"
> server "default" {
>         listen on $ext_addr port 80
> }
> ------------------
>
> regards
>

Reply | Threaded
Open this post in threaded view
|

Re: how to basic auth by httpd

Tuyosi Takesima
In reply to this post by Tuyosi Takesima
thaks for your kind and correct answer .


# htpasswd  /var/www/htpasswd.conf user-X
Password:
Retype Password:

# chown www /var/www/htpasswd.conf

# chmod 600 /var/www/htpasswd.conf

again
# /etc/httpd.conf
ext_addr="*"
server "default" {
        listen on * port 80
        authenticate "secure area" with "/htpasswd.conf"
    }

now i use Rpi3 openbsd as sshd and www server with basic auth .
Rpi3 is about 5W so very ecological .
and
Rpi3 openbsd is sufficient for personal use and very convinient .

thanks

---------
best regards by T tuyosi