Tuesday, 24 September 2013

Vskills certification on Cloud Computing

Recently completed a certification on cloud computing from Vskills. It is a vendor neutral certification and gives a good overview of all available cloud offerings. The study material starts by explaining the evolution of Cloud computing.right from Mainframes , Distributed and Virtualization eras.

As you might already know, over the last decade virtualization techniques have come of age and commodity hardware has also matured. Customers whose main focus is not IT, feel burdened by IT overhead costs like manpower requirements, Datacenter up keep, power requirements etc. They wish they could offload these tasks and focus on main business. Organisations also typically want quick deployment and QA times and do not want to go through the whole process of requirement gathering from teams, discussing with vendors sales team , placing order , server delivery and installation. They want to use IT as a utility.

Given below are common cloud service models:-
IaaS – Infrastructure as a Service , refers to offerings from cloud vendors providing Compute, Network and Storage. It is customer's responsibility to install OS, Database or Apps, Manage security and patching. Customer has full flexibility in this model.
PaaS – Platform as a Service, where cloud vendor provides  pre-installed OS images along with Database / Apps, Security Tools etc. Customer installs own software and starts using the instance.
SaaS – Software as a Service, where end product softwares are provided by vendor like E-mail / messaging, Sales Dashboard, Blog Hosting, HR Payroll, Training Module etc. Customer has least flexibility in doing customization under this model.

The certification also introduces you to popular cloud offerings which are listed below:-

Commercial Cloud offerings
Amazon AWS – The market leader in Cloud space, offers IaaS and PaaS services like Amazon EC2, S3, Redshift, Beanstalk.
Google – Provides PaaS as Google App Engine and SaaS in form of Google Apps.
Microsoft Azure – Offers PaaS and IaaS services.
Salesforce – Popular as a SaaS service, provides sales collaborative tool known as The Sales Cloud.
Microsoft Office 365 – Provides MS office and other business productivity tools. It is a SaaS service.



Open source cloud offerings
Cloud Foundry – Developed by and hosted on VMware platform, offers MongoDB , MYSQL etc as PaaS offering.
OpenStack – IaaS project under Apache License, supported by companies like AMD, Brocade, SUSE Linux, Red Hat, Vmware, Yahoo, HP, IBM,Intel, Rackspace, Cisco, EMC among others.
Eucalytus – AWS compatible open source software for building private and public clouds.
Ubuntu One – File Synchronisation and backup platfrom.

The exam also had some scenario based questions on Amazon AWS. There were total 50 questions to be answered in 60 minutes timeframe.

Overall it was a good experience and i strongly recommend this certification for beginners and those who do not have any cloud experience and those who want to learn more about cloud computing. Clearing this exam would give you the confidence to study more on Amazon AWS and will act as a baby step for future accomplishments.
The certification cost is 3000/- INR. You can visit the vskills website at www.vskills.in/certification/

















Thursday, 13 June 2013

Unix / Solaris Password Expiration Automated email notification

I have been entrusted with setting up a mail alert system for user password expiration. The user should automatically get intimated through mail a few days before his password expiration date. I wrote a small script by taking help from www.unix.com and other forums.
Below is the script for checking the age of the password and alert the user if password is going to expire in next 15 days.

Script Name  :- /usr/bin/solchage

---script start here----

#!/usr/bin/bash
umask 0022
PATH=/usr/bin:/usr/sbin
SHADOW=/etc/shadow
DSHADOW=/etc/shadow.dummy
USER=$1


# Copy the contents of /etc/shadow to a dummy file and make sure the entries for system  
# users are not there in the dummy file. Also replace the encrypted password field with      
# *LK* to make sure passwords are not visible or cannot be copied by someone else.

cat ${SHADOW} | egrep -v "root|daemon|etc" | awk -F: '{print $1,"*LK*",$3,$4,$5,$6,$7,$8}' | sed 's/ /:/g' > ${DSHADOW}

PASSWDFILE=/etc/passwd

# Specify the mail domain of your company here.
DOMAIN=xyz
.com

# The next line extracts the users email id from GECOS field of /etc/passwd file. So as a pre # requisite to running this script, you must enter the email id of the user, without the            # domain name, in GECOS field as i have assumed here. Let me know if you can think of a
# more elegant way of extracting this information.

EMAIL=`grep ^${USER} ${PASSWDFILE} | awk -F: '{print $5}'`

# Save the message in a file.
FILE=/tmp/msg.$$


# Set the password policy here, i.e the number of days after which user must change              # password.
PWPOLICY=90

# Set the warning period here.
WARN=15


# Calculate the number of seconds elapsed since Jan 1 ,1970 i.e Unix epoch.

EPOCH=`perl -e 'print time;'`


# Convert the number of seconds into days.

DAYSEPOCH=`expr ${EPOCH} / 86400`


# Calculate the number of days since password was changed for the last time for a particular # user. This info can be extracted from 3rd field of /etc/passwd file. This is expressed as
# the number of days between January 1,  1970, and  the  date  that  the  password was last
# modified.


LASTCHG=`grep ^${USER} ${DSHADOW} | awk -F: '{print $3}'`



# Subtract the above value from the number of days since epoch to arrive at the number    #  of days since last password change. 

PASSWDCHANGE=`expr ${DAYSEPOCH} - ${LASTCHG}`


EXPIRED=`expr ${PWPOLICY} - ${PASSWDCHANGE}`


if [ "${EXPIRED}" -lt "${WARN}" ]; then

cat > ${FILE} <<EOF
Dear ${USER},

Your password will expire in ${EXPIRED} days. Please change it as soon as possible.
EOF


mailx -s "Password expiring soon." ${EMAIL}@${DOMAIN} < ${FILE}

fi--- script end here---

To run the above main script, you have to run another small script which i produce below.
Copy the above script and place it under /usr/bin and name it solchage. Ofcourse you can give it another name, its upto you but make corresponding changes in below script as well if you do so.

Lets name the second script as /var/pwexpire.sh. So put this script in crontab for execution once everyday. It will run for all users, and send them a mail if their password is going to expire within 15 days.

Script Name:- /var/pwexpire.sh

--- script begin here ---


cat /etc/passwd | egrep -v "root|daemon|etc|sys|adm|lp|uucp|nuucp|smmsp|listen|gdm|webservd|postgres|svctag|nobody|noaccess|nobody4" | awk -F: '{print $1}' | egrep -v "bin" | xargs -I {} /usr/bin/solchage {}

---script end here---


What the above script does ? Let us examine step by step.

1) It reads /etc/passwd file and cuts out system users from the list
2) Then prints the remaining usernames using awk and removes all other entries except first filed from the output.
3) Then xargs executes our script /usr/bin/solchage one by one for every listed user. This is required because the our script takes username as argument ( see USER=$1 above ) and runs for that particular user.

You will have to give execute permissions to both the scripts.