Friday 3 March 2017

Sailpoint ServiceNow Ticket creation for automated provisioning applications

Scenario: On Termination of employee, required to create ticket not only for disconneted applications but also for the applications that feature provisioning using sailpoint.

Issues:
1- ServiceNow out of the box integration config supports provisioning for the applications that are marked as managed resource in ServiceNow Service ingration Module.

Out of the box behaviour for any workflow, i.e "LCM Provisioning", "Lifecycle Event - Leaver" are to create tickets to catalog items associated with these applications, and even "googleMaps connected App" is connected application that supports provisioning in Sailpoint, it will create a serviceNow ticket for it and wait until that ticket is closed.
above is not a required, ACME need to create an open/close ticket only after Sailpoint is done with provisioning.

Solution Architecture: Tap the provisioning workflow with some rule, that creates an additional integration provisioning plan for connected applications and execute the plan using ServiceNow Service Integration Configuration.

Solution:
1- Remove connected App from <ManagedResource> and leave only the disconnected applications in there. 
2- keep mapping of catalog items for connected application.
3- As "Lifecycle Event - Leaver" workflow uses "Identity Request Provision" workflow, add a rule step between "Post Provision" and "Manual Actions"  and provision an additional integration plan,  and execute it using serviceNow service integratiin.         
4- expected result is: creation of provisioning workitems in sailpoint for both connected and disconnected applications, provisioning completed for connected applications, ticket created for both connected and disconnected applications in ServiceNow.

Wednesday 27 January 2016

Adding SSL certificate to Nginx


1- get SSL certificate and SSL private  key  (use encrypted key provided by CA and paraphrase to decrypt it)  from CA like godaddy or StartSSL for your web application, for example in my case 1_idmpirate.us_bundle.crt" and "ssl.key"
(i used StartSSL as its free for one year for non-commercial purpose)

2- copy these files to home directory e.g /home/django
3- configure
vi /etc/nginx/sites-enabled/django (linux username)

create a new server by adding following lines at the end of the file:

server {
        listen 443 ssl;
        server_name idmpirate.us;

        root /usr/share/nginx/html;
        index index.html index.htm;

        ssl on;
        ssl_certificate /home/django/1_idmpirate.us_bundle.crt;
        ssl_certificate_key /home/django/ssl.key;

        ssl_session_timeout 5m;

        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
        ssl_prefer_server_ciphers on;

    # Your Django project's media files - amend as required
    location /media  {
        alias /home/django/django_project/django_project/media;
    }
         
   # your Django project's static files - amend as required
    location /static {
        alias /home/django/django_project/django_project/static;
    }

    # Proxy the static assests for the Django Admin panel
    location /static/admin {
       alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin/;}

     location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://app_server;

        }
}


4- open 443 port, if you have ufw utility (firewall utility for ubuntu)  installed use following command

sudo ufw allow https

otherwise configure ufw, active it and open 22, 80 and 443 ports.

sudo apt-get install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw enable
sudo ufw allow http
sudo ufw allow https
sudo ufw allow ftp
sudo ufw allow 21/tcp
sudo ufw allow 6000:6007/tcp
sudo ufw allow 6000:6007/udp

5- restart nginx
sudo service nginx restart

incase it fails to restart use following command to troubleshoot

nginx -t




6- Check server is listening on 443

netstat -ntlp | grep LISTEN

or

ufw status verbose

7- test https://idmpirate.us

in case rendering issues, keep in mind absolute address are not allowed to include static files like js or css


Absolute: (Don't use this)

<link rel="stylesheet" href="http://mydomain.com/css/style.css" />

Use Relative:

<link rel="stylesheet" href="/css/style.css" />

If the style is coming from another domain (such as a CDN), use double slashes instead of specifying the protocol. This will cause the path to inherit the protocol

the page was requested with when making the CSS request.

<link rel="stylesheet" href="//otherdomain.com/css/style.css" />


You are all set ::)

Monday 25 January 2016

Downloading Oracle Fusion Middleware Repository in AWS instance.

Downloading Oracle Fusion Middleware Repository in AWS instance.

Oracle acknowledged the need of implementers and provided the wget.sh script to download software in AWS instance.

