En tant qu’administrateur de plusieurs instances Weblogic, vous avez surement eu besoin d’utiliser l’outil de Scripting WLST pour automatiser quelques tâches d’administration et avoir quelques informations sur les instances utilisées ou sur le domaine Weblogic.
Afin de pouvoir automatiser ces tâches, vous serez amenés à écrire des scripts WLST. La sécurité de stockage des informations (utilisateur + mot de passe) se pose pleinement.
Ce tutoriel a pour but de vous montrer comment se connecter à l’interface WLST en évitant de spécifier vos coordonnées en clair.
Commencer par lancer le script wlst.sh comme suit :
cd /u01/oracle/weblogic_12.2.1.3/oracle_common/common/bin
./wlst.sh
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline> connect('weblogic','mot_de_passe','t3://192.168.160.128:8001')
Connecting to t3://192.168.160.128:8001 with userid weblogic …
Successfully connected to Admin Server "WLS-admin-mon_domain" that belongs to domain
"DOMAINE-WLS-mon_domain".
Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.
wls:/DOMAINE-WLS-mon_domain/serverConfig/>
Une fois connecté, utilisez la fonction storeUserConfig comme suit :
wls:/DOMAINE-WLS-mon_domain/serverConfig/>
storeUserConfig('/u01/oracle/AdminUserConfig','/u01/oracle/AdminUserKey')
Creating the key file can reduce the security of your system if it is not kept in a secured location after
it is created. Creating new key…
The username and password that were used for this WebLogic Server connection are stored in
/opt/oracle/AdminUserConfig and /opt/oracle/AdminUserKey.
wls:/DOMAINE-WLS-mon_domain/serverConfig/> exit()
Vous pouvez alors utiliser les deux fichiers générés pour vous connecter à l’interface WLST de la manière suivante :
wls:/offline>
connect(userConfigFile='/u01/oracle/AdminUserConfig',userKeyFile='/u01/oracle/AdminUserKey',url=
't3://192.168.160.128:8001')
Connecting to t3://192.168.160.128:8001 with userid weblogic …
Successfully connected to Admin Server "WLS-admin-mon_domain" that belongs to domain
"DOMAINE-WLS-mon_domain". Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead. wls:/DOMAINE-WLS-mon_domain/serverConfig/>