Thursday, November 26, 2015

VMware vfabric web servers and tc servers to start when system boot

It is very important to start the tomcat services when a virtual machine power on automatically.

I have worked on this for our application to start up when ever there is a power on. On the VMware esxi host we can add a virtual machine to power on automatically when host restarts.

After starting the virtual machine the tomcat service in the server was not starting in our case. So, I followed VMware documentations and listed the important commands to do the same task here.

The following are the steps to make the tomcat or web services to start automatically when a virtual machine starts.

We need to create a tomcat user  with sudo permissions

adduser tcserver sudo

Make him owner for all files and sub directories of CATALINA_HOME

Edit
CATALINA_HOME/bin/init.d.sh

Modiy
TC_RUNTIME_USER="tc-server" to TC_RUNTIME_USER="tcserver"

Link the init.d.sh to /etc/init.d/{servicename}

ln -s /var/opt/vmware/vfabric-tc-server-standard/tcserver/bin/init.d.sh \ /etc/init.d/tcserver

After that we can test the service is working or not just by
To start the server instance
/etc/init.d/tcserver start
To  get status the server instance
/etc/init.d/tcserver status
To restart the server instance
/etc/init.d/tcserver restart 
To staop the server instance
/etc/init.d/tcserver stop
 
This is important after above to start the instance on boot we need to update the rc.d add the service instance to defaults
update-rc.d webserver defaults 
 
Note : CATALINA_HOME =  /var/opt/vmware/vfabric-tc-server-standard/MyInstance/

For webservers I just made the link and updated the rc.d and it just works fine.

# ln -s /var/opt/vmware/vfabric-web-server/webserver/bin/httpdcl  /etc/init.d/webserver
# update-rc.d webserver defaults

Wednesday, November 25, 2015

How to ReadMessages from usb modem using sms-lib in ubuntu system

This week I worked on Reading messages from USB modem with the help of smslib library.

The prerequisites

1) USB modem details
Manufacturer: ZTE CORPORATION
Model: MF190

2) SIM : Tata docomo

3) Ubuntu i386 laptop

For windows users you can follow this blog
http://gsmmodemtutoialbysamyan.blogspot.in/2013/12/what-is-gsm-modem-gsm-modem-specialized.html?showComment=1448442361213

The process I am sharing is similar to the process mentioned in above blog

The only change is 2nd step
In Linux environments we need to copy "libLinuxSerialParallel.so" to jdk/bin and jre/bin
This file you can find in java comm api of oracle, file is "comm3.0_linux.zip"





Change the javax.comm.properties in my case the paths are

 # Paths to server-side serial port devices
serpath0 = /dev/ttyUSB2
serpath1 = /dev/ttyUSB1

Then after the steps are similar add smslib.jar and log4j.jar to your project and Run ReadMessages.java

While running the ReadMessages.java you may get stringindexoutofboundsexception it can be solved by setting actual message storage location i.e., either SM or SR or ME or MD.
In my case it is ME

this is the method to be used in smslib to set the storage location
gateway.getATHandler().setStorageLocations("ME");
The total files can be found in this link
https://dl.dropboxusercontent.com/u/87378162/SMSlib-requiredfiles.tar.gz

The java project I implemented can be downloaded from here
https://dl.dropboxusercontent.com/u/87378162/USBModem.zip

Thursday, November 19, 2015

Providing two Way authentication for VMware Horizon view server with freeradius and google authenticator

This week I worked on the 2 way authentication for vmware horizon view server by following the document

http://blogs.vmware.com/consulting/files/2015/02/VMW_15Q1_TD_Horizon-View-Google-Authenticator_021715_FINAL_EMonjoin.pdf

shared by

I followed the document thoroughly one small change in the installation step is currently likewise-open is not available from the repos. We need to install pbis
for that I followed below url

http://askubuntu.com/questions/452904/likewise-open-14-04-other-easy-way-to-connect-ad

for some configuration settings some resources helped me I want to share them here
https://community.spiceworks.com/how_to/80336-join-ubuntu-14-04lts-to-a-windows-domain-using-pbis-open




Thursday, October 29, 2015

Alfresco Replacing default certificates and handling expiry


Alfresco logs shows following log if the certificates expire

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed

To update the certificates follow the below steps
The $ALFRESCO_SOURCE_HOME/ is
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/

1. Backup the current keystore directory in alf_data
2. Remove the keystore directory from alf_data
3. Copy the keystore directory from Alfresco SVN $ALFRESCO_SOURCE_HOME/projects/repository/config/alfresco/keystore to alf_data
4. Remove the keystore directory from $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco
5. Copy the keystore directory from Alfresco SVN $ALFRESCO_SOURCE_HOME/projects/repository/config/alfresco/keystore to $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco
6. Copy...
$ALFRESCO_SOURCE_HOME/projects/solr/source/solr/instance/archive-SpacesStore/conf/ssl.repo.client.keystore to alf_data/solr/archive-SpacesStore/conf/ssl.repo.client.keystore
$ALFRESCO_SOURCE_HOME/projects/solr/source/solr/instance/archive-SpacesStore/conf/ssl.repo.client.truststore to alf_data/solr/archive-SpacesStore/conf/ssl.repo.client.truststore
$ALFRESCO_SOURCE_HOME/projects/solr/source/solr/instance/workspace-SpacesStore/conf/ssl.repo.client.keystore to alf_data/solr/workspace-SpacesStore/conf/ssl.repo.client.keystore
$ALFRESCO_SOURCE_HOME/projects/solr/source/solr/instance/workspace-SpacesStore/conf/ssl.repo.client.truststore to alf_data/solr/workspace-SpacesStore/conf/ssl.repo.client.truststore

Steps copied from https://wiki.alfresco.com/wiki/Replacing_Default_Certificate

Wednesday, October 28, 2015

Reset admin password in Alfresco 4.0.d

Reset admin password in Alfresco 4.0.d
Case1 : If you know the password of other user with admin role you can change directly by logging into the alfresco site

Case1 : Change admin password in postgres database

Login to alfresco instance and change directory to /opt/alfresco-4.0.d/postgresql/bin
# ./psql -U postgres
Password for user postgres:
postgres=#

To List databases
postgres=# \l
                                  List of databases
      Name    |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+------------------------------------------------------


Connect to alfresco database
postgres=# \connect alfresco;
You are now connected to database "alfresco".
alfresco-#


Display tables
alfresco-# \dt

To list users and their passwords

alfresco-# SELECT anp1.node_id,
       anp1.qname_id,
       anp1.string_value as hash_pass,
       anp2.string_value as user_string
FROM alf_node_properties anp1
        INNER JOIN alf_qname aq1
           ON aq1.id       = anp1.qname_id
        INNER JOIN alf_node_properties anp2
           ON anp2.node_id = anp1.node_id
        INNER JOIN alf_qname aq2           
           ON aq2.id       = anp2.qname_id
WHERE aq1.local_name    = 'password'
AND aq2.local_name    = 'username';


 node_id | qname_id |            hash_pass             | user_string
---------+----------+----------------------------------+-------------
     555 |       10 | 0eeb8b5ee6e96f1a8443edfb1dfc36ad | mjackson
       4 |       10 | 50d4e7a47cf4a836e51cdbc335cb6f44 | admin

In alfresco passwords are stored as encrypted.

For 'admin' string the encrypted one is  209c6174da490caeb422f3fa5a7ae634 so we
Reset the password to admin and login to alfresco web and change password.
alfresco-# UPDATE alf_node_properties
 SET string_value='209c6174da490caeb422f3fa5a7ae634'
 WHERE
 node_id=4
 and
 qname_id=10
UPDATE 1

Queries copied from
http://keytocontent.blogspot.in/2011/09/resetting-forgotten-alfresco-admin.html





SSL certificate import

 Import SSL certificate to particular keystore


C:\Users\veeresh\Desktop\>keytool -import -alias xmpp3 -keypass changeit -keystore c:\Java\jdk1.8.0_20\jre\lib\security\cacerts -file c:\Users\veeresh\Desktop\vamanit.cloudapp.net.pem

List certificates in a keystore

C:\Users\veeresh\Desktop\>keytool -list -keystore cacerts

Generate .pem or .cer files for self signed websites using openssl

openssl s_client -connect vamanit.webiste.net:5222 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > xmpp.crt