[ZBX-15477] "Admin" logged in does not displays super-admin options in the web frontend Created: 2019 Jan 21  Updated: 2019 Jan 23  Resolved: 2019 Jan 23

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 4.0.3
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Javier Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Docker under GNU/Linux



 Description   

Steps to reproduce:

1. Start database container:

docker run --name mysql-server -t \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix_pwd" \
      -e MYSQL_ROOT_PASSWORD="root_pwd" \
      -d mysql:5.7 \
      --character-set-server=utf8 --collation-server=utf8_bin

2. Start the server container:

docker run --name zabbix-server-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix_pwd" \
      -e MYSQL_ROOT_PASSWORD="root_pwd" \
      --link mysql-server:mysql \
      -p 10051:10051 \
      -d zabbix/zabbix-server-mysql:latest

3. Tail the server container (it will take around 20' to finish database schema creation):

docker logs -f zabbix-server-mysql

Until you see a line similar to:

   167:20190121:081855.971 server #33 started [preprocessing worker #3]

4. Start the frontend container:

docker run --name zabbix-web-nginx-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix_pwd" \
      -e MYSQL_ROOT_PASSWORD="root_pwd" \
      --link mysql-server:mysql \
      --link zabbix-server-mysql:zabbix-server \
      -p 80:80 \
      -d zabbix/zabbix-web-nginx-mysql:latest

5. Login:

http://localhost

6. Type below credentials:

Username Admin
Password zabbix

Result:
1. Some error messages:

System error occurred. Please contact Zabbix administrator.

2. Super admin options are not being displayed:
2.1. No "Administration tab"
2.2. No "Connected as Admin" message in the lower right corner
Etc.

Expected:
Super admin options being displayed:
1. "Administration tab"
2. "Connected as Admin" message in the lower right corner
Etc.

More information
Permissions are being created good, as far as I know:


mysql> select * from usrgrp;
+----------+---------------------------+------------+--------------+------------+
| usrgrpid | name                      | gui_access | users_status | debug_mode |
+----------+---------------------------+------------+--------------+------------+
|        7 | Zabbix administrators     |          0 |            0 |          0 |
|        8 | Guests                    |          1 |            0 |          0 |
|        9 | Disabled                  |          0 |            1 |          0 |
|       11 | Enabled debug mode        |          0 |            0 |          1 |
|       12 | No access to the frontend |          3 |            0 |          0 |
+----------+---------------------------+------------+--------------+------------+
5 rows in set (0.00 sec)

mysql> update usrgrp set gui_access=1 where usrgrpid=7;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from usrgrp;
+----------+---------------------------+------------+--------------+------------+
| usrgrpid | name                      | gui_access | users_status | debug_mode |
+----------+---------------------------+------------+--------------+------------+
|        7 | Zabbix administrators     |          1 |            0 |          0 |
|        8 | Guests                    |          1 |            0 |          0 |
|        9 | Disabled                  |          0 |            1 |          0 |
|       11 | Enabled debug mode        |          0 |            0 |          1 |
|       12 | No access to the frontend |          3 |            0 |          0 |
+----------+---------------------------+------------+--------------+------------+
5 rows in set (0.00 sec)

mysql> update usrgrp set gui_access=0 where usrgrpid=7;
Query OK, 1 row affected (0.05 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from usrgrp;
+----------+---------------------------+------------+--------------+------------+
| usrgrpid | name                      | gui_access | users_status | debug_mode |
+----------+---------------------------+------------+--------------+------------+
|        7 | Zabbix administrators     |          0 |            0 |          0 |
|        8 | Guests                    |          1 |            0 |          0 |
|        9 | Disabled                  |          0 |            1 |          0 |
|       11 | Enabled debug mode        |          0 |            0 |          1 |
|       12 | No access to the frontend |          3 |            0 |          0 |
+----------+---------------------------+------------+--------------+------------+
5 rows in set (0.00 sec)

Thanks for your great product



 Comments   
Comment by Javier [ 2019 Jan 21 ]

I think this issue should be linked to ZBX-15435

Comment by Valdis Murzins [ 2019 Jan 21 ]

Hello caraconan,

Assigned user group is not responsible for Zabbix user access level. To check user access level you are interested in 'type' column in 'users' table.
Possible values are:
1 - Zabbix User
2 - Zabbix Admin
3 - Zabbix Super Admin

But it is still curious, how you got this problem and what error is causing error message "System error occurred. Please contact Zabbix administrator."

Comment by Javier [ 2019 Jan 21 ]

Following comment in ZBX-15435 I enabled "ZBX_SHOW_TECHNICAL_ERRORS" and I got:

    Cookie names must not be empty [zabbix.php:21 → require_once() → ZBase->run() → ZBase->authenticateUser() → CWebUser::checkAuthentication() → CWebUser::setSessionCookie() → zbx_setcookie() → setcookie() in include/func.inc.php:104]

BTW the right snippet of SQL:

mysql> select userid, alias, type from users;
+--------+-------+------+
| userid | alias | type |
+--------+-------+------+
|      1 | Admin |    3 |
|      2 | guest |    1 |
+--------+-------+------+
2 rows in set (0.00 sec)

Thanks for your time.

Comment by Valdis Murzins [ 2019 Jan 22 ]

Hello caraconan,

User types seems correct. Based on error message, the problem is with getting cookie name where session is stored or with getting sessionId that should be saved in cookie.

Have you made any changes in the code (expect for ZBX_SHOW_TECHNICAL_ERRORS)?
Also, please, check what value you have for ZBX_SESSION_NAME.

Comment by Javier [ 2019 Jan 22 ]

Great @Valdis, issue fixed!

1. Get the code

docker cp zabbix-web-nginx-mysql:/usr/share/zabbix/include/defines.inc.php .

2. Edit the file:

cp defines.inc.php defines.inc.php.old
vim defines.inc.php

3. Add a value to the previously empty "ZBX_SESSION_NAME" setting:

//define('ZBX_SESSION_NAME', ''); // Session cookie name for Zabbix front-end.
define('ZBX_SESSION_NAME', 'new_value_added_by_me'); // Session cookie name for Zabbix front-end.

4. Copy the edited file to the container:

docker cp defines.inc.php zabbix-web-nginx-mysql:/usr/share/zabbix/include

5. Test it:

http://localhost
Admin
zabbix

Now all the admin options are there, and the error messages are not being displayed.

I guess that a patch should be added to this file, and a new version of "defines.inc.php" should be upload to your code.

Thanks.

Comment by Valdis Murzins [ 2019 Jan 22 ]

I am glad, it was fixed.

But normally this problem should not have occurred, as in released version of Zabbix 4.0.3 this value is not empty:

define('ZBX_SESSION_NAME', 'zbx_sessionid'); // Session cookie name for Zabbix front-end.

Where did you got your source code from?

Comment by Javier [ 2019 Jan 23 ]

@Valdis as I stated in this ticket from "zabbix/zabbix-web-nginx-mysql" docker image.

Just right now "zabbix/zabbix-web-apache-mysql:latest" works as expected, since its contain:

define('ZBX_SESSION_NAME', 'zbx_sessionid'); // Session cookie name for Zabbix front-end.

I don't have time now, but worth checking nginx docker image flavor "zabbix/zabbix-web-nginx-mysql:latest"

Comment by Valdis Murzins [ 2019 Jan 23 ]

caraconan, I got confirmation that there was an error in docker image in this this constant and that this docker image was fixed yesterday.

Thank you a lot for your report and sorry for inconveniences, it caused.

Generated at Thu May 22 07:03:05 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.