Educating yourself does not mean that you were stupid in the first place; it means that you are intelligent enough to know that there is plenty left to 'learn'. -Melanie Joy

Friday, 23 June 2017

OpenLDAP - How to enable CRL check for LDAP TLS connections?

June 23, 2017 Posted by Dinesh , , , , , ,
Refer the old post to understand more about certificate chain verification and CRL. Here we will see how to establish a secure connection using OpenLDAP. OpenLDAP provides set of "set" options through which we can enable the CRL check, supply required certificates and we can set the verify call back. Using this verify call back we can control OpenLDAP behavior on each certificate verification. Below...

Tuesday, 23 May 2017

OpenSSL - How to verify certificate chain with CRL?

May 23, 2017 Posted by Dinesh , , ,
When any certificate is issued, it has a validity period which is defined by the Certification Authority. Usually, this is one or two years. However, sometimes certificates should not be honored even during their validity period. For example, if the private key associated with a certificate is lost or exposed, then any authentication using that certificate should be denied. That's where CRL comes...

Wednesday, 13 April 2016

Python - Selecting a random item from a list or tuple or dict

April 13, 2016 Posted by Dinesh ,
Say you have a list with 'n' number of items and you wish to get some random item from that list, How do you do it ? Python has inbuilt 'random' package to do this. To get one random item from the list: >>> import random >>> items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] >>> print random.choice(items) 'c' There’s an equally simple way to select n items from the sequence: >>>...

Thursday, 3 December 2015

ldapmodify failed with error "dn: attribute type undefined"

December 03, 2015 Posted by Dinesh ,
I was facing this strange error "dn: attribute type undefined" while I am trying to delete attributes from the LDAP. My ldif file has two attributes to be deleted. cat /tmp/modifyattr.ldif dn: fsFgId=Child2, fsFgId=Child1, fsClsId=Root changetype: modify delete: fsListeningHost dn: fsFgId=Child2, fsFgId=Child1, fsClsId=Root changetype: modify delete: fsPort When ldapmodify command is executed...

Saturday, 31 January 2015

Secure way of deleting files in Unix

January 31, 2015 Posted by Dinesh , , , , , ,
As I mentioned in the previous post there are simple techniques that can recover your deleted file (by using simple 'grep' or 'strings' utilities). Even some data recovery tools does the same thing. So if you want to delete some data on the disk without being worried about the retrieval, then you should probably over write the disk which has your file content. shred utility available in Linux does...

How to recover a file that was removed using 'rm' command ?

January 31, 2015 Posted by Dinesh , , ,
In Unix like file systems, the system uses 'hard links' to point to piece of data that you write to the disk. So when you create a file, you also create its first hard link. You can create multiple hard links using 'ln' command. When you "delete" a file using rm command, normally you are only deleting the hard link. If all hard links to a particular file are deleted, then the system removes only...

Thursday, 29 January 2015

Calculating time differences in python

January 29, 2015 Posted by Dinesh , , ,
Recently I had a situation where I need to calculate the timer efficiency. I have a C++ timer that calls my function after every 5 sec. My function does some critical operation and logs one statement to syslog. When I observed the logs I found that there is delay in my function execution, slowly the timer started drifting in result and the next function calls are getting delayed !! So I wanted...