Simply following these steps I was able to easily download oracle softwares in AWS instance.

  1.   goto https://edelivery.oracle.com/ and sign in (signup if not have account already) and accept the agreement
  2.  check Programs and search for Oracle Identity and Access Management Suite Plus for Oracle Applications*, Select Platform x86 64 bit and click Continue 
  3.  Select Alternate Release…
  4. from dropdown menu Oracle Identity and Access Management Suite Plus 11.1.2.1 for linux x86-64* and click Continue 
  5.  I have reviewed and accept the terms of the Commercial License, Special Programs License, and/or Trial License. click Continue
  6.  click WGET Options and download wget.sh
  7. Edit wget.sh file and remove un-related files that you dont want to download, for example i need 12 zip file for oracle fusion middleware for linux x86-64, i removed all other wget commands from wget.sh file. My wget.sh file look like following:

#####################################################################
################## wget.sh starts #######################################

#!/bin/sh

#
# Generated onMon Jan 25 12:24:14 PST 2016# Start of user configurable variables
#
LANG=C
export LANG

# SSO username and password
read -p 'SSO User Name:' SSO_USERNAME
read -sp 'SSO Password:' SSO_PASSWORD


# Path to wget command
WGET=/usr/bin/wget
# Location of cookie file
COOKIE_FILE=/tmp/$$.cookies

# Log directory and file
LOGDIR=.
LOGFILE=$LOGDIR/wgetlog-`date +%m-%d-%y-%H:%M`.log
# Output directory and file
OUTPUT_DIR=.
#
# End of user configurable variable
#

if [ "$SSO_PASSWORD " = " " ]
then
 echo "Please edit script and set SSO_PASSWORD"
 exit
fi

# Contact osdc site so that we can get SSO Params for logging in
SSO_RESPONSE=`$WGET --user-agent="Mozilla/5.0" --no-check-certificate https://edelivery.oracle.com/osdc/faces/SearchSoftware 2>&1|grep Location`

# Extract request parameters for SSO
SSO_TOKEN=`echo $SSO_RESPONSE| cut -d '=' -f 2|cut -d ' ' -f 1`
SSO_SERVER=`echo $SSO_RESPONSE| cut -d ' ' -f 2|cut -d '/' -f 1,2,3`
SSO_AUTH_URL=/sso/auth
AUTH_DATA="ssousername=$SSO_USERNAME&password=$SSO_PASSWORD&site2pstoretoken=$SSO_TOKEN"

# The following command to authenticate uses HTTPS. This will work only if the wget in the environment
# where this script will be executed was compiled with OpenSSL. Remove the --secure-protocol option
# if wget was not compiled with OpenSSL
# Depending on the preference, the other options are --secure-protocol= auto|SSLv2|SSLv3|TLSv1
$WGET --user-agent="Mozilla/5.0" --secure-protocol=auto --post-data $AUTH_DATA --save-cookies=$COOKIE_FILE --keep-session-cookies $SSO_SERVER$SSO_AUTH_URL -O sso.out >> $LOGFILE 2>&1

