Skip to main content

Posts

Showing posts from 2010

Retrieve SSL certificate expiration date

There are several ways to extract the expiration date from the certificate file. Here is one of the easiest way if you have the file locally: # openssl x509 –noout –in < cert_file >  -dates [root@mysystem][/opt/certificates ]> openssl x509 -noout -in private_key -dates notBefore=Jul 14 16:23:57 2010 GMT notAfter=Jul 14 16:23:57 2012 GMT

Linux Commands

Few commands learned on SuSE Linux List version of SuSE Linux: # cat /etc/SuSE-release Restart network: # /sbin/rcnetwork restart Network config files under : /etc/sysconfig/network/ directory (ifcfg-<interface name> files) Routes in /etc/sysconfig/network/routes file Status of the Network: ifstatus <network interface name> Bring down netowork – ifdown <network interface name> Bring up network – ifup <network interface name> YaST – configuration tool for SuSE – pretty much all the system configuration can be done from this tool Generic LVM commands in Linux: List the physical disks installed: # fdisk –l Create Physical Volume (initialize physical disk for LVM) # pvcreate /dev/sdc [or any free device name] Create Volume group # vgcreate myvg /dev/sdc Create Logical Volume: # lvcreate –L 3G –n mylv myvg Display Commands # pvdisplay # vgdisplay # lvdisplay Create ext3 filesystem: # mkfs.ext3 mylv ...

Tweet up!

Created a new Twitter  account to publish tweets about the notes published on this site.

Code to check SSL Client Certificate ...

Code to check SSL Client Certificate Expiration remotely Language: C# (C Sharp) using MS Visual Studio Express 2010 Reference:  System.Net.ServicePointManager , another sample code from stackOverflow Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Diagnostics; namespace CertCheck {     class Program     {         static void Main(string[] args)         {             //Get URL from command line to check             if (args.Length==0)             {                 Console.WriteLine("Usage: CertCheck <https://url> [-v]");                 Console.WriteLine("Enter an url with https prefix");          ...

sed regular expression to extract mes...

sed regular expression to extract message part of the syslog (AIX): #>sed 's/\(...\) \(..\) \(..\:..\:..\) \(.*\)/\4/' /var/adm/syslog myhost auth|security:err|error tsm: : 3004-025 - tcgetattr  failed errno "25".  myhost auth|security:notice su: from dude to root at /dev/pts/109 myhost daemon:err|error root: Msg from Err Log: A924A5FC 0524165910 P S SYSPROC SOFTWARE PROGRAM ABNORMALLY TERMINATED  myhost daemon:err|error last message repeated 2 times myhost user:info syslog: libtt[1224956]: _Tt_rpc_client::init(): fcntl(F_SETFD) failed for socket =  20 myhost user:info last message repeated 10 times myhost user:info syslog: libtt[3125324]: _Tt_rpc_client::init(): fcntl(F_SETFD) failed for socket =  20 myhost user:info last message repeated 10 times myhost auth|security:info sshd[946242]: Received disconnect from 127.0.0.1: 0:  myhost auth|security:info sshd[946178]: Accepted password for dude from 127.0.0.1 port 4341 ssh2 will print everything aft...

AIX: kill all the processes started b...

AIX: kill all the processes started by an user You can kill all the processes started by an specific user using the following methods: 1.  login as the user (su if you are a root) and execute killall 2.  form the kill command using a ps/awk/ksh combination       ps -u <user> | awk '{print "kill -9 "$2""}' | ksh 3.  use xargs to do the same      ps -u <user> | awk '{print $2}' | xargs -t kill -9 I prefer the (3) as it takes care of long listing of processes and it does the executes on kill command for all the processes. Additional notes: find . -name "*.bak" -print0 | xargs -0 -I file  mv file ~/old.files

Resetting gnome-panel in ubuntu

Resetting gnome-panel in ubuntu While trying to customize the gnome panel on ubuntu I lost access to the panel (after enabling the auto-hide feature).  After trying several things to reset the gnome panel to its original setting (or disable the auto-hide), nothing brought the panel back.  Finally, figured out a way to reset everything to the factory defaults for the gnome-panel with a single command:  gconftool-2 --recursive-unset /apps/panel Also restarted the gnome-panel by killing it from the command prompt killall gnome-panel

