Friday, November 30, 2012

When configuring Secure Vault with WSO2 products : Error initializing Cipher

You can configure Secure Vault with WSO2 ESB (or any other Carbon product) to secure the data in the configuration files such as
 - User Store passwords
 - Database passwords           etc.
You may get this work completely if you follow this blog on How to configure Secure Vault in WSO2 Products.
If you try with a custom keystore, you might encounter the following error for certain instances.
Exception in thread "main" org.wso2.ciphertool.CipherToolException: Error initializing Cipher
at org.wso2.ciphertool.CipherTool.handleException(CipherTool.java:861)
at org.wso2.ciphertool.CipherTool.initCipher(CipherTool.java:202)
at org.wso2.ciphertool.CipherTool.main(CipherTool.java:80)
Caused by: java.security.InvalidKeyException: Wrong key usage
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at org.wso2.ciphertool.CipherTool.initCipher(CipherTool.java:200)
... 1 more
Then you can analyze the public certificates of the two jks's  - In default wso2carbon.jks, the KeyUsage is
KeyUsage [
  DigitalSignature
  Non_repudiation
  Key_Encipherment
  Data_Encipherment
]
 - In the custom .jks, the KeyUsage is
KeyUsage [
  DigitalSignature
  Key_Encipherment
]
Since the custom key store's certificate does not have 'Data_Encipherment' it can't use the Ciphertool and encrypt data for secure vault. So they may have to generate a new key store with at least a Self signed certificate. 

Thursday, August 30, 2012

Monitor Stats of Carbon 3.2.x products with WSO2 BAM2

Configuring WSO2 ESB Server with Data Publishers
  1. Download WSO2 Enterprise Service Bus 4.0.2. Unzip the distribution to your preferred location. This directory will be referred as ESB_HOME.
  2. Remove the following jar from ESB_HOME/repository/components/plugins directory.
org.wso2.carbon.statistics-3.2.2.jar

  1. Place the following set of jars into ESB_HOME/repository/components/dropins directory. These jars will act as data publishers of WSO2 ESB.
    1. gson-2.1.jar
    2. org.wso2.carbon.bam.service.data.publisher.ui-3.2.3.jar
    3. libthrift-0.7.wso2v1.jar   
    4. org.wso2.carbon.bam.services.stub-3.2.3.jar
    5. org.wso2.carbon.bam.activity.mediation.data.publisher.stub-3.2.3.jar
    6. org.wso2.carbon.eventbridge.agent.thrift-3.2.3.jar
    7. org.wso2.carbon.bam.data.publisher.util-3.2.3.jar
    8. org.wso2.carbon.eventbridge.commons-3.2.3.jar
    9. org.wso2.carbon.bam.mediationstats.data.publisher.stub-3.2.3.jar
    10. org.wso2.carbon.eventbridge.commons.thrift-3.2.3.jar
    11. org.wso2.carbon.bam.service.data.publisher-3.2.3.jar
    12. org.wso2.carbon.statistics-3.2.4.jar
    13. org.wso2.carbon.bam.service.data.publisher.stub-3.2.3.jar
    14. org.wso2.carbon.utils-3.2.3.jar
The above jars can be downloaded from the FTP Location

  1. Start up the WSO2 AS with the following command from the ESB_HOME/bin directory.
sh wso2server.sh
  1. Log into the management console with the credentials. Go to “Configure” tab. You will see a new feature has been listed in the menu named “Service Data Publishing”. When you clicked on the the feature, the UI will be as follows.


  1. Check the “Enable Service stats” check box under “Service Configuration”.
  2. Specify the Stream Definition Configuration parameters as preferred.
  3. Specify the “BAM URL” under “BAM Credential” in the following format.
tcp://<ip_address>:7611 (eg:  tcp://10.10.12.79:7611)

  1. Click on “Update”.

PS: Similarly, you can configure the other carbon server nodes as well (eg: WSO2 BPS, WSO2 DSS and WSO2 AS)




Configure Standalone WSO2 BAM and Monitor Data

  1. Change the port offset of WSO2 BAM server, so that it will not get port clashes with earlier configured WSO2 ESB.
Change the <Offset> parameter in carbon.xml file that resides in BAM_HOME/repository/conf directory.
  1. Start up the server with the following command from the BAM_HOME/bin directory.
sh wso2server.sh
  1. Invoke the service/s deployed in WSO2 ESB.
  2. Login to the WSO2 BAM Management Console. Go to “Main” tab --> “Manage” menu --> “Cassandra Explorer” --> “Connect to Cluster”.
