add api user script
This commit is contained in:
parent
4b18880089
commit
511ce5f9fd
48
add_api_user.sh
Normal file
48
add_api_user.sh
Normal file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
ssh_user="admin"
|
||||
ssh_host="${ssh_user}@192.168.2.1"
|
||||
ssh_opts="-p 11422"
|
||||
|
||||
api_user="apiadmin"
|
||||
api_comment="api admin"
|
||||
|
||||
api_profile="api_ro"
|
||||
. util.sh # import ssh function after options are set
|
||||
|
||||
# set accprofile {string} Admin user access profile. size[35] - datasource(s): system.accprofile.name
|
||||
#
|
||||
# set schedule {string} Schedule name. size[35]
|
||||
# set cors-allow-origin {string} Value for Access-Control-Allow-Origin on API responses. Avoid using '*' if possible. size[269]
|
||||
# set peer-auth {enable | disable} Enable/disable peer authentication.
|
||||
# set peer-group {string} Peer group name. size[35]
|
||||
# config trusthost
|
||||
# edit {id}
|
||||
# # Trusthost.
|
||||
# set id {integer} Table ID. range[0-4294967295]
|
||||
# set type {ipv4-trusthost | ipv6-trusthost} Trusthost type.
|
||||
# ipv4-trusthost IPv4 trusthost.
|
||||
# ipv6-trusthost IPv6 trusthost.
|
||||
# set ipv4-trusthost {ipv4 classnet} IPv4 trusted host address.
|
||||
# set ipv6-trusthost {ipv6 prefix} IPv6 trusted host address.
|
||||
# next
|
||||
|
||||
fg_updatekey_script="
|
||||
execute batch start
|
||||
config system accprofile
|
||||
edit \"${api_profile}\"
|
||||
set sysgrp read
|
||||
set system-diagnostics disable
|
||||
end
|
||||
config system api-user
|
||||
edit \"${api_user}\"
|
||||
set comments \"${api_comment}\"
|
||||
set accprofile ${api_profile}
|
||||
end
|
||||
execute api-user generate-key \"${api_user}\"
|
||||
execute batch end
|
||||
execute batch lastlog
|
||||
"
|
||||
|
||||
run_ssh_script "${fg_updatekey_script}" | grep "New API"
|
Loading…
Reference in New Issue
Block a user