Ad Widget

Collapse

Zabbix & SAML(SSO)

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • teddy
    Senior Member
    • Dec 2017
    • 234

    #1

    Zabbix & SAML(SSO)

    Мы перешли на работу с SAML(SSO) аутентификацией. Очень удобно, с учетом что я докрутил работу ( вход ) по сертификатам - все безопасники счастливы.
    Но есть маленькое но. Никак не убрать с входной странички поля Логин\Пароль которые сбивают с толку. Тк. они не относятся к SAML, туда не передаються и вообще не нужны.
    Вопрос - можно ли их прибрать со стартовой странички настройками? не залезая руками в php. Залезь-то не сложно но потом в случаях обновления каждый раз править - грустно.
  • Answer selected by teddy at 03-10-2025, 17:19.
    Donkey
    Junior Member
    • Jun 2024
    • 15

    You need to modify /usr/share/zabbix/ui/include/views/general.login.php


    something like this:

    PHP Code:
    <?php

    /**
     * @var CView $this
     */

    define('ZBX_PAGE_NO_HEADER'1);
    define('ZBX_PAGE_NO_FOOTER'1);
    define('ZBX_PAGE_NO_MENU'true);
    define('ZBX_PAGE_NO_JSLOADER'true);

    require_once 
    dirname(__FILE__).'/../page_header.php';

    if (isset(
    $data['error'])) {
        
    // Remove debug code for login form message, trimming not in regex to rely only on [ ] in debug message.
        
    $message trim(preg_replace('/\[.*\]/'''$data['error']['message']));
        
    $error = (new CDiv($message))->addClass(ZBX_STYLE_RED);
    }

    $saml_login_link = isset($data['saml_login_url'])
        ? (new 
    CListItem(new CLink(_('Sign in with Single Sign-On (SAML)'), $data['saml_login_url'])))
            ->
    addClass(ZBX_STYLE_SIGN_IN_TXT)
        : 
    null;

    global 
    $ZBX_SERVER_NAME;
    $logon_warning_text "WARNING: You have accessed a computer managed by Contoso. You are required to have authorisation from Contoso before you proceed and you are strictly limited to the use set out within that authorisation. Unauthorised access to or misuse of this system is prohibited and constitutes an offence under the Computer Misuse Act 1990. If you disclose any information obtained through this system without authority Contoso may take legal action against you.";

    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Sign In</title>
        <link rel="stylesheet" type="text/css" href="https://zabbix.contoso.net/assets/styles/logon.css">
    </head>
    <body>
    <?php

    (new CDiv([
        (new 
    CTag('main'true, [
            (isset(
    $ZBX_SERVER_NAME) && $ZBX_SERVER_NAME !== '')
                ? (new 
    CDiv($ZBX_SERVER_NAME))->addClass(ZBX_STYLE_SERVER_NAME)
                : 
    null,
            (new 
    CDiv([
            (new 
    CDiv(makeLogo(LOGO_TYPE_NORMAL)))->addClass(ZBX_STYLE_SIGNIN_LOGO),
            (new 
    CDiv($logon_warning_text))->addClass(ZBX_STYLE_RED),
            (new 
    CForm())
                    ->
    setAttribute('aria-label'_('Sign in'))
                    ->
    addItem(hasRequest('request') ? new CVar('request'getRequest('request')) : null)
            ->
    addItem(
                        (new 
    CList())->addItem($saml_login_link)
                    )
        ]))->
    addClass(ZBX_STYLE_SIGNIN_CONTAINER),
        ])),
    ]))->
    addClass(ZBX_STYLE_LAYOUT_WRAPPER)->show();
    ?>
    </body>
    </html>

    Change /usr/share/zabbix/ui/assets/styles/logon.css

    to something like this:
    PHP Code:
    body {
        
    background-color#0a123b;
        
    background-imageurl("https://wallup.net/wp-content/uploads/2016/05/26/355454-blue-abstract.jpg");
        
    background-sizecover;
        
    background-repeatno-repeat;
        
    background-positionbottom center;
        
    background-attachmentfixed

    Last edited by Donkey; 02-10-2025, 17:45.

    Comment

    • Donkey
      Junior Member
      • Jun 2024
      • 15

      #2
      You need to modify /usr/share/zabbix/ui/include/views/general.login.php


      something like this:

      PHP Code:
      <?php

      /**
       * @var CView $this
       */

      define('ZBX_PAGE_NO_HEADER'1);
      define('ZBX_PAGE_NO_FOOTER'1);
      define('ZBX_PAGE_NO_MENU'true);
      define('ZBX_PAGE_NO_JSLOADER'true);

      require_once 
      dirname(__FILE__).'/../page_header.php';

      if (isset(
      $data['error'])) {
          
      // Remove debug code for login form message, trimming not in regex to rely only on [ ] in debug message.
          
      $message trim(preg_replace('/\[.*\]/'''$data['error']['message']));
          
      $error = (new CDiv($message))->addClass(ZBX_STYLE_RED);
      }

      $saml_login_link = isset($data['saml_login_url'])
          ? (new 
      CListItem(new CLink(_('Sign in with Single Sign-On (SAML)'), $data['saml_login_url'])))
              ->
      addClass(ZBX_STYLE_SIGN_IN_TXT)
          : 
      null;

      global 
      $ZBX_SERVER_NAME;
      $logon_warning_text "WARNING: You have accessed a computer managed by Contoso. You are required to have authorisation from Contoso before you proceed and you are strictly limited to the use set out within that authorisation. Unauthorised access to or misuse of this system is prohibited and constitutes an offence under the Computer Misuse Act 1990. If you disclose any information obtained through this system without authority Contoso may take legal action against you.";

      ?>
      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Sign In</title>
          <link rel="stylesheet" type="text/css" href="https://zabbix.contoso.net/assets/styles/logon.css">
      </head>
      <body>
      <?php

      (new CDiv([
          (new 
      CTag('main'true, [
              (isset(
      $ZBX_SERVER_NAME) && $ZBX_SERVER_NAME !== '')
                  ? (new 
      CDiv($ZBX_SERVER_NAME))->addClass(ZBX_STYLE_SERVER_NAME)
                  : 
      null,
              (new 
      CDiv([
              (new 
      CDiv(makeLogo(LOGO_TYPE_NORMAL)))->addClass(ZBX_STYLE_SIGNIN_LOGO),
              (new 
      CDiv($logon_warning_text))->addClass(ZBX_STYLE_RED),
              (new 
      CForm())
                      ->
      setAttribute('aria-label'_('Sign in'))
                      ->
      addItem(hasRequest('request') ? new CVar('request'getRequest('request')) : null)
              ->
      addItem(
                          (new 
      CList())->addItem($saml_login_link)
                      )
          ]))->
      addClass(ZBX_STYLE_SIGNIN_CONTAINER),
          ])),
      ]))->
      addClass(ZBX_STYLE_LAYOUT_WRAPPER)->show();
      ?>
      </body>
      </html>

      Change /usr/share/zabbix/ui/assets/styles/logon.css

      to something like this:
      PHP Code:
      body {
          
      background-color#0a123b;
          
      background-imageurl("https://wallup.net/wp-content/uploads/2016/05/26/355454-blue-abstract.jpg");
          
      background-sizecover;
          
      background-repeatno-repeat;
          
      background-positionbottom center;
          
      background-attachmentfixed

      Last edited by Donkey; 02-10-2025, 17:45.

      Comment

      • Donkey
        Junior Member
        • Jun 2024
        • 15

        #3
        Back up these two files before you upgrade the Zabbix version, as they will get overwritten. Then restore them afterwards.

        Comment


        • teddy
          teddy commented
          Editing a comment
          thanks, that's clear.
          It's bad that this is not a setting, but rather a code edit. That is, it may break in future versions and simply copying from the archive will not help.
          I already have a similar solution to enable certificate authentication in SAML.
      Working...