Forum Discussion
Brian_Gibson_30
Nimbostratus
Feb 17, 2017Programmatically adding users to local user DB
Is there a way to programmatically add users to the APM local user DB? I need to add about 150 users to it and manually doing it doesn't seem like a great process to me.
You can import a .csv b...
Feb 23, 2017
Probably not supported, not recommended and I'm not even sure if it even works, but the localdb data seems to be stored into the local mysql database. So one would think you can connect to it and alter some data...
[root@nielsvs-bigip:Active:Standalone] ~ cat test.sh
!/bin/bash
BACKUP_FILE="/var/apm/localdb/mysql_bkup.sql"
MYSQL_PW=`perl -MPassCrypt -nle \
'print PassCrypt::decrypt_password($_)' /var/db/mysqlpw`
MYSQL_QUERY="SHOW tables;"
MYSQL_QUERY2="SELECT * FROM auth_user;"
MYSQL_QUERY3="SELECT * FROM auth_user_details;"
MYSQL="/usr/bin/mysql -uroot --password=${MYSQL_PW} --database=f5authdb"
${MYSQL} -e "${MYSQL_QUERY}"
${MYSQL} -e "${MYSQL_QUERY2}"
${MYSQL} -e "${MYSQL_QUERY3}"
[root@nielsvs-bigip:Active:Standalone] ~
Output:
[root@nielsvs-bigip:Active:Standalone] ~ ./test.sh
+--------------------+
| Tables_in_f5authdb |
+--------------------+
| auth_user |
| auth_user_data |
| auth_user_details |
| mdm_device |
+--------------------+
+-------+-------+----------------------------+----------------------------------------+-------------+----------------+---------------+---------------+------------+--------------+--------- +-----------+------------+---------------+---------------------+
| uid | uname | instance | password | user_groups | login_failures | passwd_expire | lockout_start | ttl | dynamic_user | deleted | suspended | locked_out | change_passwd | last_modified |
+-------+-------+----------------------------+----------------------------------------+-------------+----------------+---------------+---------------+------------+--------------+---------+-----------+------------+---------------+---------------------+
| 20446 | user1 | /Common/db_idp_example.com | {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | | 0 | NULL | 0 | 1480444135 | 0 | 0 | 0 | 0 | 0 | 2016-11-29 19:28:55 |
| 19414 | user5 | /Common/db_idp_example.com | {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | | 0 | NULL | 0 | 1487451379 | 0 | 0 | 0 | 0 | 0 | 2017-02-18 21:56:19 |
| 57397 | user3 | /Common/db_idp_example.com | {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | group1 | 0 | NULL | 0 | 1487454844 | 0 | 0 | 0 | 0 | 0 | 2017-02-18 22:54:04 |
+-------+-------+----------------------------+----------------------------------------+-------------+----------------+---------------+---------------+------------+--------------+---------+-----------+------------+---------------+---------------------+
+-------+------------+-----------+--------------------------+---------------------+
| uid | first_name | last_name | email | last_modified |
+-------+------------+-----------+--------------------------+---------------------+
| 19414 | Plaap | plaap | plaap@example.com | 2017-02-18 21:56:19 |
| 20446 | John | Smith | john.smith@example.com | 2016-11-29 19:28:55 |
| 57397 | First Name | Last Name | email@example.com | 2017-02-18 22:54:04 |
+-------+------------+-----------+--------------------------+---------------------+
[root@nielsvs-bigip:Active:Standalone] ~
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
