Thursday, May 28, 2015

Not able to Invoke GUI when running config.sh in weblogic/SOA/OEM installer

 Not able to Invoke GUI when running config.sh in weblogic/SOA/OEM  installer

Today i encountered a strange issue, I was trying to  launch the GUI installer

I have installed the Xming/Cygwin , and I was able to invoke the xclock successfully.

java -d64 -jar Oracle_WebLogic_Server_11gR1_10.3.6_Coherence_wls1036_generic.jar

java -d64 -jar wls1035_generic.jar
 

You can also enable logging which invoke the config.sh


config.sh -log=<path_to_a_file.log> -log_priority=trace
 

It was always going to console mode installation.

and it doesn't throw any error also.

The solution I found was the missing os libraries


A) As root, check for the packages as shown after installation to confirm availability:

$ rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n" | grep xorg-x11-utils
$ rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n" | grep libXtst





The following packages were not installed on the OS, which are required for installation and operation:

1.) libXtst-1.0.1-3.1
2.) xorg-x11-utils 


yum install libXtst
yum install xorg-x11-util


B) Please, remove the "${JVM_D64}" parameter from: config.sh file


JVM_ARGS="-Dprod.props.file='${WL_HOME}/.product.properties' -Dpython.cachedir=/tmp/cachedir ${JVM_D64} ${MEM_ARGS} ${CONFIG_JVM_ARGS}"

 
After I was able to invoke the GUI without any issue
 




 

Saturday, May 2, 2015



Debugging Weblogic authentication



Login information and group memberships (identity) often are centrally managed in Enterprises. Many systems use this information to, for example, achieve Single Sign On (SSO) functionality. Surprisingly, access to the Weblogic Server Console is often not centrally managed. This is caused by a common misconception that achieving centrally managed Weblogic Server Console authentication/authorization is difficult. As a result, often there are many local Weblogic Server users or everyone uses system users. Both workarounds have obvious disadvantages.



If you can obtain user and group information from a centrally managed authorization/authentication provider, you only need to manage those users there. As an additional benefit, the developers only need to keep track of a single password instead of a password per server. This increases security and developer productivity. Also it reduces operational cost. Your server landscape could for example look like the image below where minimal effort is required for user administration while still implementing a separation of concerns between development/test and acceptance/production. This separation is usually a requirement when different people are responsible for the environments and/or environments are on different network segments.

Scroll down to see the complete article


























An LDAP server is often used to manage identity. Usually there is already a managed directory service provider present in an organization such as Oracle Directory Server or Microsoft Active Directory which contains users, groups and login credentials. In Weblogic Server you can configure authentication providers to allow usage of such servers to allow access to the Weblogic Server Console.



The complexity of using an external LDAP provider as authenticator for Weblogic Server, is often overestimated, especially if a configuration does not work as expected. What can you do to find out what’s wrong? In this article I will provide suggestions on how authentication using an external LDAP server can be debugged in order to lower the bar to apply this configuration pattern.




Debugging authentication using Weblogic Server Console



The below decision tree can help with debugging configuration issues in a Weblogic Server. The steps are also described in the text below in more detail. The tree is specific to a configuration where you can login with users from the DefaultAuthenticator (Weblogic embedded LDAP server) and from an external authentication provider.








Because changes in authentication provider configuration usually require a server restart, a trial and error approach is not recommended.





ApacheDS



I will use ApacheDS as an example open source LDAP provider. This is not a provider for which a specific authenticator exists in Weblogic Server (such as for Oracle Directory Server or Microsoft Active Directory). That is why the general LDAPAuthenticator needs to be used.





Control flags and authentication provider order



The control flags and provider order determine the authentication behavior of Weblogic Server. If an authentication provider has the control flag REQUIRED, then every user needs to be present also in that authentication provider. This is the default setting for the DefaultAuthenticator. The DefaultAuthenticator uses the Weblogic Server embedded LDAP server. If you want to allow login of users which are only present in another authentication provider but still allow the users in the embedded LDAP to login, the DefaultAuthenticator and other authentication provider should have their control flag set to SUFFICIENT. Mind the order of the authentication providers. The LDAPAuthenticator cannot be the first authentication provider. More specific authentication providers do not have this limitation.







  