Provide the following inputs
Connection URL: localhost:9160
Username: admin
Password: admin
Click on “Connect”.
  1. This will list the “Keyspaces”. Analyze the details of the respective Stream Name  under  “EVENT_KS” keyspace. A sample record will be as follows.
With these details, create a BAM Archive package and deploy as a “BAM Toolbox”.

  1. Create a Toolbox that contains the following components.
    1. Database script
    2. Gadget XMLs
    3. Jaggery scripts
The Toolbox should be packaged to a “.bar” package. The sample Toolbox can be found from the FTP location

  1. Deploy the Toolbox from “Main” tab --> “Manage” menu --> “BAM Toolbox” --> “Add” from the WSO2 BAM management console.

  1. From the Custom Toolbox table, browse for the created .bar package and hit on “Deploy”.
  2. Until the complete deployment, the status of the package will be shown as “Awaiting to Deploy”.

  1. Refresh the page until the status changes to “Deployed”.

  1. Go to “Main” tab --> “Manage” menu --> “Analytics” --> “List Scripts”.
  2. Click on “Edit”.

  1. This will open up the Script Editor and it will show the Database script that we have included in the deployed .bar package. Click on “Run”.

  1. With the successful execution of the script, it will show up the Results in the “Script Results” section below the “Script” editor section.
  2. Go to “Main” tab --> “Dashboard” menu --> “BAM Dashboard”. The deployed gadgets on the dashboard will be shown as follows.

Tuesday, August 28, 2012

Authentication on a deployed Web App??

Enterprises use Java Web Applications for various requirements. Often these applications may require to be implemented with access control and authentication as an organization policy. 
In the provided article, I have showed how WSO2 Application Server acts as a deployment container for a web application and authenticate the hosted application against a preferred User Store. Furthermore, the write-up focuses on enforcing secure connections via HTTPS enablement on the Web Application.

Saturday, October 1, 2011

Process Automation Facet in WSO2 BPS, Mechanizes Human Interaction


Every heterogeneous business revolves around tasks that need human interactions. There are computerized procedures that execute much of these bulky tasks. Still they have to be incorporated with human communications. In a business process flow, there are multiple tasks performed by multiple Human Roles and Human Users. Some need to be synchronized, while some needs the pipeline implementation.

For an instance, consider Tasks A and B and Human Roles X and Y that would be completed synchronously. Task A will be accomplished by Human Role X. For the invoke of next task, Task B in line which will be handled by Human Role Y needs a trigger after the completion of Task A. This activator should be prompted for the particular Role Y; not for the Task B.  
WS-BPEL standards facilitated the integration of Human Interaction onto the Process flow. This has been demonstrated by a sample implemented for the WSO2 Product Pack Release Process Automation flow. 

Existing Work Flow of Product Release Process

Build Manager is a person who triggers this process at first place. A build manager can play any role within any product team. He is solely responsible for building products for testing. In the milestones that development teams come across routinely, the build manager builds the products and releases the built pack for the QA for testing. 
Once the issues are being tracked in the product, those are reported and assigned to a developer to resolve. When the issues are fixed by the assignees and after thorough sessions of testing, those products are released as Release Candidates (RC). These RCs too are built by Build Manager and notifications are sent through mails to Carbon – Dev. If they come across any more issues or bugs, then again they are fixed and build the packs again. There can be versions of RCs like RC1, RC2 etc. These package builds are being uploaded to a location where accessible via web. This is followed by checking published packs which includes, ensuring that the binaries are functioning appropriately and completing preparation of documentation and release notes. Then a notification is sent to the relevant groups informing that the particular RC is equipped for the release. 
Then the product managers download the packs and sign them using their private key and upload the signature in a separate location different from the RC hosting site. When that task is completed, the infrastructure people upload the RCs to the relevant correct server where all the finalized releases are maintained. 
Subsequently Oxygen Tank (OT) staff takes up the task of creating a page for the newly done RC and publish it on OT and host the pack there as showed in [1].
Ultimately the Product Release Process comes to an end when the release notes are sent to the relevant mailing lists and forums and blogs are properly updated.
 
Automated Product Release Process

Currently no means of automation is involved with this Product Release Process. Synchronization issues and tracking issues engrossed in the manual release process, will be easily resolved by this automation initiative making the process flow less complicated.
The process is triggered or initialized when an RC is being finalized for the release by the Build Manager. Then the normal work flow will be followed and tasks will be assigned to various members. There will be a “TASK” list for each party who is involved with the process which will display the tasks that have been assigned to each ‘User Role’. This has become a convenient and efficient way of tracking the tasks that takes place during the process. Even the bottle necks of the process, the current progress etc. too can be identified without much difficulty through this system. 
Once a member finishes a task, the system generates a notification saying that the task is ‘COMPLETED’ and the task next in-line will be triggered for the relevant User Role with the ‘READY’ tag. Then all the synchronizations take place and the relevant places get updated appropriately with the proper notices. 

