dns-ui icon indicating copy to clipboard operation
dns-ui copied to clipboard

PHP Auth user does not exist.

Open 5hack opened this issue 7 years ago • 3 comments

Hi, I'm having an issue with setting up DNS UI. Everything else should be okay. Just issue with auth, using basic Apache auth. Is this linked to something I need to configure in the [PHP_AUTH] section?

Here is a printout of my Apache error log

UserNotFoundException: User does not exist in PHP_AUTH variables. in /var/www/model/user.php:135
Stack trace:
#0 /var/www/model/user.php(112): User->get_details_from_php_auth()
#1 /var/www/model/userdirectory.php(98): User->get_details()
#2 /var/www/requesthandler.php(24): UserDirectory->get_user_by_uid('dns-user')
#3 /var/www/public_html/init.php(17): require('/var/www/dns-ui...')
#4 {main}

Vhost file

<VirtualHost *:80>
        ServerAdmin dns-user@localhost
        DocumentRoot /var/www/public_html/
        <Directory /var/www/public_html/>
        AuthType Basic
        AuthName "DNS UI"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
        AllowOverride none
        </Directory>
        DirectoryIndex init.php
        FallbackResource /init.php
        AllowEncodedSlashes NoDecode
</VirtualHost>

PS. Thanks for the awesome software. Looking forward to future updates and imporvements!

5hack avatar Jun 13 '18 12:06 5hack

Hi. The PHP_AUTH setup is only designed for use with a web server setup that is providing all user details (user ID, name and email) to the application via environment variables. If this is not the case you should disable this in the config. If you are trying to use DNS UI with just a local user database (no LDAP backend etc), know that support for this is not perfect and requires some extra manual setup work:

You will need to manually create the first user in the database via SQL command (this is something I hope to improve on soon). A query like the following should work: insert into "user" (uid, name, email, admin) values ('dns-user', 'DNS User', '[email protected]', 1); Any other needed users can then be created in the UI once you've managed to log into that first account.

Edit: you can now manually create the first user by running the scripts/create_admin_account.php script.

thomas-pike avatar Jun 20 '18 13:06 thomas-pike

Humm... ok, then this user was created like that, then all that I get everywhere is 403

"Access denied Sorry, but you don't have permission to view this page."

I have pretty much the same config cited above... the page is loaded ok, but all the content is 403.

192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /settings HTTP/1.1" 403 6260
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /bootstrap/js/bootstrap.min.js HTTP/1.1" 200 37045
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /bootstrap/css/bootstrap-theme.min.css HTTP/1.1" 200 23409
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /style.css?1547320976 HTTP/1.1" 200 4854
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /ipaddr/ipaddr.min.js HTTP/1.1" 200 7337
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /jquery/jquery-1.11.3.min.js HTTP/1.1" 200 95957
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /bootstrap/css/bootstrap.min.css HTTP/1.1" 200 121200
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /extra.js?1547320976 HTTP/1.1" 200 42659
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /logo-header-opera.png HTTP/1.1" 200 3389
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /jquery/jquery-1.11.3.min.js HTTP/1.1" 200 95957
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /bootstrap/js/bootstrap.min.js HTTP/1.1" 200 37045
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /ipaddr/ipaddr.min.js HTTP/1.1" 200 7337
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /extra.js?1547320976 HTTP/1.1" 200 42659
192.168.1.110 - admin [12/Jan/2019:21:25:27 +0100] "GET /book_next.png HTTP/1.1" 200 702

Any ideas?

spectroman avatar Jan 12 '19 20:01 spectroman

Just ran into this - query above is missing the active flag.

psql -d dnsui -c 'update "user" set active=1'

fixes this.


Further uid has to match with the htpasswd username.

tabakhase avatar Jan 16 '19 10:01 tabakhase