Wednesday, December 5, 2012

POX security with WSO2 ESB Proxy services

WSO2 ESB supports POX (Pure Old XML) security now. Let us see how we can test this with the latest version of WSO2 ESB .

Pre-requisites - Download the latest stable release of WSO2 ESB from here.

Step 1 - Start WSO2 ESB server

Step 2 - Create a Proxy Service. (We will use the Echo service shipped with WSO2 ESB here)


 <proxy xmlns="http://ws.apache.org/ns/synapse" name="PoxSecurityProxy" transports="https" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:8280/services/echo"/>
      </endpoint>
   </target>
   <publishWSDL uri="http://localhost:8280/services/echo?wsdl"/>
</proxy>



Step 3 - Once the proxy service is deployed, access the dashboard and apply security scenario 1 (UsernameToken)

Step 4 - Select the user group which you expect to be given permission to access the Proxy service


Step 5 - Once security is applied to the service, access the dashboard and you will see only the HTTPS endpoint available


Step 6 - Now let us access this Proxy service. There are two ways which you can access the service.

a) Through a preferred browser

b) By sending a curl command

Through a browser

Copy the above HTTPS Endpoint URL and paste it in the location bar and hit Enter.
https://localhost:8243/services/PoxSecurityProxy/echoString?in=Hi

It would prompt you to specify the user name and the password.
Provide admin as both and you should be given the correct response.

Using Curl
  curl -k --basic -u admin:admin https://localhost:8243/services/PoxSecurityProxy/echoString?in=Hi 

Tuesday, September 25, 2012

5 minuted guide on taking Oracle dumps and restoring them (using exp/imp commands)

To take the a dump, use the below command

$ exp [username]/[password[ file=[anyname].dmp log=[anyname].log owner=[owner_of_db]

E.g.:- exp wso2user/wso2user file=wso2db.dmp log=wso2dberror.log owner=wso2user

To restore the dump which you took, use the below command

$ imp [new user]/[password] file=[dump to be restored].dmp fromuser=[who exported the db] touser=[new user]

E.g.:- imp wso2newuser/wso2newuser file=wso2db.dmp fromuser=wso2user touser=wso2newuser

Note that you need to create a new user using the below commands before issuing the above imp command.

drop user wso2newuser cascade;
Create user wso2newuser identified by wso2newuser account unlock;
grant connect to wso2newuser;
grant create session, dba to wso2newuser;
commit;


Sunday, September 23, 2012

How to resolve "ORA-00018: maximum number of sessions exceeded" issue

While working with WSO2 G-Reg which was connected to an Oracle DB, we came across and issue where the maximum number of connections were exceeded. 

To get over this exception, we had to increase the number of sessions, processors and transactions as below. 

I found this great blog which explains everything in detail. 


 sql> alter system set processes=500 scope=spfile;
 sql> alter system set sessions=555 scope=spfile;
 sql> alter system set transactions=610 scope=spfile;
 sql> shutdown abort
 sql> startup
 
 

Monday, February 13, 2012

How to solve "ssh: connect to host stop port 22: Connection refused"

If you are trying to connect to a machine through ssh and you are getting the following error, probably it's because you have not installed 'openssh-server' on the machine that you are trying to connect to.
Simply use the following command to install 'openssh-server'.
$ sudo apt-get install openssh-server
If you have installed 'openssh-server' and still seeing the same problem, then you might need to start sshd using the following command

$ sudo /etc/init.d/sshd start