The detailed configuration for Human Task related process automation will be posted soon...

References

Tuesday, September 20, 2011

New Angle to look at SOA...

--- essence from Ganesh Prasad's Practical SOA 

Among numerous trends that has struck the IT industry, SOA holds an important place. Service Oriented Architecture has been a buzz word, for a certain period of time. Most of the enterprises and businesses proudly announce that they "MOVE to SOA"; or their "Business is SOA compliant". But when we take a look at their implementation, still it resides in the complex, spaghetti kind of set up. This complexity and non SOA existence can majorly cause
  • performance drawbacks
  • single point of failure
 If a proper SOA implementation has been executed, it ideally should have
  • loosely coupled components
  • good governance
  • re-usability of components
In a proper SOA architecture, there are 3 main lego blocks namely
  • Service Container
  • Message Broker
  • Process Coordinator 

Service container - Holds the service logic (eg: WSO2 AS)
Process Coordinator - Run time / dynamic process evaluations based on state is handled here. (eg: WSO2 BPS)
Broker - Acts as an adapter, mediator and transformer. Sits in between two applications perform the tasks. (eg: WSO2 ESB)

In any kind of complex deployment environment, first it should be clearly identified what is needed where, out of the above 3 main components.
When the coarse grain analysis is over, in the fine grain analysis, supporting SOA elements such as Rule components, Data services components, Presentation components, Governance components, Registry/repository components etc. can be identified and then deploy the relevant systems appropriately. 

SOA is NOT EASY. But SIMPLE. So plan well & handle with care.

Monday, September 5, 2011

WSO2Con 2011 - Hub of Expertise, Experience and Knowledge

All are keen; lots of enthusiasm; late night hours; ideas coming from every nook and corner; constant follow ups - sync ups; from the topmost head of the office to all the colleagues and subordinates and even the machinery are busy; focused on one main thing. WSO2Con 2011, the BIGGEST IT Conference in Sri Lanka is being held for the second consecutive time with splendor and glamour.

As almost all the WSO2ers too, I am so excited to be a part of this Gala event, rather to be an active participant this time. Because by the time that the last year's WSO2Con 2010 was happening, I was just a mere spectator/ audience there because I was a 'just joined' to WSO2 and had no clue at all what were there around. 

Things started with I getting involved with Undergraduate Registration for the Con. Having a round of lengthy calls with all the Heads of the local and foreign Universities to pass the SPECIAL STUDENT OFFER message, mailing e-flyers around and visiting all the universities to distribute promotional printed material was an enjoyable experience indeed. 
And now looking forward to execute the selection process on the 120+ undergrad registrants and select the TOP 50 who will be lucky participants to witness and be a part of this event. 

Indeed one should be lucky to witness this event because this will have an eminent set of key note speakers from enterprise giants such as Dr C. Mohan from IBM  (Former IBM India Chief Scientist), Sastry Malladi form eBay (distinguished Architect), Gregor Hohpe from Google (Engineer). Also another 20+ speakers who deal with immense industry know how will share their thoughts about the industry trends, customer experiences with WSO2 and expertise with the audience. 

The event which comprise of 3 conference days and 2 tutorial days will be a spring of knowledge to the participants. The registrants have the choice of selecting the speech and tutorial sessions according to their interest out of the multiple available tracks. Have a look at the program line up. 


This time the Conference will be from September 12th - 16th at Waters Edge, Sri Lanka, one of the picturesque locations which is enriched with natural beauty of Sri Lanka. 



Log in to WSO2Con 2011 page and register. Still you are not late to get hit from the IT storm of Sri Lanka. 
See you there!!!

Sunday, September 4, 2011

Dynamic WS-Discovery of WSO2 ESB

Web Services Discovery (WS-Discovery) is a protocol that locates web services in a network. As the name implies, the actual communication between nodes is done using web services standards (WS standards) especially in SOAP-over-UDP.
In WS-Discovery, services that are hosted in an Application server or any other service hosting environment can be exposed via a Discovery Proxy (which is default available in products like WSO2 Governance Registry), to another external Discovery client.

Example Use Case
Actual services are hosted in WSO2 Application Server (AS).
WSO2 Governance Registry (G-Reg) acts as the central repository with Discovery proxy, where all the discovered service related metadata are stored.
Discovery client would be WSO2 Enterprise Service Bus (ESB) where it consumes the discovered services and create endpoints and proxy services using them.