The LDAP queries



An important part in configuring Weblogic Server is setting the correct queries to determine the users and groups. A query is executed using a connection with a user which is specified as the Bind DN (distinguished name). This is usually a system user with administration privileges on the LDAP server. The query itself consists of a Base DN which defines which part of the LDAP server will be searched and the actual LDAP query. Bind DN, Base DN and query depend on your LDAP configuration and structure.



LDAP servers can use different patterns to identify members of groups. The Weblogic Internal LDAP server has its groups listed under the specific users using the wlsMemberOf attribute and uses so-called dynamic groups to determine group members. The default ApacheDS LDAP structure has the users listed as part of the group using the uniqueMember attribute (static groups). These 2 examples require different queries. You can use your favorite LDAP browser (for example Apache Directory Studio or JXplorer) to create and test your query before configuring it in Weblogic Server. Also carefully look at the default queries.





The GUID Attribute



In order to uniquely identify an LDAP object, the GUID (global universal identifier) attribute is used by Weblogic Server. This is an attribute available as part of every relevant LDAP object. Different LDAP servers use different default GUID attributes. If no default attribute is present, the entryUUID attribute can be used, because it should be available in every LDAP server (RFC4530).





Browse users and groups



The first thing to do after you have configured the queries and Weblogic Server has been restarted, is to check under your security realm if the users and groups from your newly created authentication provider are visible. Also open up a user and check the groups tab under that user since a different query is used to obtain groups for a specific user. If the groups cannot be fetched for the user, there is probably something wrong with the group query or with the defined GUID Attribute.





Try logging in



If the users and groups are visible, it is time for the final test. Try to login the Weblogic Server Console using a user within a group that is allowed (Monitor, Operator or Administrator). If the first login fails and the second works, then most likely you’ve neglected to set the GUID Attribute. Also mind that for Oracle SOA, the user also needs to have one or more of the application roles SOAMonitor, SOAAdmin or SOAOperator in order for the Enterprise Manager Fusion Middleware Control to function properly.

If it works, you’re done. If it doesn’t work, read on.





Debugging authentication using log files



Authentication debug flag

The LDAP authentication can be debugged by setting the debug flag for DebugSecurityAtn. This can be done by clicking the server in Weblogic Server Console, go to the debug tab and browse the relevant setting under weblogic, security, atn.



You can now see a lot of security related information in the server logfile such as connection issues, login attempts and LDAP queries. Below are some examples for the DefaultAuthenticator and for an external LDAP server accessed with the LDAPAuthenticator.




DefaultAuthenticator



Below you can see the DefaultAuthenticator is used (Weblogic Internal LDAP v2 server). The user dummy is not found. You can also see the LDAP query which is being executed to find the user.



<BEA-000000> <authenticate user:dummy>

<BEA-000000> <getConnection return conn:LDAPConnection { ldapVersion:2 bindDN:""}>

<BEA-000000> <getDNForUser search("ou=people,ou=myrealm,dc=DefaultDomain", "(&(uid=dummy)(objectclass=person))", base DN & below)>

<BEA-000000> <DN for user dummy: null>

<BEA-000000> <returnConnection conn:LDAPConnection { ldapVersion:2 bindDN:""}>

<BEA-000000> <getConnection return conn:LDAPConnection { ldapVersion:2 bindDN:""}>

<BEA-000000> <DN for user dummy: _NOT_EXIST_>

<BEA-000000> <returnConnection conn:LDAPConnection { ldapVersion:2 bindDN:""}>

<BEA-000000> <javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User dummy denied.



In the below example, you can see the user weblogic is found but an incorrect password was used.



<BEA-000000> <authenticate user:weblogic with DN:uid=weblogic,ou=people,ou=myrealm,dc=DefaultDomain>

<BEA-000000> <getConnection return conn:LDAPConnection { ldapVersion:2 bindDN:""}>

<BEA-000000> <authentication failed 49>