rm -f sso.out

  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76184-01_1of4.zip&token=TlNMemNnVW5OcHdsRXZmbjhOZlNzUSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MDU2OSZhcnU9MTg4OTM4NDcmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDM" -O $OUTPUT_DIR/V76184-01_1of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76184-01_2of4.zip&token=ZTI5WUp1WFhOd1FvTlgxZy95c2xnUSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MDU3MiZhcnU9MTg4OTM4NDcmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDM" -O $OUTPUT_DIR/V76184-01_2of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76184-01_3of4.zip&token=UHNQeUluK3NJclVZeXpEeURWT0tkdyE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MDU3NiZhcnU9MTg4OTM4NDcmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDM" -O $OUTPUT_DIR/V76184-01_3of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76184-01_4of4.zip&token=Wk9hMUc2bUxJaGxyVjBKc3p0TGEzUSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MDc5NCZhcnU9MTg4OTM4NDcmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDM" -O $OUTPUT_DIR/V76184-01_4of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76185-01_1of4.zip&token=b0FnYlZzNGM5Qk9UZHhRWWFCVkwydyE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTA3OSZhcnU9MTg4OTM4NDgmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDQ" -O $OUTPUT_DIR/V76185-01_1of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76185-01_2of4.zip&token=YWVrUmZwa0RvdGQ0aVBVSFQvYXBpUSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTE2MCZhcnU9MTg4OTM4NDgmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDQ" -O $OUTPUT_DIR/V76185-01_2of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76185-01_3of4.zip&token=VmRxQ3FNRDBHMEkzQ2NvaXRIQmxTUSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTE5NyZhcnU9MTg4OTM4NDgmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDQ" -O $OUTPUT_DIR/V76185-01_3of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76185-01_4of4.zip&token=NTF2OGpiZFRueTkySDJiRkRVcDQ4USE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTMzOCZhcnU9MTg4OTM4NDgmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MDQ" -O $OUTPUT_DIR/V76185-01_4of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76186-01_1of4.zip&token=YWpxcmQ4aFRaNXFxK1lXYThPbkcrQSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MDgxNiZhcnU9MTg4OTM4NDkmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MTM" -O $OUTPUT_DIR/V76186-01_1of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76186-01_2of4.zip&token=K2YyZ0VtNzFiQ0FzMm1wOVlTNnc5ZyE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTA3NyZhcnU9MTg4OTM4NDkmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MTM" -O $OUTPUT_DIR/V76186-01_2of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76186-01_3of4.zip&token=NExlNkZpM09FYUc1MmpDN0NrTW1aQSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTA3OCZhcnU9MTg4OTM4NDkmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MTM" -O $OUTPUT_DIR/V76186-01_3of4.zip >> $LOGFILE 2>&1



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V76186-01_4of4.zip&token=eUdXYUlPbEZsaUorb1ljY01MZWo3QSE6OiF1c2VybmFtZT1FUEQtRU5HUi5NSUFOQFlBSE9PLkNPTSZ1c2VySWQ9NzA3MTI5MCZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVBLJmVtYWlsQWRkcmVzcz1lbmdyLm1pYW5AeWFob28uY29tJmZpbGVJZD03OTU0MTA4MCZhcnU9MTg4OTM4NDkmYWdyZWVtZW50SWQ9OTM5Mjg2JnNvZnR3YXJlQ2lkcz05OTU4NyZwbGF0Zm9ybUNpZHM9MzUmcHJvZmlsZUluc3RhbmNlQ2lkPTM3MzQ4MiZtZWRpYUNpZD0zNTk0MTM" -O $OUTPUT_DIR/V76186-01_4of4.zip >> $LOGFILE 2>&1





#################################################################################
########## wget.sh ends############################################################

8- chmod 777 wget.sh
9- ./wget.sh
enter your oracle account credentials

10- open new session, tail the log files to see the progress.


Itsss too Fast...!

Saturday 3 October 2015

Runbook for Version Control System (Client and Server) using Git and GitHub

Git
This runbook covers following 
  • Important Git concepts
  • Important Git commands
  • Git Installation on Server Ubuntu 14.04LTS
  • Git Installation on Development Machine  OSX Yosemite
  • Creating Repository on Github
  • Filling Github repository first time
  • Check out and Committing to Github using  Development Machine
  • Sync on Server
  • Some Useful Operations to play with Git
Important Git concepts
Here are the basic terms you should familiarize yourself with before embarking on your journey.
Repository / Repo : This is the project's source code that resides on github.com's servers. You cannot modify the contents of this repository directly unless you were the one who created it in the first place.
Fork : Forking a project will create a copy of the original repository that you can modify as you please. Forked projects will appear in your own github.com account.
Cloning : this will clone an online repository to your hard drive so you may begin working on your modifications. This local copy is called your local repository.
Branch : A branch is a different version of the same project. In the case of T2DMIT, you will see 2 branches : the master branch and the development branch.
Remote : A remote is simply an alias pointing to an online repository. It is much easier to work with such aliases than typing in the complete URL of online repositories every single time.
Staging Area : Whenever you want to update your online repository (the one appearing in your github.com account), you first need to add your changes to your staging area. Modifying files locally will not automatically update your staging area's contents.
Important Git commands
Fetch : git fetch will download the current state (containing updated and newly created branches) of an online repository without modifying your local repository. It places its results in .git/FETCH_HEAD.
Merge : git merge will merge the modifications of another branch into the current working branch.
Pull : git pull is actually a combination of git fetch and git merge. It fetches the information from an online repository's branch and merges it with your local copy.
Add : Whenever you modify a file in your local repository or create a new file, that file will appear as unstaged. Calling git add allows you to specify files to be added to your staging area.
Commit : A commit records a snapshot of your staging area, making it ready to be pushed to an online repository.
Push : git push will take all of your locally committed changes and upload them to a remote repository's branch.