Cryptographic Sum Command

Users often use the sum command to generate a checksum to verify the integrity of a file. However, it is possible for two distinct files to generate the same checksum. A cryptographic sum command, csum , has been implemented in AIX 5L Version 5.3 that offers a more reliable tool to verify file integrity. This command allows users to generate message digests using the AIX Cryptographic Library. The new, cryptographic, checksum is considered more secure than the old mechanism. While it is reasonably straightforward to construct data that will match the checksum generated by the sum command; it is computationally infeasible to construct data to generate a known cryptographic checksum, as provided by csum . csum allows users the option to select the algorithm that they prefer, including both MD5 and SHA-1, which are considered secure. It is estimated that the order of 2**64 operations would be required to derive two different files, which generate the same MD5 message digest. Also, t...

List only SYMMETRIX disks

Here is an easy way to list just the symmetrix disk (excluding internal or even other FC disks): #lsdev –CtMSYMM* Use –t to specify the type of the disk, and all symmetrix disks are of the same type starting with MSYMM* - comes from the EMC ODM fileset.

EMC Celerra – NFS client’s view of disk space usage

While mounting NFS share from EMC celerra (NX80G v5.6) which has file system level quota on the NAS, the client sees the size of the entire file system on NAS and not the quota. This is very misleading on the client side where the users assume there are a lot space available on the system than it is (from the df command). To fix this issue, the following parameter on the NAS needs to be enabled to show the quota size instead of file system size: # server_param <server_name> -f quota –modify useQuotaInFsStat –value 1 Display current value: # server_param <server_name> -f quota –I useQuotaInFsStat  

Perl one liners

Check if a module is installed: perl -M<module name>-e 1 Check the version of the installed modules: perl -M<module name> -e 'print "$<module name>::VERSION \n"' Install a perl module using CPAN: perl -MCPAN -e 'install <module name>' ________________________________________________ References: http://www.perlhowto.com/perl_modules http://www.cpan.org/misc/cpan-faq.html#How_install_Perl_modules

Creating NFS mount points in AIX

/usr/sbin/mknfsmnt -f '[local directory] ' -d '[remote directory] ' -h ' ' -M 'sys' '-B' '-A' -t 'rw' -w 'bg' -b '32768' -c '32768' -K '3' -k 'tcp' '-Y' '-Z' '-X' '-S' '-j' -R '5' '-q' '-g' The values used are as per oracle database requirement [ FROM AIX INFO CENTER ] -A The /etc/filesystems entry for this file system specifies that it should be automatically mounted at system restart. -a The /etc/filesystems entry for this file system specifies that it should not be automatically mounted at system restart. This is the default flag. -B Adds an entry to the /etc/filesystems file and attempts to mount the file system. This is the default flag. -b ReadBufferSize Indicates the size of the read buffer in bytes specified by the ReadBufferSize variable. -c WriteBufferSize Indicates the size of the wri...

LTO5

http://searchdatabackup.techtarget.com/generic/0,295582,sid187_gci1389638,00.html?track=NL+1058&ad=750813&asrc=EM&USC=&10920869=&uid=5284205

Collecting data for Performance issues in AIX

The following are the few commands I used heavily for troubleshooting a performance Issue on the AIX servers: 1. tprof: tprof -kes -x sleep 60 This will collect tprof data for 60 seconds and will store it in a file called sleep.prof 2. Collecting data for SPLAT: splat command uses the output create by the trace command to analyze the lock performance on the system where you have multi-threaded applications running. a. Collect trace data: generate gensyms data gensyms > gensyms.out trace -aC all -o trace -3; sleep 60 ; trcstop This will collect trace data for 60 seconds and will generate files starting with trace, trace-1 etc depending on the number of virtual cpus. b. run splat command to analyze the lock performance: splat -sa -da -S100 -i trace -n gensyms.out -o splat.out The final analysis of the lock performance can be found in splat.out. There are various options available for the above commands and also documents in AIX information center on how to inter...