<BEA-000000> <returnConnection conn:LDAPConnection { ldapVersion:2 bindDN:""}>

<BEA-000000> <javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User weblogic denied





LDAPAuthenticator



In the below examples, the LDAPAuthenticator is used to access an external ApacheDS LDAP server. Below, the LDAP server cannot be accessed.



<BEA-000000> <authenticate user:maarten>

<BEA-000000> <new LDAP connection to host localhost port 10389 use local connection is false>

<BEA-000000> <Connecting to host=localhost, port=10389>

<BEA-000000> <connection failed netscape.ldap.LDAPException: Permission denied: connect (91); Cannot connect to the LDAP server>



The below example is a bit more difficult.



<BEA-000000> <authenticate user:maarten>

<BEA-000000> <getConnection return conn:LDAPConnection {ldaps://localhost:10389 ldapVersion:3 bindDN:"uid=admin,ou=system"}>

<BEA-000000> <getDNForUser search("ou=users,ou=system", "(&(uid=maarten)(objectclass=person))", base DN & below)>

<BEA-000000> <returnConnection conn:LDAPConnection {ldaps://localhost:10389 ldapVersion:3 bindDN:"uid=admin,ou=system"}>

<BEA-000000> <java.lang.NullPointerException at weblogic.security.providers.authentication.LDAPAtnDelegate.getDNForUser(LDAPAtnDelegate.java:3861)



After a retry with the same credentials login succeeded. The cause is related to the GUID Attribute setting. If left empty, this error occurs. After disabling the LDAP cache, the error also does not occur anymore, hinting to usage of the GUID Attribute by the LDAP cache.





Conclusions



As shown in this article, there are several things to mind when configuring an external LDAP server for authentication to the Weblogic Server Console. Debugging issues however, as shown, is not difficult. In this article I have provided a decision tree, important background information considering settings and some examples to help you with the most common errors. The benefits of centrally managing users for the Weblogic Server Console are obvious. You can dramatically reduce the amounts of users which need to be managed. This has security benefits, increases developer productivity and reduces operational cost. Below are several suggestions to pay attention to when configuring Weblogic Server to use an external LDAP provider.

  • Every security provider configuration change, requires a Weblogic Server restart.
  • The Weblogic Server logs shows the LDAP queries executed. You can test these same queries with an external LDAP client such as Apache Directory Studio. Testing the queries first might reduce the number of restarts required to get a configuration working.
  • Pay special attention to the control flags. If the DefaultAuthenticator is set to REQUIRED (the default setting), setting another LDAP provider to SUFFICIENT, will not allow users to login unless they are also present in the DefaultAuthenticator. When using an external LDAP and the DefaultAuthenticator + external LDAP authenticator have their control flag set to SUFFICIENT and a user is not present in the DefaultAuthenticator, the external LDAP is queried.
  • When using an external LDAP server using the LDAPAuthenticator as the first authentication provider, Weblogic Server will not start anymore. This can be fixed by editing the config.xml file and changing the order of the providers. When using a more specific LDAPAuthenticator (when available for your LDAP server) this problem does not occur.
  • If you need to login twice before authentication is successful, check the GUID Attribute in the provider specific properties of the LDAPAuthenticator
  • Check which LDAP server is queried. The embedded LDAP server can easily be confused with an external server.



For more specific information and background, you can check out several articles on the AMIS Technology blog site concerning this topic: https://technology.amis.nl/?s=ldap



References

Fusion Middleware Securing Oracle WebLogic Server: Configuring Authentication Providers


Oracle® Fusion Middleware Administrator's Guide for Oracle SOA Suite and Oracle Business Process Management Suite. Roles and Privileges for Oracle SOA Suite Users in Oracle Enterprise Manager


Weblogic Server Fails to Start when Configured for LDAP Authentication (Doc ID 1331981.1)


Apache Directory Studio

Node Manager Basics and Setup



about Node Manager


Node Manager is an important utility when running WebLogic in a production environment. Most people pay little attention to the Node Manager, but when problem arises, it is a little bit late to figure out what Node Manager is and what it does.
This article is not a full introduction to Node Manager, but will describe some best practices for common real life situations and issues, and share some tips and tricks gathered over the years.

If you would like a full introduction to Node Manager first, with all the nice diagrams showing how everything is connected, then you should look at the official documentation, which by the way are getting pretty good, before coming back to read the rest of this article -  http://docs.oracle.com/middleware/1213/wls/NODEM/overview.htm#NODEM112


So, what is Node Manager?

Node Manager is a utility used to start, stop and restart WebLogic and Coherence servers on the host Node Manager is installed. Since you could connect to Node Manager from a remote server, you will use Node Manager on the remote server as a tool to remotely start and stop a WebLogic instance.

There are two version of Node Manager, the Java version and the script based version. Unless you have very specific requirements, use the Java version, which also happens to be the one that most people think of when they talk about Node Manager. This article will be about the Java version, but if you want to know more about the difference of the two versions, have a look at the official documentation - http://docs.oracle.com/middleware/1213/wls/NODEM/overview.htm#NODEM114


Per host vs per domain Node Manager

Up until WebLogic 12.1.2 the default was one Node Manager per host. It was possible to do it otherwise, but it was not documented very well.

From 12.1.2 the default is one Node Manager per domain, and the configuration and logs are now located under $DOMAIN_HOME/nodemanager instead of under wlserver_10.3/common/nodemanager
It is still possible to have one Node Manager per host, for those who prefers that.

If you are using Node Manager for an earlier release (before 12.1.2) or just want to stick with one Node Manager per host, you should consider moving the configuration and log files away from wlserver_10.3/common/nodemanger and have them outside the $ORACLE_HOME. There are several reasons for that, one important reason is to keep configuration files away from the binaries, so the configuration is kept in case an upgrade overwrites everything under wlserver_10.3/common/nodemanager. Another important reason is that you want to have logfiles in a location that you monitor for disk space, since logfiles tends to grow, and you might not have taken that into consideration when deciding how much space you needed for the installation.

One special case where you actually needed more than one Node Manager for a host in 11g was when you followed the Enterprise Deployment Guide (EDG) for SOA. In an enterprise setup, the Administration Server is installed in a different $DOMAIN_HOME than the managed servers. This makes it easier to start the Administration Server on another host in case of a host failure (Administration Server domain directory should be on a SAN or a shared disk).

The reason for using one Node Manager for the Administration Server domain directory and one for the Managed Servers domain directory is that the nodemanager.domains file in 11g could only can have one path per domain.

In 12c there is possible to have one primary domain path and several alternate domain paths for each domain in nodemanager.domains, so it should be enough with one Node Manager per domain from 12.1.3 http://docs.oracle.com/middleware/1213/wls/NODEM/java_nodemgr.htm#NODEM163

Since one Node Manager per domain could mean several Node Manager instances on one host, every Node Manager instance on that host must have a unique ip:port combination.


How to start Node Manager?

The simple answer is to run startNodeManager.sh from $DOMAIN_HOME/bin, but except for testing, you should not do that.

Node Manager should be started as a system service when the server boots, so a startup script is needed. In the WebLogic 12.1.3 documentation there are init.d and xinetd scripts provided for Linux - http://docs.oracle.com/middleware/1213/wls/NODEM/java_nodemgr.htm#NODEM247

For Windows there is the installNodeMgrSvc.cmd script included in the $DOMAIN_HOME/bin directory.

Node Manager will run as the user who started it. When Node Manager starts a WebLogic instance, either an Administration Server or a Managed Server, the WebLogic instance will run as the same user as the user who runs Node Manager.

There is currently some flaws in the documentation, both in the init.d script for Linux and in the description of installNodeMgrSvc.cmd for Windows. Oracle has been notified, and the documentation should be updated soon.

By using the init.d script from the documentation, Node Manager will run as root, and by starting it as a Windows service, it will run as System.

Running WebLogic as root/System could be a security risk, and when you are going to patch WebLogic, you will most likely do that as the user you installed WebLogic as. However, since some files have changed ownership/rights to root/System, you might not be able to patch without a lot of hassle.

On Linux there is a post-bind function in WebLogic, so it is possible to configure WebLogic to change the user from root to something less hazardous, but this is not possible in Windows.

So, what should we do?

For Linux, make sure Node Manager is started as a non-root user, by changing the line in the init.d file in the documentation from
$PROGRAM_START >> $OUT_FILE 2>&1  &
to
su -c $NMUSER $PROGRAM_START >> $OUT_FILE 2>&1  &

The variable NMUSER could be declared somewhere between
#### BEGIN CUSTOM ENV
and
#### END CUSTOM ENV
as
NMUSER=oracle

Replace oracle with the user you want to run Node Manager and WebLogic.

For Windows you could go to services and properties for the WebLogicNodeManager service. On the “Log On” tab, select “This account” and select the user account that you want to run Node Manager (and WebLogic) as.





Username and password

To log into Node Manager, you have to use a username and password. Unfortunately, the default username is weblogic, which also happens to be the default username for the WebLogic Administration server. However, these two weblogic users are not the same, it is just a coincident that their names are the same. There is no relation between those two user accounts. But since they have the same name, many people think it is the same account (and I don’t blame them, how are you supposed to know it's not), which might lead to problems when changing password, since you then have changed password for just one of the accounts, not both. And when you try the new password on the “wrong” weblogic account, you won't be allowed access. You could end up spending the better part of the night to figure out what is wrong with your password.

The recommendation is to use a different username for the Node Manager account, I often use the name nodemanager.


To avoid any extra confusion, the operating system user which Node Manager runs as, has nothing to do with which user you use to log into Node Manager.


Verify connection between Administration Server and Node Manager

To verify that the Administration Server is able to communicate with Node Manager, check the Administration Console


If status is not Reachable, then username/password could be wrong, or SSL is enabled on one side and not the other, or if Node Manager is on a remote host, there could be network or firewall issues.


Create an encrypted credentials file

When using scripts to connect to Node Manager, you have to log in. Passing credentials in clear text is not a good idea, since it often also means that the credentials are available in clear text in script files or in a property file.

Node Manager support the use of an encrypted credential file. You should still protect this file, but it is better than clear text.

If you follow this advice, no one should need to log into Node Manager by providing the password by hand. Which means that there is no reason to have a password that is easy to remember, or easy to type. Make the password long and random, you will only type it a few times (to create the credentials file).

Creating the encrypted credential file is different in 11g and 12c. The 11g method still works in 12c, but this method is deprecated and might stop working.

11g method - source setDomainEnv.sh before running this command to get the paths correctly (everything on one line)

$ java weblogic.Admin -username nodemanager -userconfigfile /u01/app/oracle/config/nmUserFile -userkeyfile /u01/app/oracle/config/nmKeyFile STOREUSERCONFIG

12c method - source setDomainEnv.sh before running this command to get the paths correctly

$ java weblogic.WLST
wls:/offline> nmConnect( 'nodemanager','welcome1','localhost',5556,'mydomain', '/u01/ config/user_projects/domains/mydomain', 'plain')
wls:/mydomain/serverConfig> storeUserConfig( '/u01/app/oracle/config/nmUserFile','/u01/app/oracle/config/nmKeyFile', 'true')


Usage of the encrypted credentials file

As in the 12c method above, nmConnect usually takes a series of literal parameters. But when you are using an encrypted credential file, you don’t want to use literal parameters, at least not for username/password. The alternative nmConnect format is below:

nmConnect(userConfigFile=nmUserFile, userKeyFile=nmKeyFile, host=nmHost, port=nmPort, domainName=domain, domainDir=domainPath, nmType=nmType)

In this example, all parameters are replaced with variables. Of course, you could still have literal values, but using variables in scripts are often considered best practice.
Calling the WLST scripts with -loadProperties <path to properties file>, you have access to variables from the property file directly in your WLST scripts. An example properties file is below:

adminUrl=t3://wls12c.dev.sysco.no:7001
nmHost=wls12c.dev.sysco.no
nmPort=5556
nmUserFile=/u01/app/oracle/config/nmUserFile
nmKeyFile=/u01/app/oracle/config/nmKeyFile
nmType=plain
domain=mydomain
domainPath=/u01/config/user_projects/domains/mydomain


Change password

Even though very few needs to know the Node Manager password if you use the encrypted credential file, you should still change the Node Manager password from time to time.

The easiest and recommended way is to use the Administration Console to change the password.

It is possible, but not recommended, to change the password directly in nm_password.properties. If you do that, you have to restart Node Manager after changing the password. If you change the username and/or password from the Administration Console, you do not have to restart Node Manager.

Remember, after you have changed the password, you have to regenerate the nmUserFile with the new password (just follow the instructions for creating a new credential file).

http://docs.oracle.com/cloud/latest/fmw121300/NODEM/java_nodemgr.htm#NODEM161


How to add a new Node Managers (hosts)

The recommended way to add a new host, is to use the pack command on the domain on an existing server and do an unpack on the new server.
It is also possible to use the WLST command nmEnroll() to add the new host to the domain.


Some important files

nodemanager.properties
nodemanager.properties contains most of the configuration for Node Manager. The file is created first time Node Manager is started.

StartScriptEnabled=true tells Node Manager to use the start script to start WebLogic. By default, startWeblogic.sh (or .cmd) is used, unless StartScriptName is set to something else.

Be careful about StopScript, it might not be what you think. It is not the opposite of StartScript, a script used to stop the WebLogic instance. It is a cleanup script, which will be called after the WebLogic instance has stopped.

ListenAddress and ListenPort are important when running more than one Node Manager on a server. Every instance of Node Manager needs an unique ListenAddress:ListenPort combination. If everyone tries to use the default, only the first instance to start will succeed, the rest will fail.

SecureListener is default set to true, which means Node Manager can only be access by using SSL. If you do not have enabled SSL on the Administration Server, you must set SecureListener=false (and restart Node Manager if it is running).

If you think using SSL is a good idea (which it is), then you should replace the DemoTrust certificates with new ones (every installation are shipped the same DemoTrust certificates, so they are not secure at all).

Be aware that several property names are deprecated, but still works in 12.1.3, and that some of the new ones introduced in 12.1.3 is not yet supported in WLST offline mode and not yet supported by pack/unpack. Examples of deprecated property names are StartScriptEnabled and StartScriptName, from 12.1.3 use weblogic.StartScriptEnabled and weblogic.StartScriptName instead.

Not all possible properties are in the nodemanager.properties file, for a complete list of Node Manager properties, see the documentation:

nm_password.properties
Encrypted Node Manager username and password file. Used to authenticate connection between Node Manager and clients (i.e., Administration Server, when Administration Server connects to Node Manager to start or stop a Managed Server, and when a WLST script connects to Node Manager to do some tasks, i.e., start or stop a Managed Server).

The Configuration Wizard puts the Node Manager username and password for the initial connection into nm_password.properties on the local server. To get it distributed to other servers, you have to use the WLST command nmEnroll(). nmEnroll() will either create a new nm_password.properties file, it if does not exists, or update an exisiting nm_password.properties file.

If you change the nm_password.properties manually, which is not recommended by the way, you have to restart Node Manager. If you change the username and/or password from the Administration Console, you do not have to restart Node Manager.


nodemanager.domains

10.3.6
domain-name=domain-directory

12.1.3
domainName=primaryDomainPath;alternateDomainPath1;alternateDomainPath2

<servername>.out logfiles
Generated by Node Manager, located together with the Administration Server or Managed Servers .log files.
No daily / by size rotation (at least not in 11g), so this file could be big. Rotated when the server restarts.


Summary

Node Manager is a very useful utility, and although you do not have to use Node Manager, it might do the operation of WebLogic somewhat easier.
Best practices for starting and stopping WebLogic instances are using WLST scripts together with Node Manager, and some high availability functions, like whole server migration, requires Node Manager.

Node Manager is not very difficult, but like any other software, it helps to know a little about it. I hope that this article has given you some more information of Node Manager, and at least has given you some new pointers to start searching from next time you encounter strange problems while starting or stopping your WebLogic servers.