Ad Widget

Collapse

Automatically configuring superuser password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joanypony
    Junior Member
    • Dec 2015
    • 6

    #1

    Automatically configuring superuser password

    Hi,

    As you all know, the superuser/Admin user has the default password of Zabbix.

    I'm writing chef recipes to automate the creation of our zabbix hosts and I'm trying to automate every single configuration step.

    I want to change the Admin password to something else. I can only see how to update this in the GUI.
    In theory, you can update a user password via the API, BUT I'd have logged into said API using the superuser account, so I don't think it's a good idea to change the password of the account as I'm using it to authenticate said action.

    Any ideas?

    Thanks,
    Joan
  • sergio.cricca
    Member
    • Mar 2008
    • 43

    #2
    What about:
    - Login as "admin" via API
    - Create user "api" with new secure password + give that new user super admin permissions
    - Logout from admin
    - Login as "api" user
    - Disable "admin" account
    - do everything else you are doing now

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #3
      Originally posted by joanypony
      Hi,

      As you all know, the superuser/Admin user has the default password of Zabbix.

      I'm writing chef recipes to automate the creation of our zabbix hosts and I'm trying to automate every single configuration step.
      I have no idea why almost everyone who is using chef or puppet has a really odd tendency to over complicate almost everything?
      If you are creating new zabbix server part of this process will be initialize database. Such initialization consist from two steps: first is importing database scheme (schema.sql) and second is import data.sql.
      Inside dist data.sql is line:

      Code:
      INSERT INTO `users` (`userid`,`alias`,`name`,`surname`,`passwd`,`url`,`autologin`,`autologout`,`lang`,`refresh`,`type`,`theme`,`rows_per_page`) values ('1','Admin','Zabbix','Administrator','5fce1b3e34b520afeffb37ce08c7cd66','','1','0','en_GB','30','3','default','50');
      so all what you need to do is prepare this file with changed hash of your new password and import it.
      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
      https://kloczek.wordpress.com/
      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
      My zabbix templates https://github.com/kloczek/zabbix-templates

      Comment

      • joanypony
        Junior Member
        • Dec 2015
        • 6

        #4
        Thanks Kloczek!
        That exactly what I needed to get started. I'm updating the Admin user with the new md5 hash after I've imported the schema and it's working well.

        Re complicating things with Chef, it's because I'll be building at least 15 Zabbix hosts and need to automate it so other staff can continue to do so even without me also, I find the default superuser password has a habit of staying there unless I deal with it from the start

        Thanks,
        Joan

        Comment

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #5
          Originally posted by joanypony
          Re complicating things with Chef, it's because I'll be building at least 15 Zabbix hosts and need to automate it so other staff can continue to do so even without me also, I find the default superuser password has a habit of staying there unless I deal with it from the start
          "Over complicate" means trying to do such tjing like pwd change not over initial load of database data

          Another thing which you can exploit here: by change data.sql you can guarantee that such server will start with exact set of templates.
          All what you need is start clean server -> delete all templates -> import from xml files your templates -> dump database content to your data.sql.
          The same with predefined groups, actions, other users or preconfigured auth over LDAP/Kerb .. whatever.
          You can use such data.sql as you template/stamp.
          In other words you can use such data.sql stamp instead using CMDB to setup all necessary components/settinngs simplifying everything by only replace things like md5 hash or maybe few other things which should vary between deployed servers
          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
          https://kloczek.wordpress.com/
          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
          My zabbix templates https://github.com/kloczek/zabbix-templates

          Comment

          Working...