Technology Sharing

[zabbix7] Enable HTTP authentication to implement single sign-on

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Enable HTTP authentication to implement single sign-on

1. Create a new http authentication user
htpasswd -c /etc/nginx/.htpasswd another_username
# 在提示中输入密码
  • 1
  • 2
2. Create a new Nginx configuration file

Copy zabbix.conf and modify the listening port.

cp zabbx.conf zabbix_http.conf
每个location中新增两行
server {
		listen          89;
        ...
        location = /favicon.ico {
                auth_basic "Restricted Content";
                auth_basic_user_file /etc/nginx/.htpasswd;
                log_not_found   off;
        }
        ...
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
3. Start nginx
systemctl restart nginx
  • 1
4. Configure zabbix to enable HTTP authentication

Click on the web interface to find用户认证HTTP设置
insert image description here

5. Create a new user and set the URL after login

After creating a new user, you need to set the URL after login, otherwise the front-end UI will be messed up after login.
insert image description here

6. Verification

After logging out, you can see that there is an additional "Log in using HTTP" on the login interface. At this time, you cannot log in by clicking on login, because our interface accesses port 80, and port 89 can be logged in via HTTP. To access port 89, follow the steps below:
insert image description here
Enter your account and password to log in.
7. Single Sign-On
Configure some jump button url links ashttp://another_username:[email protected]:89/, you can log in directly.