Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 974
  • Last Modified:

WebSphere Server v6.1 in Rational Application Developer 7

Hello,

  I'm wanting to know if anyone knows if there is a way to update a J2C Authentication element for a server/profile without actually having to start the server first.
0
Taplar
Asked:
Taplar
  • 5
  • 3
1 Solution
 
HonorGodCommented:
Please define what you mean by "update a J2C Authentication element"...
0
 
HonorGodCommented:
It may be possible using scripting.  But I would need more information before being able to say exactly how.

wsadmin tool:
  http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/rxml_commandline.html

Scripting the application serving environment
  http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/welc6topscripting.html
0
 
TaplarAuthor Commented:
Update the password for the element.  I'm running it in RAD 7 and I have to start the server, run the admin console, navigate to the J2C nodes and update the password, and then restart the server.  Where as older versions of WAS you could update the password and then start your server.  I want to be able to update the password without starting the server.  I found the file which the password is stored in for the node, but it was of course an encrypted form of it so I couldn't just update it there.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
HonorGodCommented:
I might be able to help if you can tell me the exact sequence of actions used on the admin console to make this change.

I presume that after making the change, you have to use the "save" link.
If, before you do this, you use the "Review" link to display the xml files that will get changed.  Then, before you "save", open a command prompt, and "cd" to the directory containing the file(s) to be modified, and make a backup copy.

Then, do the save, and "compare" the before and after files, and let me know what tags & attributes changed.

Does that make sense?
0
 
TaplarAuthor Commented:
File Differences:
1)<authDataEntries> changed with a new password hash in the password attribute.

Actions in Admin Console:
1) Clicked left menu option "Security" to expand tree and clicked tree link "Secure administration, applications, and infrastructure"
2) In right window, in the area labeled "Authentication", clicked the plus box next to "Java Authentication and Authorization Service" and clicked tree link "J2C authentication data".
3) From the resulting list, clicked the Alias of which I wanted to update the password for.
4) Change password, Click Apply and then saved.
0
 
HonorGodCommented:
Yes...

copy the attached file to your WebSphere\AppServer\bin directory as showAsDict.py
open a command prompt
"cd" to the WebSphere AppServer bin directory
e.g., "cd \IBM\WebSphere\AppServer\bin
execute the wsadmin utility using something like:

wsadmin -conntype none -lang jython -profile showAsDict.py

At the wsadmin command prompt, enter:

print AdminConfig.list( 'Security' )

the output should be something like:

(cells/<nodeName>|security.xml#Security_1).  Assign this configID to a variable using:

security = AdminConfig.list( 'Security' )

Use the showAsDict() function to get easy access to the information using:

secDict = showAsDict( security )

The attribute in which we are interested is 'authDataEntries', so, we can see how many of these that we have:

print secDict[ 'authDataEntries' ]

on my system, I only have 1, so what I see is a single configID within square brackets.  To extract this configID I only need to:

authdata = secDict[ 'authDataEntries' ][ 1:-1 ]

Note: If you have more than one, and need my help with how to get the "right" one, please, let me know...

Now, I can display the attributes of the authentication data entry simply by using:

print AdminConfig.show( authdata )

and I can change the password value using:

AdminConfig.modify( authdata, '[[ password myNewPwd]]' )

and saving the changes:

AdminConfig.save()

and exiting wsadmin:

quit
--------------------------------------------------------------------------
So, the unannotated wsadmin commands that need to be issued, and which could be put into a Jython script file, if you want are:
--------------------------------------------------------------------------

security = AdminConfig.list( 'Security' )
secDict = showAsDict( security )
authdata = secDict[ 'authDataEntries' ][ 1:-1 ]
AdminConfig.modify( authdata, '[[ password myNewPwd]]' )
AdminConfig.save()



showAsDict.py.txt
0
 
TaplarAuthor Commented:
I greatly appreciated this solution.  I wrote a function to do the commands so I could just execute the function with my new desired password and it updated it and everything.  Shared it with some other people on my team who also disliked the updation process as was.  Again, tyvm.
0
 
HonorGodCommented:
You are very welcome.  I'm glad to have been able to help.

Thanks for the grade & points.

Good luck & have a great day.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now