Don't worry if these words aren't familiar to you just yet, going through the actual process will (hopefully!) make everything clear.

Git Installation on Server Ubuntu 14.04LTS
ssh into Server using hostname and credentials, enter following commands to install Git.

• sudo apt-get update
• sudo apt-get install git 
  • git config --global user.name "Your Name"
  • git config --global user.email "youremail@domain.com"
To see everything is fine hit following command:
  • git config —list
Git Installation on Development Machine  OS X Yosemite

Most of the time Mac comes with Git installed, just check the version by following command:
git - -version

git version 2.3.2 (Apple Git-55)

Creating Repository on Github

Goto to Github main page, Goto Repositories, click New
Repository name: "your repository name"
click "Create Repository"

Filling Github repository first time
  • SSH to server, change directory to project
git init
touch .gitignore

  • for case of django you don't want to share settings.py file to each developer, add following to .gitignore avoid versioning of undesired files
vi .gitignore
*.pyc
*.swp
/projectName/settings.py
  • Add to staging
git add .
  • commit to local repository of server
git commit -m 'First commit’
  • Add url for Github repository we created
  • Verify that remote is added successfully
git remote -v
  • Push the project to Github repository 
git push -f origin master


Check out and Committing to Github using  Development Machine

First time checking out is called cloning in git


You don't have to manually add remote after cloning, its added automatically

Now make a small change in any file and enter following commands

git pull origin master
git commit -am "This is my first commit"
git pull origin master
sudo git push origin master


Follow the above command when doing development
Sync on Server
git pull origin master




Some Useful Operations to play with Git

/* Set up Git Configuration */

git config --global user.email "you@yourdomain.com"

git config --global user.name "Your Name"

git config --global core.editor "vi"

git config --global color.ui true

/* See Git configuration */
git config --list

/*  To initialise a local repository */
git init 

/*  Add a file to the repo */
git add 

/* commit the change to git */
git commit -m "Message goes here" 

/*  see the commits */
git log 

/*  Git has a 3 Tier Architecture:  Working - Staging - Repo
Changes to files are put in a Checksum SHA-1 hash 40digit value containing parent hash, author and message.

HEAD is the latest commit of the checked out branch */


/*  Basic Commands  */
git status  /*  the command 'git status' tells which files are not added or committed from Working to Staging to Repository */

git commit -m "" /*  Commits and changes to all files that are in Staging into Repo  */

git diff /*  show changes between Working and Local Repo, no file supplied shows all files  */

git diff --staged /*  shows changes between Staged and Local Repo  */

git rm file.txt /*  will remove file from working then git commit -m "" to also remove from Repo */

git rm --cached file.txt /* leaves copy of file in Working but removes from Staging and Repo */

git mv /*  rename or move files - then git commit -m "" to move to Repo */

git commit -am "text goes here" /* adds all files straight to Repo from Staging if they have changes - meaning they skip git add */

git checkout -- file.txt /*  restore Repo file to Working Directory using current branch  */

git reset --soft HEAD^ /* restore repo file to staging */

git reset HEAD file.txt /*  Move a Stage file out of Stage back to Working */

git commit --amend -m "message" file.txt /* Change last commit to Repo (only last one can change) */

/* Reverting --soft --mixed --hard will go back to previous commits*/

git log /* gets the sha1s so you can see the coomits where you want revert  back to  */

git reset --soft sha /* changes Repo but not Staging or Working */

git reset --mixed sha /* changes Repo and Staging but not Working */

git reset --hard sha /* changes all 3 Tiers */

git clean -f /* remove untracked files from Working  */


.gitignore /* ignores files to track in Working / track the .gitignore file */

Global Ignore /* create in home folder  */ 

.gitignore_global

/* Add in  */

.DS_Store

.Trashes

.Spotlight_V100



git config --global core.excludesfile ~/.gitignore_global /* add to gitconfig */

/* Stop tracking changes */

git rm --cached file.txt /* leaves copy in Repo and Working */


/* Track Folders changes
Add an invisble file to a folder like .gitkeeper then add and commit */

/* Commit Log  */

git ls-tree HEAD

git ls-tree master

git log --oneline

git log --author="Neil"

git log --grep="temp"




/* Show Commits */

git show dc094cb /*  show SHA1 */




/* Compare Commits

Branches */

