首页 > 解决方案 > Keycloak: Admin-cli Add SMTP server details?

问题描述

In our keycloak we have written admin-cli command to make things smooth after keycloak bought up .We will create some basic Realm/user/group and other details from the help of admin-cli .

Now we want to add the SMTP server details through admin-cli . How can be achieve this ?

标签: keycloak

解决方案


Ok at last too many hit and try i found the solution . Here is the details how to add the SMTP server details via admin-cli

First Step Enable HTTPS(As in our case keycloak running on HTTPS)

/opt/keycloak/bin/kcadm.sh config truststore --trustpass keycloak  /opt/keycloak/security/ssl/keycloak.jks

Second Step Login with client admin-cli

/opt/keycloak/bin/kcadm.sh config credentials --server https://{{keycloak_server_IP}}:{{keycloak_port}}/auth --realm master --user admin --password admin --client admin-cli

If realm not created create it via this

/opt/keycloak/bin/kcadm.sh create realms -s realm=SURE -s enabled=true

and then run below command

/opt/keycloak/bin/kcadm.sh update realms/CRUE_Realm -x -s 'smtpServer.host=Your Host Name' -s 'smtpServer.from=email@somemail.com' -s 'smtpServer.fromDisplayName=Mail Support' -s 'smtpServer.auth=false' -s 'smtpServer.ssl=false' 

推荐阅读