Two ways exist that WS-Discovery can be configured in WSO2 Carbon products.

  • Static Discovery
  • Dynamic Discovery
Static Discovery
In this aspect of WS-Discovery, the services are located and referenced via the service's actual URI. More details on Static Discovery can be read from here. 
Dynamic Discovery
In service discovery, each service is obtained a unique ID (a.k.a UUID) Dynamic Service Discovery uses the uuid to refer the actual services instead of the actual URI of the hosted service. 

Following the steps below will take you to a successful dynamic WS-Discovery environment set up.

Step 1 - Set up environment
Download WSO2 AS, WSO2 G-Reg and WSO2 ESB. 
Change the offset parameter which resides in each of the above products' $CARBON_HOME/repository/conf/carbon.xml, so that, ESB runs in port 9763, AS in 9764 and G-Reg in 9765.
    eg. Open $AS_HOME/repository/conf/carbon.xml and change the offset parameter to 1. 

Step 2 - Start up Discovery Proxy
Start up the G-Reg. If you access through this http://<ip_address_greg>:9765/services/DiscoveryProxy?wsdl, URL, you will observe that the Discovery proxy service is started up and running, and the service is accessible via the endpoint, http://<ip_address_greg>:9765/services/DiscoveryProxy (make a note of this endpoint URL, for the ease of usage in further steps. )
    eg. http://localhost:9765/services/DiscoveryProxy

Step 3 - Configure service hosting environment
Go to $AS_HOME/repository/conf/axis2.xml and add the following parameter.
<parameter name="DiscoveryProxy">http://localhost:9765/services/DiscoveryProxy</parameter>
When we add this discovery proxy endpoint to AS, for all the existing services and new services that are getting deployed in AS, it sends a unicast hello message to the network. 
Restart AS with this addition. 
Go to G-Reg management console and go to Metadata --> List --> Services page. It will show up all the services that are available in AS as discovered services. If you deploy a new service in AS, that will also get reflected in the Metadata service list in G-Reg since all these services send a unicast hello messages to discovery proxy and register them selves in G-Reg. 
You will notice that each and every service is assigned with a unique service name as well. 


Figure 1: G-Reg Service List displays the Discovered Services


Step 4 - Configure Discovery client for 'Dynamic' mode
As mentioned above, WSO2 ESB will act as the discovery client where it can invoke the discovered services via the Endpoints and Proxy services created utilizing the Discovered services itself. 
  4 (a).  Install the WS-Discovery Mediation Extensions feature

Start up the ESB and go to Configure --> Features. In 'Feature Management' wizard, click on 'Add Repository'. Give a name to the repo, and as the URL specify the below and click Add
    eg: http://dist.wso2.org/p2/carbon/releases/3.2.0
From the populated feature list, select the following feature
    WSO2 Carbon - WS-Discovery Mediation Extensions
Install it and Restart the ESB server. 


   4 (b). Configure the synapse registry to pick the new features
Log into ESB. Go to Manage --> Service Bus --> Source View. To the configuration, add the following two parameters. 

<parameter name="discoveryProxy">http://localhost:9765/services/DiscoveryProxy</parameter>
<parameter name="extensions">org.wso2.carbon.discovery.mediation.ext.WSDiscoveryRegistryExtension</parameter>
And save the configuration. (No need to restart)
The same thing can be done from the file system as well. 
Go to $ESB_HOME/repository/conf/synapse-config/registry.xml. Add the above two parameters to the file, save and restart ESB. 
   4 (c). Enable WS - Discovery
Log into ESB Management Console and go to Configure --> WS-Discovery. Click on "Add Discovery Proxy" link to add a new proxy. You will be directed to discovery proxy settings screen in which you can give a name for the proxy and the remote DiscoveryProxy URL (In our case http://localhost:9765/services/DiscoveryProxy). 
Figure 2: Discovery Proxy Configure page in ESB


You will be redirected to the home page of WS-Discovey Control Panel once the proxy is created. The created proxy will be listed in the control panel home page. Click on "View" to find the target services and endpoints discovered by the proxy. You will be directed to a page as shown below. 
Figure 3: ESB displays Dynamically discovered services


Step 5 - Create ESB Proxy etc using the Discovered Services
In the same WS-Discovery service stat page, click on a preferred service ID. It will redirected to a Service Summary page, where all the statistics regarding the particular service is listed. Also it will facilitate you to create ESB Proxy Services and ESB Endpoints using the particular service, which is very convenient in user point of view.  

Figure 4: Create EPs, Proxies using Discovered Services