Wednesday, June 19, 2013

convert a .pfx file to an Oracle Wallet

In case you got a .pfx file from your SSL certificate provider and you want to convert it to an Oracle Wallet follow the following simple procedure

Note : Make sure the .pfx file has the entire certificate chain + a private key

Rename the .pfx file to ewallet.p12
copy the ewallet.p12 to the final destination ( where you want to keep your oracle wallet) this is important since copying the wallet around once its done wont help

Launch the Oracle Wallet Manager
Click Wallet >> Open and point to the location where you have kept the ewallet.p12
Provide password if required
click Wallet >> AutoLogin
click Wallet >> Save

Your Oracle Wallet is now ready for use.....

Adding Test Users to Weblogics embedded LDAP

You may want to add Users in the DefaultAuthenticator that comes OOTB when Weblogic is installed for various reasons ( Providing access to Test teams or creating multiple users for performance testing etc)

Here is a simple method of creating those users

Navigate to the folder

E:\Oracle\Middleware\wlserver_10.3\server\bin

create a file with any name example addMyTestUsers.py

edit the file and add the following script to it and save ( note the script also adds the created users to a group someGroup )

****************************
connect ("admin","password","localhost:7001")
atnr=cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvider("DefaultAuthenticator")
users=['test1','test2','test3','test4','test5']
groups=['someGroup']
for user in users:
try:
atnr.createUser(user,'password','TestUser')
print user,': created'
except Exception, e:
print user,': exist'
for group in groups:
for user in users:
try:
atnr.addMemberToGroup(group,user)
print user,': add to group'
except Exception, e:
print user,': exist in group'

*******************************


Open a command prompt

Cd to E:\Oracle\Middleware\wlserver_10.3\server\bin
run the file setWLSEnv.cmd to set environment variables

then run the command

java weblogic.WLST addMyTestUsers.py

The script will add users that done already exist and associate them to a security group or multiple groups as per values provided

Add users to line: users=[‘ username here‘, …]
Add group names to line: groups =[‘group name here’,…]