Thursday, November 23, 2017

Create a client certificate signed by a CA certificate


#script to generate client cert-key pair signed by ca cert-key pair

#create cert signing request
openssl req -nodes -keyout -subj "/C=US/ST=IL/L=Chicago/O=testers unlimited/OU=tester/CN=clisigner/" -new -out

###Generate the certificate using csr
openssl x509 -in -out -req -signkey -days 365

#create cert signing request for client cert
openssl req -nodes -keyout anil.cli.key -subj "/C=US/ST=IL/L=Chicago/O=testers unlimited/OU=tester/CN=client/" -new -out anil.cli.cert.csr
###Generate the certificate using csr
openssl x509 -in anil.cli.cert.csr -out anil.cli.cert -req -signkey anil.cli.key -CA -CAkey -days 365

## verify certificate signature
openssl verify -verbose -CAfile anil.cli.cert

echo " Netscaler does not accept private key in format generated above"
echo "So, use this command to encrypt it"
echo "openssl rsa -in -passout pass:123456 -des3 -out"

Friday, January 1, 2016

Why New Year

Time is of supreme importance to human existence, or rather to make sense of one's experience of Life( as in,  Oh my God, I'm 33 and have achieved nothing substantial in life :( ) . Life (or 'experience of life' rather) after all is a sequence memories ordered in time.

There are two aspects of time that's of importance in this context:
1. The actual time ( this is fun to read : )
2. Perception of time (really interesting:

And, what's important for our *experience of life*, is the perceived time (Sounds obvious because "experience of life" comes from one's perception of of events in memory sequenced by perceived time).

So, having landmarks (or milestones or whatever you want to call it) helps us align perceived time closer to actual time. So, it is useful to create these landmarks by celebrating events like 'new year' 'birth day' etc... Because according to  'inference model' of time perception "the time of an event is inferred from information about relations between the event in question and other events whose date or time is known". Birthday celebrations and new year celebrations are events "whose date or time is known"

In other words, richness of memories make us feel how much we have lived our life. More events we can recollect from past, more we feel 'lived'. So, better to have more celebrations.

Also, since living an 'invented/designed life' is key to fulfilment ('coz I say so), this is also a time to reflect on the past year and make plans for the next. 'plan your life, live your plan'

Happy new year...

Thursday, December 24, 2015

Adding new path to library search on Linux

If you want to a path (directory) to be looked into for a shared library, without adding it to LD_LIBRARY_PATH, then ad the path to /etc/ and run ldconfig

  1. Add directory to /etc/
  2. run ldconfig

Monday, December 7, 2015

Remove password and merge PDF files in ubuntu

To remove password :

for file in *.pdf ; do qpdf --password=anil6053 --decrypt $file ./nopw/$fil
e; done

To merge pdf files,

pdftk *.pdf cat output mergedfile.pdf

If there are cases where some online tool has a limit on size of pdf file that it accepts, then the size of pdf can be reduced using the below command. You will of course loose some resolution...

Command to reduce the size of pdf :

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=smaller.pdf large.pdf

Friday, August 14, 2015

Extract layer 7 data from packet capture

If you want to extract the tcp payload of a set of packets (A tcp stream for example) Below command comes handy.

tshark -r test.pcap -2 -R"tcp.port==444" -T fields -e data  | tr -d '\n' | xxd -r -p > layer7_data

xxd converts ASCII hex to binary.

Friday, April 12, 2013

Get openerp working from source

  • Run openerp from source
    • Download source using bazaar
      • Install bazaar
      • Configure bazaar for launchpad repository
      • download(branch) source
    • Get the server running from source
      After getting the sourced using bzr, run
    • Get the web client running from source
      install python-cherrypy python-formencode This error can be seen at the core (server): [2013-04-11 16:00:31,280][template1] ERROR:db.connection_pool:Connection to the database failed Traceback (most recent call last): File "/home/advaith/openerp/bzr/openerp/server/bin/", line 303, in borrow result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection) File "/usr/lib/python2.7/dist-packages/psycopg2/", line 179, in connect connection_factory=connection_factory, async=async) OperationalError: FATAL: role "advaith" does not exist
    • Get GTK Client running from source.
      ./configure make make install /usr/local/bin/openerp-client
    • Install and configure postgresql for openerp
      Follow steps from this link : The links talks about creating role openerp. But I created role 'advaith' as suggested in error message
    • Once postgresql is installed and configured,you can access create database.

Friday, February 8, 2013

Share files using remote desktop

You can share a folder on the client machine so that it's available for read and write on the server to which you do remote desktop.

use the -r option of rdesktop.

rdesktop -r disk:share=/tmp

On remote machine, you can see an new drive with name 'share on '. You can read/write files from the drive.