Tuesday, July 25, 2017

How do I check if my site is using SHA-1

You could do this check from command line of a Unix-like system.

openssl s_client -connect www.mysite.com:443 < /dev/null 2>/dev/null | openssl x509 -text -in /dev/stdin | grep "Signature Algorithm"
In the above command line, replace www.mysite.com with what you have.  For SSL, default port is 443.

    Signature Algorithm: sha1WithRSAEncryption
If this the result, your site is using SHA-1.  You should consider using SHA-2 in place of SHA-1.

    Signature Algorithm: sha256WithRSAEncryption
If this the result, your site is using SHA-2.

But why should I stop using SHA-1?

Today, more and more people consider SHA-1 to be insecure.  Since 2005, folks have published attacks on SHA-1.  The SHAttered attack is the most recent one.

Monday, July 24, 2017

A hiking tip

When going uphill, walk with straight feet.  So you won't fall sideways.  Like how they open an innings in test cricket - playing with a straight bat.

When going downhill, go criss-cross instead of following straight paths.  Good for maintaining balance while you're busy controlling your speed.  Like how they play during slog overs of a cricket match.

Thursday, July 6, 2017

bash : Checking if a particular version of a software is present or not

In one bash script I was writing, I was told to take certain action based on whether version 4.2 or above of a certain software is available or not.
The versioning scheme used by the software in question is major.minor.revision
So, version 3.8.0 or 4.1.6 or 4.2.1 or 5.1.3 could be present.
Doing a string comparison is writing your own invitation for disaster.
The version obtained needs to be broken into pieces, and each piece needs to be compared numerically.

#!/bin/bash
# software_version="4.1.0"
# software_version="4.2.0"
# software_version="4.5.0"
software_version="5.1.0"
# software_version="3.8.0"
echo $software_version

major=$(echo $software_version | /usr/bin/cut -d. -f1)
minor=$(echo $software_version | /usr/bin/cut -d. -f2)
echo "major = $major  and  minor = $minor"

higher_than_4_2=0

if (($major > 4)); then
    higher_than_4_2=1
else
    if (($major == 4)) && (($minor >= 2)); then
        higher_than_4_2=1
    fi
fi
if (($higher_than_4_2 == 1)); then
  echo "Software version is equals to or greater than 4.2"
else
  echo "Software version is not equals to or greater than 4.2"
fi

Thursday, June 29, 2017

Perl : How to obtain a past date in YYYY-MM-DD format

In one particular perl script, I wanted to obtain the date that was 30 days ago, in YYYY-MM-DD format.  Here is the perl code I wrote.

#!/usr/bin/perl
use strict;
use warnings;

# 1 day = 86400 seconds
# 30 days 2592000 seconds

my ($day, $month, $year) = (localtime(time() - 2592000))[3,4,5];
$month++;
$year += 1900;
print "$year-$month-$day \n";

__END__



Perl's built-in function time returns the number of seconds since the epoch.  The epoch is 00:00:00 UTC, January 1, 1970.
If we subtract 2592000 from the value returned by time, the result we get is useful for obtaining a date from 30 days ago.

Using the value obtained from time function, Perl's built-in function localtime is useful in obtaining day of month, month, and year.
Value of year returned by localtime function contains the number of years since 1900.  So we have to add 1900 to it, to obtain the year we were looking for.
Value of month returned by localtime function is in the range 0 to 11, representing January to December.  So adding 1 to it gives the month of year that we are interested in.

Thursday, June 15, 2017

A search tip I reiterated today

I had learned it some other day.  Today I reiterated it.
When searching, ignore the unwanted details.

modprobe: FATAL: Could not load /lib/modules/2.6.32-504.23.4.el6.x86_64/modules.dep: No such file or directory
this did not get the results what I was looking for.

modprobe: FATAL: Could not load modules.dep
this gave the results what I was looking for.

Friday, May 12, 2017

Visit to the birth place of Balaji Vishwanath, the first of a series of Peshwas

Traveling in the hot summer days isn't a very good idea, if you happen to live on the Deccan Plateau.  So instead of a week long vacation, we decided to do a short family trip to a new place.  The coastal towns of Harihareshwar, Shrivardhan, and Murud were still unexplored places on our map.  This time, Shrivardhan had the luck.

Two lanes before the lane to our hotel, a sign board besides the road mentioned a historical place.  Birth place of Balaji Vishwanath, the first of a series of Peshwas who maneuvered the Maratha Empire during the 18th century.
Being well aware of how historical places and heritage sites are kept in this part of the Indies, we were not expecting anything above ordinary.  But we definitely wanted to see.

I decided : the narrow lane is too small for our Night Fury (aka Nissan Terrano) to fly.  So we walked from our hotel to there.  I asked for directions at a roadside shop.  One guy did not know the place I was inquiring.  Another guy told to walk further down the road.

Little ahead we saw a shop in front of a home, selling local produce. We bought all we wanted, and then asked the gentleman where the historical place was.  He pointed to the place on the opposite side of the road.  We were right in front of what we wanted to see!


Beyond a much ordinary gate, an open yard with a statue in one corner.  An old house, which is now being used by a local karate academy.



















 


Two small boards depicting what the place is.  Obviously, not everyone sees this place by the value of the event it has witnessed in the history of this part of the Indies.  Is this the neglect of the authorities?  Or the modesty of the people of this land.










Like this one, may be there are a hundred more historical places in this part of the Indies.  Willing to tell us a story, only if we are ready to listen.
Yesterday we had visited Bankot fort.  A small fort offering spectacular views of the surroundings.  But neglected by the people of the Indies.

The shop on the other side of the road is recommended.  Mango squash and gooseberry juice are excellent.  Three weeks gone, and I am still loving those.

Tuesday, August 30, 2016

Upgrading RTC client to version 6.0

Disclaimer: The content of this post is neither approved nor endorsed by IBM.

We use Rational Team Concert (RTC) as code repository for our product.  RTC server that we use was upgraded to version 6.0
I was using RTC clients 4.x which stopped connecting to RTC server.  I found, RTC server 6.0 does not have backward compatibility for 4.x  So I had to upgrade RTC clients from version 4.x to version 6.0

I downloaded RTC 6.0 client RTC-Client-Linux-6.0.zip from where it is available for use within IBM.
You could download it from IBM Jazz web site, here

I unzipped it in directory /opt/IBM/RTC-Client-6.0/

# pwd
/opt/IBM
# mkdir RTC-Client-Linux-6.0
# unzip RTC-Client-Linux-6.0.zip  -d RTC-Client-Linux-6.0/


I modified .bashrc file to point to /opt/IBM/RTC-Client-6.0/
I used vim and added lines listed below to .bashrc

export PATH="/opt/IBM/RTC-Client-6.0/jazz/scmtools/eclipse:/opt/CollabNet_Subversion/bin/:$PATH:~/bin"
export LD_LIBRARY_PATH="/opt/IBM/RTC-Client-6.0/jazz/client/eclipse/jdk/jre/bin:$LD_LIBRARY_PATH"


I logged out and logged in again so that the updated .bashrc came into effect.

Now I could login using `scm login` CLI.
For example,
`scm login  -u jdoe  -n SONAS  -r https://hostname:12443/jazz  -c`