shinken-monitoring/mod-webui

auth failed

Closed this issue · 15 comments

Hi all !
I trried to install a shinken 2.2.4 on Centos7.

I have a problem with authentification with mod webui2
I use embeddded authent ( local and htttpsppaswd)

Mod_webu2 configured in broker-master.cfg OK
I have a htppasswd.users in /etc/shinken OK whith admin account
I have contacts in the directory contatcts OK

Every time i tried to connect to the webui i have the same issue
The mod-webui cant find my connection
I tried also local authen ( without httpasswd.users)

Here the log in DEBUG mode of broker-master.log

DEBUG:broker-master:[WebUI] login_required, requested URL: /user/auth
^[[96m[1499691473] DEBUG: [broker-master] [WebUI] get_url for 'Logout'^[[0m
DEBUG:broker-master:[WebUI] get_url for 'Logout'
^[[96m[1499691473] DEBUG: [broker-master] [WebUI] get_url for 'GetLogin'^[[0m
DEBUG:broker-master:[WebUI] get_url for 'GetLogin'
^[[95m[1499691473] INFO: [broker-master] [WebUI] user 'admin' is signing in ...^[[0m
INFO:broker-master:[WebUI] user 'admin' is signing in ...
^[[95m[1499691473] INFO: [broker-master] [WebUI] Checking authentication for user: admin^[[0m
INFO:broker-master:[WebUI] Checking authentication for user: admin
^[[95m[1499691473] INFO: [broker-master] [WebUI] Requesting authentication for user: admin^[[0m
INFO:broker-master:[WebUI] Requesting authentication for user: admin
^[[95m[1499691473] INFO: [broker-master] [WebUI] Authenticating user 'admin'^[[0m
INFO:broker-master:[WebUI] Authenticating user 'admin'
^[[95m[1499691473] INFO: [broker-master] [WebUI] Internal htpasswd authentication^[[0m
INFO:broker-master:[WebUI] Internal htpasswd authentication
^[[95m[1499691473] INFO: [broker-master] [WebUI-auth-htpasswd] Authenticating user 'admin'^[[0m
INFO:broker-master:[WebUI-auth-htpasswd] Authenticating user 'admin'
^[[95m[1499691473] INFO: [broker-master] [WebUI-auth-htpasswd] Authenticated^[[0m
INFO:broker-master:[WebUI-auth-htpasswd] Authenticated
^[[95m[1499691473] INFO: [broker-master] [WebUI] user authenticated thanks to htpasswd^[[0m
INFO:broker-master:[WebUI] user authenticated thanks to htpasswd
^[[96m[1499691473] DEBUG: [broker-master] Debug perf: push_broks [args:0.0407772064209] [aqu_lock:0.0][calling:1.69277191162e-05] [json:2.00271606445e-05] [global:0.0408141613007]^[[0m
DEBUG:broker-master:Debug perf: push_broks [args:0.0407772064209] [aqu_lock:0.0][calling:1.69277191162e-05] [json:2.00271606445e-05] [global:0.0408141613007]
^[[96m[1499691473] DEBUG: [broker-master] Debug perf: ping [args:3.81469726562e-06] [aqu_lock:0.0][calling:1.19209289551e-06] [json:5.96046447754e-06] [global:1.09672546387e-05]^[[0m
DEBUG:broker-master:Debug perf: ping [args:3.81469726562e-06] [aqu_lock:0.0][calling:1.19209289551e-06] [json:5.96046447754e-06] [global:1.09672546387e-05]
^[[96m[1499691473] DEBUG: [broker-master] [WebUI - datamanager] get_contact, name: admin, user: None^[[0m
DEBUG:broker-master:[WebUI - datamanager] get_contact, name: admin, user: None
^[[96m[1499691473] DEBUG: [broker-master] [WebUI - datamanager] get_contacts, name: admin^[[0m
DEBUG:broker-master:[WebUI - datamanager] get_contacts, name: admin
^[[96m[1499691473] DEBUG: [broker-master] [WebUI - datamanager] got 0 contacts^[[0m
DEBUG:broker-master:[WebUI - datamanager] got 0 contacts
^[[91m[1499691473] ERROR: [broker-master] [WebUI] You need to have a contact having the same name as your user: admin^[[0m

Thank you for your help

Hi @atelacs

Do you have a contact named "admin" in your shinken configuration ? It should be something like that

define contact {
    use generic-contact
    contact_name admin
    email none
    password secret
    is_admin 1
}

Hi @maethor

Yep i have it

[shinken@darkx shinken]$ cd contacts
[shinken@darkx contacts]$ ll
total 8
-rw-rw-r--. 1 shinken shinken 336 7 juil. 13:11 admin.cfg
-rw-rw-r--. 1 shinken shinken 252 6 juil. 11:30 guest.cfg
[shinken@darkx contacts]$ cat admin.cfg
define contact{
use generic-contact
contact_name admin
alias Administrator
email shinken@localhost
pager 0600000000 ; contact phone number
password admin
is_admin 1
can_submit_commands 0
expert 1
}

OK, this seems nice. And this file is included in your shinken configuration?

yep
/etc/shinken/contacts

[shinken@darkx contacts]$ ll
total 8
-rw-rw-r--. 1 shinken shinken 336 7 juil. 13:11 admin.cfg
-rw-rw-r--. 1 shinken shinken 252 6 juil. 11:30 guest.cfg
[shinken@darkx contacts]$ pwd
/etc/shinken/contacts

with good rights

You didn't answer my question :)

The files, or the directory, needs to be included in the shinken main configuration (shinken.cfg). Please read about cfg_dir and cfg_file statements : http://shinken.readthedocs.io/en/latest/03_configuration/configmain.html#configuration-configmain

Oh sorry
I didn't understand
I checked it
It's also good

shinken.cfg.pdf

I don't know. I seems the webui doesn't find the shinken "admin" contact:

^[[96m[1499691473] DEBUG: [broker-master] [WebUI - datamanager] got 0 contacts^[[0m
DEBUG:broker-master:[WebUI - datamanager] got 0 contacts
^[[91m[1499691473] ERROR: [broker-master] [WebUI] You need to have a contact having the same name as your user: admin^[[0m

Besides the webui, is shinken working well? Are you sure the broker is receiving the configuration from the arbiter? I believe you have problems between daemons that I will not be able to help fixing :(

I have the same issue after install Shinken from source, however it works through package installation (yum).

I can see 2 contacts in my configuration and both accepted by Aribiter:
/usr/bin/shinken-arbiter -v -c /etc/shinken/shinken.cfg

---
[1501314311] INFO: [Shinken] Checking contacts...
INFO:Shinken:Checking contacts...
[1501314311] INFO: [Shinken] 	Checked 2 contacts
INFO:Shinken:	Checked 2 contacts
[1501314311] INFO: [Shinken] Checking contactgroups...
INFO:Shinken:Checking contactgroups...
[1501314311] INFO: [Shinken] 	Checked 2 contactgroups
INFO:Shinken:	Checked 2 contactgroups
---

Checking system log, I can see following errors:

[1501313854] INFO: [broker-master] [WebUI]  user 'admin' is signing in ...
[1501313854] INFO: [broker-master] [WebUI] Checking authentication for user: admin
[1501313854] INFO: [broker-master] [WebUI] Requesting authentication for user: admin
[1501313854] INFO: [broker-master] [WebUI] Authenticating user 'admin'
[1501313854] INFO: [broker-master] [WebUI] Internal htpasswd authentication
[1501313854] INFO: [broker-master] [WebUI] Internal alignak backend authentication
[1501313854] INFO: [broker-master] [WebUI] Internal contact authentication
[1501313854] INFO: [broker-master] [WebUI-auth-cfg-password] Authenticating user 'admin'
[1501313854] DEBUG: [broker-master] [WebUI - datamanager] get_contact, name: admin, user: None
[1501313854] DEBUG: [broker-master] [WebUI - datamanager] get_contacts, name: admin
[1501313854] DEBUG: [broker-master] Debug perf: push_broks [args:0.0434918403625] [aqu_lock:1.19209289551e-06][calling:1.47819519043e-05] [json:2.00271606445e-05] [global:0.043527841568]
[1501313854] DEBUG: [broker-master] [WebUI - datamanager] got 0 contacts
[1501313854] ERROR: [broker-master] [WebUI-auth-cfg-password] You need to have a contact having the same name as your user: admin
[1501313854] WARNING: [broker-master] [WebUI] The user 'admin' has not been authenticated.
[1501313854] DEBUG: [broker-master] Debug perf: ping [args:2.86102294922e-06] [aqu_lock:1.19209289551e-06][calling:1.90734863281e-06] [json:8.10623168945e-06] [global:1.4066696167e-05]
[1501313854] DEBUG: [broker-master] [WebUI] get_url for 'GetLogin'
[1501313854] WARNING: [broker-master] [WebUI]  user 'admin' access denied, redirection to: /user/login?error=Invalid user or Password
[1501313854] DEBUG: [broker-master] [WebUI] get_url for 'GetLogin'
[1501313854] DEBUG: [broker-master] [WebUI] login_required, requested URL: /user/login
[1501313854] DEBUG: [broker-master] [WebUI] get_url for 'Logout'
[1501313854] DEBUG: [broker-master] [WebUI] user login request, remote user enabled: 0: X_REMOTE_USER
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Referer = http://192.168.3.57:7767/user/login?error=Invalid%20user%20or%20Password
[1501313854] DEBUG: [broker-master] [WebUI] X request header: User-Agent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Connection = keep-alive
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Pragma = no-cache
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Host = 192.168.3.57:7767
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Upgrade-Insecure-Requests = 1
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Cache-Control = no-cache
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Accept = text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Accept-Language = en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4
[1501313854] DEBUG: [broker-master] [WebUI] X request header: Accept-Encoding = gzip, deflate
[1501313854] WARNING: [broker-master] [WebUI] login page with error message: Invalid user or Password

Shinken 3.0.0 — Web User Interface 2.5.2

Shinken 3.0.0 ??? I don't see it published https://github.com/naparuba/shinken/releases

Me too. However, I got this message on the login page.
Here is how I installed Shinken:

wget https://github.com/naparuba/shinken/tarball/master
mv master shinken.tar.gz
tar -xvf shinken.tar.gz
cd naparuba-shinken-0dfa784

sudo python setup.py install

OK, I think your should'nt install the master branch.

Agree. I will do downgrade.

@geekmichael @atelacs please install shinken 2.4.3 instead of 2.2 ou 3. I have confirmation that 3 doesn't work well.