git branch /*  Show local branches * is the one we are on */
git branch -r /* Shows remote branches */
git branch -a /* Shows local and remote */
git branch newbranch /* creates a new branch */
git checkout newbranch /* switch to new branch */
git checkout -b oldbranch /* creates and switches to new branch  */


/* Diff in Branches */
git diff master..otherbranch /*  shows diff */
git diff --color-words master..otherbranch /*  shows diff in color */
git branch --merged /*  shows any merged branches */


/* Rename Branch */
git branch -m oldname newname

/* Delete  Branch */
git branch -d nameofbranch


/* Merge Branch  */
git merge branchname /* be on the receiver branch to merge the other branch */

/* Merge Conflicts between the same file on 2 branches are marked in HEAD and other branch */
git merge --abort /*  Abort basically cancels the merge */


/* Manually Fix Files and commit
The Stash */

git stash save "text message here"
git stash list /* shows whats in stash */

git stash show -p stash@{0} /* Show the diff in the stash */
git stash pop stash@{0} /*  restores the stash deletes the tash */
git stash apply stash@{0} /*  restores the stash and keeps the stash */
git stash clear /*  removes all stash */
git stash drop stash@{0}

/* Remotes

You can push and fetch to the remote server, merge any differences - then push any new to the remote - 3 branches work remote server branch, local origin master and local master

Create a repo in GitHub, then add that remote to your local repo */
git remote add origin https://github.com/neilgee/genesischild.git /*  origin can be named whatever followed by the remote */

git remote /* to show all remotes */
git remote show origin /*to see remote URL*/
git remote remove origin /* to remove remote */
git remote rm origin /* to remove remote */

/* Push to Remote from Local */

git push -u origin master /* push to remote(origin) and branch(master)

/* Cloning a GitHub Repo - create and get the URL of a new repository from GitHub, then clone that to your local repo, example below uses local repo named 'nameoffolder' */

git clone https://github.com/neilgee/genesischild.git nameoffolder

/* Push to Remote from Local - more - since when we pushed the local to remote we used -u parameter then the remote branch is tracked to the local branch and we just need to use... */

git push

/* Fetch changes from a cloned Repo */

git fetch origin /*  Pulls down latest committs from remote origin/master not origin, also pull down any branches pushed to Repo


Fetch before you work

Fetch before you pull

Fetch often */

/* Merge with origin/master */

git merge origin/master

git pull /* you can also do git pull which is = git fetch + git merge

Checkout/Copy a remote branch to local */


git branch branchname origin/branchname /*  this will bring the remote branch to local and track with the remote */

/* Delete branch */

git branch -d branchname

/* Checkout and switch branch and track to remote */

git checkout -b nontracking origin/nontracking


/* Remove remote branch */

git push origin --delete branch



Tuesday 26 May 2015

Step up authentication Use Case.

its all about the trust level (or Authentication level) in authentication scheme of authN policies related to a application domain.

Consider the following use case:

You have two web resources sampleApp/** and /bootstrap/** to protect within a same application domain stepUpProtectedApp . You want sampleApp/** should be protected with higher level of authentication than /bootstrap/**, asking some higher kind of credentials (like secret questions etc) or just re-authentication.

Solution

If you are using authN policy with authN scheme with trust level 2 for a resource, after authentication you can 
access level 2 or lower resources in that domain.

So

  1. Create an authN policy Level 2 AuthN Policy by creating a customized authN scheme custom_login_scheme Level 2 with authentication level 2 and apply this plicy to sampleApp/**
  • so first create custom_login_scheme Level 2
    Imgur
  • then create Level 2 AuthN Policy
    Imgur
  • apply Level 2 AuthN Policy to sampleApp/**
  1. Create another authN policy Level 1 AuthN Policy by creating a customized authN scheme custom_login_scheme Level with authentication level 1 and apply this plicy to bootstrap/**
  • so first create custom_login_scheme Level 1
    Imgur
  • then create Level 1 AuthN Policy
    Imgur
  • apply Level 1 AuthN Policy to bootstrap/**

Conclusion

Now if you try to access `/bootstrap/**` first, it will ask for credential and after login successfully if you try to access `sampleApp/**`, OAM will ask re-authentication.

Again if you loginto to access `sampleApp/**` and after it if you try to access `/bootstrap/**`, OAM will never challenge you.

Note: You can use any authentication scheme and change the levels to customize it.