Pages

Friday, February 20, 2015

How to configure Shibboleth 3.0 ECP

The Shibboleth 3.0 Enhanced Client Proxy (ECP) to establish the Single-Sign on between Identity Provider (IDP) to Service Provider (SP) non supported browser applications such as Desk Top and Java Client Application.

Installed Software:

1. JDK 1.8
2. Shibboleth IDP 3.0
3. Shibboleth Native Service Provider 2.5.3
4. Tomcat 8
5. Apache Http Server 2.2
6. Red Hat 6

Pre-Requisite:

1. Installed and Configured the Shibboleth Identity Provider 3.0
2. Installed and Configured the Linux Native Service Provider 2.5.3

The following components are involved to configure the shibboleth ECP between IDP to SP:

1. Identity Provider

Login to the IDP server and configure the following components to enable the Enhanced Client Proxy (ECP):

1.1 Defining ECP End Point

Go to the ID_HOME/metadata directory and add the following content in idp.metadata.xml file after <SingleSignOnService closing tag to enable the IDP ECP endpoint:

<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://shib-idp-sandbox.ops.sfsu.edu/idp/profile/SAML2/SOAP/ECP"/>

1.2 Protect the ECP Endpoint Container Authentication

   Enable the Basic Authentication at the Web Server level as follows:
 
   1.2.1 Go to the /etc/httpd/conf.d directory and create a file idp.conf
   1.2.2 Add the following content in the idp.conf file.
  
 <Location /idp/profile/SAML2/SOAP/ECP>
                AuthType Basic
                AuthName "Demo Organization- ECP profile"
                AuthzLDAPAuthoritative Off
                AuthBasicProvider ldap
                AuthLDAPURL ldap://<LdapHostName>/<Ldap Ou>?<Authentication Parameter>
                AuthLDAPBindDN "<Ldap Admin Bind Dn>"
                AuthLDAPBindPassword "<Ldap Bind Password>"
                Require valid-user
                SSLRequireSSL
</Location>





Replace LdapHostName with your Host Name, Ldap Admin Bind Dn with your admin dn, Ldap Bind Password with you password, Authentication Parameter with your own parameter. My parameter is CN. After replacing the configuration looks as follows:

<Location /idp/profile/SAML2/SOAP/ECP>
                AuthType Basic
                AuthName "Demo - ECP profile"
                AuthzLDAPAuthoritative Off
                AuthBasicProvider ldap
                AuthLDAPURL ldap://dcs01.example.edu/ou=people,dc=example,dc=edu?cn
                AuthLDAPBindDN "CN=shibadmin,OU=Users,DC=example,dc=edu"
                AuthLDAPBindPassword "password"
                Require valid-user
                SSLRequireSSL
</Location>


1.3 Restarting the Tomcat Server

Go to the tomcat_home/bin directory and execute the following commands to stop and start the tomcat server.

./shutdown.sh
./startup.sh

1.4 Restart the Apache Web Server

 Login as a root and execute the following command to restart the apache web server .

 /etc/init.d/httpd restart

2. Service Provider

Login as a root in service provider machine and perform the following tasks to enable the ECP.

2.1 Enabling the ECP 

 I have installed the shibboleth sp in /apps/shibboleth-sp directory. Go to the Shibboleth-sp/etc/shibboleth directory and edit the shibboleth2.xml file and add the ECP="true" parameter under <SSO section.

<SSO entityID="<IDp Entity>" ECP="true"
                 discoveryProtocol="SAMLDS" discoveryURL="https://shib-idp.example.ed/DS/WAYF">
              SAML2 SAML1
 </SSO>

2.2 Protecting the Resource

 After installing the shibboleth service provide and apache22.config file generated in the /apps/shibboleth-sp/etc/shibboleth directory. I have renamed  apache22.config file to shib.conf and copy to /etc/httpd/conf.d directory. By default /secure application is protected in the shib.conf file. I am using the default configuration as it is and configuration is given below:

<Location /secure>
  AuthType shibboleth
  ShibCompatWith24 On
  ShibRequestSetting requireSession 1
  require shib-session
</Location>


2.3 Restart the Apache Web Server 

  /etc/init.d/httpd restart

Testing the ECP through Java


 Sample Code


  The following sample code needs to be executed to test the ecp configuration and also modify the idPUrl to your actual Url, spUrl to your actual Sp Url, User Name with your user name and password with your password:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.opensaml.DefaultBootstrap;
import org.opensaml.xml.ConfigurationException;

import de.tudarmstadt.ukp.shibhttpclient.ShibHttpClient;


public class ShibEcpTestClient {

    private static String idpBaseUrl="https://shib-idp.example.edu";
    private static String spUrl="https://shib-sp.example.edu";
   
    private static String userName="<User Name>";
    private static String password="<Password>";

    public static void main(String[] args) {
        // TODO Auto-generated method stub
       
       
        System.setProperty("org.apache.commons.logging.Log","org.apache.commons.logging.impl.SimpleLog");
        System.setProperty("org.apache.commons.logging.simplelog.showdatetime","true");
        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http","DEBUG");
        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire","DEBUG");
       

        try {
            DefaultBootstrap.bootstrap();
        } catch (ConfigurationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
       
       
       
       
        HttpClient client= new ShibHttpClient(idpBaseUrl+"/idp/profile/SAML2/SOAP/ECP", userName, password);
        HttpGet req = new HttpGet(spUrl+"/secure");
        try
        {
            HttpResponse res = client.execute(req);
            InputStream ins= res.getEntity().getContent();
           
           
            BufferedReader br= new BufferedReader(new InputStreamReader(ins));
            String readLine=null;
            while((readLine=br.readLine()) != null)
            {
                System.out.println("Read Line Data  :"+readLine);
            }
           
           
           
               
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
   

}

   



Friday, February 13, 2015

Office 365 Integrating with Shibboleth 3.0

Enabling the Browser based Single Sign-On or Service Provider (SP) initiated Single Sign-On  between  Office 365 to Shibboleth Identity Provider (IDP 3.0) as follows:

Pre-Requisite:

1. Installed and Configured the IDP Server 3.0
2. Office 365 Domain Should be created and verified.


Shibboleth IDP 3.0 Configuration:


1. Setting the Trust IDP to SP

    1.1 Import the Office 365 metadata

    
    Go to the ID_HOME/metadata directory and execute the following command to download the office 365 metadata:

   wget https://nexus.microsoftonline-p.com/federationmetadata/saml20/federationmetadata.xml

    1.2 Register the metadata with IDP

   
    Go to the ID_HOME/conf directory and add the following content in metadata-providers.xml file:
   
<MetadataProvider id="microsoftonline"  xsi:type="FilesystemMetadataProvider" metadataFile="%{idp.home}/metadata/federationmetadata.xml"/>

 

2. Setting up the Encryption optional for SP's

    Go to the IDP_HOME/conf directory and modify the idp.properties file. 

   2.3 Modifying the idp.properties

      This configuration is required to setup optional encryption parameter for SP's metadata encryption keys. If the metadata contains encryption keys and it will apply while encrypting the data else it is optional.

 idp.encryption.optional = true



3. Releasing the Attributes from IDP to SP

   As per the Microsoft the following attributes are required for office 365 SSO:

   1. ImmutableID
   2. UserId

    Go to the IDP_HOME/conf directory and modify the attribute-resolver.xml and attribute-filter.xml file to release the attributes from IDP to SP.

   3.1 Defining Attributes in attribute-resolver.xml File 

   The following content needs to be added in the attribute-resolver.xml file:

    ImmutableID Attribute Definition
   
The immutableID is unqiue and shouldn't change any time. In my case common name (cn) is unique.

    <resolver:AttributeDefinition id="ImmutableID"  xsi:type="ad:Simple" sourceAttributeID="cn">
            <resolver:Dependency ref="myLDAP" />
            <resolver:AttributeEncoder xsi:type="enc:SAML2StringNameID" nameFormat="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" />
   </resolver:AttributeDefinition>

     The SAML2StringNameID is deprecated in shibboleth 3.0. If you want to compatible with Shibboleth IDP 3.0, you need to follow the step 5 to generate the Name ID Policy and also modify the attribute definition configuration as follows:

      <resolver:AttributeDefinition id="ImmutableID"  xsi:type="ad:Simple" sourceAttributeID="cn">
               <resolver:Dependency ref="myLDAP" />
               <resolver:AttributeEncoder xsi:type="enc:SAML2String" name="urn:mace:dir:attribute-def:ImmutableID" friendlyName="ImmutableID"  encodeType="false" />
   </resolver:AttributeDefinition>

    
 UserId Attribute Definition

<resolver:AttributeDefinition id="UserId" xsi:type="ad:Simple" sourceAttributeID="mail">
            <resolver:Dependency ref="myLDAP" />
            <resolver:AttributeEncoder xsi:type="enc:SAML2String" name="IDPEmail" friendlyName="UserId" />
   </resolver:AttributeDefinition>

 

 3.2 Releasing Attributes from IDP to SP in attribute-filter.xml File:


 The following content needs to be added in the attribute-filter.xml file:

   <afp:AttributeFilterPolicy id="PolicyForWindowsAzureAD">
        <afp:PolicyRequirementRule xsi:type="basic:AttributeRequesterString" value="urn:federation:MicrosoftOnline" />


       <!-- Release mail as Windows Azure AD User ID -->

       <afp:AttributeRule attributeID="UserId">
                <afp:PermitValueRule xsi:type="basic:ANY" />
       </afp:AttributeRule>


       <!-- Release Immutable ID to Windows Azure AD -->

       <afp:AttributeRule attributeID="ImmutableID" >
            <afp:PermitValueRule xsi:type="basic:ANY" />
       </afp:AttributeRule>

       <!-- Denying the transient ID release to Windows Azure AD -->

       <afp:AttributeRule attributeID="transientId">
            <afp:DenyValueRule xsi:type="basic:ANY"/>
       </afp:AttributeRule>

   </afp:AttributeFilterPolicy>


4. Generating the Name ID Configuration

   Go to the IDP_HOME/conf directory and modify the saml-nameid.properties and saml-nameid.xml file to generate the Persistence Name Id and this Id going to release to Service Providers as Name ID Policy and This Id going to be used to retrieve the attributes using AttributeService.
 

   4.1 Configuring the SAML Name ID

     The Name ID generation needs to be configured to release persistent ID as follows:

      Persistent ID Generator configuration in saml-nameid.properties

     
      The following properties needs to uncommented to configure the Persistence Name Id   Generator:

      idp.persistentId.generator = shibboleth.ComputedPersistentIdGenerator
      idp.persistentId.sourceAttribute = cn
      idp.persistentId.salt = changethistosomethingrandom

    In the above configuration I have chosen cn is my source attribute. If you want to modify the source attribute according to your environment. IDP going to release the name id policy as a cn persistence attribute.


   

Persistent ID Generator configuration in saml-nameid.xml

The following content needs to be added in the saml-nameid.xml file and also you need to modify the  attribute source ids. In my case my persistence source id is ImmutableID.

<ref bean="shibboleth.SAML2PersistentGenerator" />
<bean parent="shibboleth.SAML2AttributeSourcedGenerator"
            p:format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
            p:attributeSourceIds="#{ {'ImmutableID'} }" />

5. Generating Name ID Consumption Configuration

Go to the IDP_HOME/conf/c14n directory and modify the attribute-sourced-subject-c14n-config.xml and subject-c14n.xml to compatible with Attribute Encoders as per Shibboleth 3.0 Specification.

5.1 Configuring the Name ID Attribute in attribute-sourced-subject-c14n-config.xml 

 This configuration is required to add the name identifier in the attribute-sourced-subject-c14n-config.xml because IDP going to release NameIDPolicy in the SAML Assertion.  I am using the common name (cn) as the subject name identifier and I have configured the cn as follows:


    <util:list id="shibboleth.c14n.attribute.AttributesToResolve">
        <value>cn</value>
    </util:list>

    <util:list id="shibboleth.c14n.attribute.AttributeSourceIds">
        <value>cn</value>
    </util:list>

If you want to add more than one field as a subject name identifier as follows:


    <util:list id="shibboleth.c14n.attribute.AttributesToResolve">
        <value>cn</value>
        <value>mail</value>
    </util:list>

    <util:list id="shibboleth.c14n.attribute.AttributeSourceIds">
        <value>cn</value>
        <value>mail</value>
    </util:list>


Note: These attributes are configured in the attribute-resolver.xml file.


5.2 Configuring the subject-c14n.xml File


     Configuring the SAML2 Persistence Name ID

      Un-Comment the following lines to configure the SAML Name Id:

      <bean id="c14n/attribute" parent="shibboleth.PostLoginSubjectCanonicalizationFlow" />
      <ref bean="c14n/SAML2Persistent" />
    

       Configuring the SAML2 Name ID Format


       Add the <value>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</value> in the <util:list id="shibboleth.NameTransformFormats"> bean.


6. Restart the Tomcat Web Server


Office 365 Configuration:


1. Setting the Trust From SP to IDP

   
   Open the Windows Azure Active Directory Power Shell Window.
   Execute the following command to authenticate the user and also establish the connectivity from client machine to windows azure AD Server.

     Connect-MsolService

     After executing the above command, you need to provide the user name and password to authenticate the user against the windows azure ad.

    Configuring the SSO

 The following scripts needs to be executed to configure the Single Sign-On. I have used the idp-signing.crt certificate in the script because this certificate is self signed and this certificate is available in the IDP_HOME/credentials directory.


 $dom = "<Replace Your Federated Domain>"
 $idpHost="<Replace Your IDP Host>"

$fedBrandName="IDMGT Shibboleth"

$url = "$idpHost/idp/profile/SAML2/POST/SSO"
$ecpUrl = "$idpHost/idp/profile/SAML2/SOAP/ECP"
$uri = "$idpHost/idp/shibboleth"
$logoutUrl = "$idpHost/profile/SAML2/POST/SLO"


$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("idp-signing.crt")

$certData = [system.convert]::tobase64string($cert.rawdata)


Set-MsolDomainAuthentication –DomainName $dom –federationBrandName $FedBrandName -Authentication Federated  -PassiveLogOnUri $url -SigningCertificate $certData -IssuerUri $uri -ActiveLogOnUri $ecpUrl -LogOffUri $logoutUrl -PreferredAuthenticationProtocol SAMLP

Get-MsolDomainFederationSettings -DomainName $dom



Testing the SSO Will Come soon

Monday, February 9, 2015

Installing Shibboleth Native Service Provider

Installing the Shibboleth Native Service Provider 2.5.3 in Red Hat 6.6.0.2.el6.x86_64

Pre-Requisite Software:


 Install the following software using the yum repository to build the native shibboleth sp:

 yum install gcc gcc-c++ openssl-devel boost-devel libcurl-devel httpd-devel unixODBC


Software Required:

The following software needs to be installed in the sequence order to build the Native Shibboleth Service Provider. You can install shibboleth default location /opt/shiiboleth-sp installation or you can choose custom path. I have chosen my path is /apps/shibboleth-sp


1. log4shib:

1.1 Download:

 
http://shibboleth.net/downloads/log4shib/latest/log4shib-1.0.8.tar.gz

1.2 Extract:


tar xzvf log4shib-1.0.8.tar.gz

cd log4shib-1.0.8

1.3 Configure , Build, and Install


./configure --disable-static --disable-doxygen --prefix=/apps/shibboleth-sp

make

make install

2. xerces-c 3.1.1:

2.1 Download:


wget http://www.gtlib.gatech.edu/pub/apache//xerces/c/3/sources/xerces-c-3.1.1.tar.gz
 

2.2 Extract:

 tar xzvf xerces-c-3.1.1.tar.gz
 
cd xerces-c-3.1.1
 

2.3 Configure , Build, and Install

./configure --prefix=/apps/shibboleth-sp --disable-netaccessor-libcurl
 
make
 
make install

3. xml-security-c-1.7.2:

3.1 Download:


http://mirrors.ibiblio.org/apache/santuario/c-library/xml-security-c-1.7.2.tar.gz

3.2 Extract:

 tar xzvf xml-security-c-1.7.2.tar.gz

cd xml-security-c-1.7.2

After extracting the xml-security-c-1.7.2.tar.gz file and set CPPFLAGS and LDFLAGS to configure and build the xml-security-c

3.3 Configure , Build, and Install

export CPPFLAGS='-I/apps/shibboleth-sp/include'
export LDFLAGS='-L/apps/shibboleth-sp/lib'

./configure --without-xalan --disable-static --prefix=/apps/shibboleth-sp

make
 
make install

4. XML Tooling:

4.1 Download:


wget http://shibboleth.net/downloads/c++-opensaml/latest/xmltooling-1.5.3.tar.gz
 

4.2 Extract:

tar xzvf xmltooling-1.5.3.tar.gz
 
cd xmltooling-1.5.3
 

4.3 Configure , Build, and Install

./configure --with-log4shib=/apps/shibboleth-sp --prefix=/apps/shibboleth-sp -C
 
make
 
make install

5. Open SAML:

5.1 Download:

wget http://shibboleth.net/downloads/c++-opensaml/latest/opensaml-2.5.3.tar.gz
 

5.2 Extract:

tar xzvf opensaml-2.5.3.tar.gz
 
cd opensaml-2.5.3
 

5.3 Configure , Build, and Install

./configure --with-log4shib=/apps/shibboleth-sp --prefix=/apps/shibboleth-sp -C
 
make
 
make install

6. httpd mod_ssl

Install the apache 2.2 http server and  mod ssl for configuring the Shibboleth SP as follows:

yum install httpd mod_ssl

7. Shibboleth-Sp:

7.1 Download:

http://shibboleth.net/downloads/service-provider/latest/shibboleth-sp-2.5.3.tar.gz
 

7.2 Extract:

tar xzvf shibboleth-sp-2.5.3.tar.gz
 
cd shibboleth-sp-2.5.3

7.3 Configure , Build, and Install

Before building the shibboleth enable the apache version option. In my build i have installed the apache web server 2.2. In your case if you want to enable the different apache version you can enable acording to version. The apache options are enable-apache-22 and apx file option is with-apxs22
 
./configure --with-log4shib=/apps/shibboleth-sp --enable-apache-22  --with-apxs22=/usr/sbin/apxs --prefix=/apps/shibboleth-sp
 
make 

make install

Configuring the Http Server

We need to configure the http server with shibboleth sp. For that reason copy the /apps/shibboleth-sp/etc/shibboleth/apache22.config to /etc/httpd/conf.d/apache22.conf. By default apache 2.2 load the conf automatically based on the .conf extension.

I have used the default SSL configuration certs to enable the ssl.


Restart the Apache Httpd Server:

/etc/init.d/httpd restart
After restarting the http server and it will load the shibboleth2. conf file.


Starting the Shibboleth SP

Go to /apps/shiiboleth-sp/sbin and execute the following command and it will start the shibboleth sp:

./shibd

Stopping the Shibboleth SP
 
ps -ef | grep shibd
kill -9 <shibd process id>
rm -f /apps/shibboleth-sp/var/run/shibboleth/shibd.sock


Shibboleth Start and Stop Start up Script:

After starting and stopping the shibboleth sp successfully, we need to build the init script as follows:

 Go to the /etc/init.d/ and create the shibd file and add the following content:

ATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="Shibboleth 2 daemon"
NAME=shibd
SHIB_HOME=/apps/shibboleth-sp
SHIBSP_CONFIG=$SHIB_HOME/etc/shibboleth/shibboleth2.xml
LD_LIBRARY_PATH=$SHIB_HOME/lib
DAEMON=$SHIB_HOME/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
PIDFILE=$SHIB_HOME/var/run/$NAME.pid
LOCKFILE=$SHIB_HOME/var/run/shibboleth/shibd.sock
DAEMON_OPTS=""
RETVAL=0

# Force removal of socket
DAEMON_OPTS="$DAEMON_OPTS -f"

# Use defined configuration file
DAEMON_OPTS="$DAEMON_OPTS -c $SHIBSP_CONFIG"

# Specify pid file to use
DAEMON_OPTS="$DAEMON_OPTS -p $PIDFILE"

# Specify wait time to use
DAEMON_OPTS="$DAEMON_OPTS -w 30"

# Source Functions
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/shibd ]; then
        . /etc/sysconfig/shibd
fi

# Exit if the package is not installed.
[ -x "$DAEMON" ] || exit 0


case "$1" in
start)
    # Don't start shibd if NO_START is set.
    if [ "$NO_START" = 1 ] ; then
        echo "Not starting $DESC (see /etc/default/$NAME)"
        exit 0
    fi
    echo "Starting $DESC: "
    echo "$NAME."
    daemon --pidfile=${PIDFILE} $DAEMON $DAEMON_OPTS
    ;;

stop)
    echo "Stopping $DESC: "
    echo "PID File $PIDFILE"
        killproc -p ${PIDFILE} -t 30
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${PIDFILE} ${LOCKFILE}

    echo "$NAME."
    ;;

restart|force-reload)

        echo "Stopping $DESC: "
        killproc -p ${PIDFILE} -t 30
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${PIDFILE} ${LOCKFILE}

        sleep 1

        echo "Starting $DESC: "

        daemon --pidfile=${PIDFILE} $DAEMON $DAEMON_OPTS
        echo "$NAME."
        ;;
*)

        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0


In the above script modify the SHIB_HOME according to your environment.




References:

1. https://dev.e-taxonomy.eu/trac/wiki/ShibbolethSP2InstallDebianLenny
2. https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLinuxSourceBuild

Wednesday, February 4, 2015

Installing Shibboleth IDP 3.0 Linux Envronment

Installing Shibboleth IDP 3.0 Linux Envronment

The following software required to install the shibboleth IDP 3.0 in RedHat Linux:

1. Sun Java 1.8
2. Apache Tomcat 8
3. Apache Http Server 2.2
4. Shibboleth IDP 3.0


I am going to install the Apache Http Server as a root user and others all install in non-root user.


1. Sun Java 1.8

   Down load the Java Files and Extract the Java. I have extracted the java in /apps/jdk1.8.0_31 directory. After extracting the set the JAVA_HOME environment variable and JAVA PATH in the bash or command line.

export JAVA_HOME=/apps/jdk1.8.0_31
export PATH=$JAVA_HOME/bin;$PATH

2. Apache Tomcat 8

 Down load the Apache Tomcat 8 and Extract the Tomcat. I have extracted the tomcat in /apps/apache-tomcat-8.0.18 directory.

  2.1 Create the Self Signed certificate to Enable the SSL

     Go to the /apps/apache-tomcat-8.0.18/conf directory and execute the following command to create the self signed certificate to enable the SSL. The self Signed Certificate is not recommended for production. 

     keytool -genkey -keystore tomcat.jks -alias tomcat -keyalg RSA
   
     You need to provide the following details while executing the above command.

      1. Key Store Password
      2. First and Last Name. First and Last Name is Host Name.

2.2 Configuring the server.xml to enable the SSL

Add the following connector configuration below Service section 

   <Connector
    protocol="org.apache.coyote.http11.Http11NioProtocol"
    port="8443" maxThreads="200" scheme="https" secure="true"
    SSLEnabled="true"
    keystoreFile="/apps/apache-tomcat-8.0.18/conf/tomcat.jks"
    keystorePass="<Replace With Your Keystore Password>" clientAuth="false"
    sslProtocol="TLS"/>

  2.3 Start the Tomcat
 
   Go to the /apps/apache-tomcat-8.0.18/bin directory and run the ./startup.sh
   After executing the above command it will start the tomcat server.

 
3. Apache Http Server
 
   3.1 Installing the Apache Tomcat Server
 
   Login as a root and install the apache http server and mod_ssl

   yum install httpd mod_ssl

    It will install the httpd and mod_ssl. I am using the default ssl configuration and certs provided by default installation. If you want to modify the SSL configuration to import the cert and you need to modify the /etc/httpd/conf.d/ssl.conf file and replace the following properties to with certs generated.

SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
 
   3.2 Starting the Http Server
  
    Execute the /etc/inid.d/httpd restart and It will restart the server.

    3.3 Configuring the proxy_ajp.conf file
    
        Create the proxy_ajp.conf file and add the following content to invoke the apache tomcat web applications using ajp protocol. My tomcat is running under same machine.

 ProxyPass /idp/ ajp://localhost:8009/idp/ connectiontimeout=30 timeout=60

 I have used  connectiontimeout  and timeout parameter because some times tomcat server delay the response and http server will throw 404 error.

I have used /idp because idp application will reside in the tomcat server. I am going to deploy the idp application in tomcat server after installing the IDP Server.

 3.4 Re-starting the Http Server

     Follow the step 3.2 to restart the tomcat server.


4. Shibboleth IDP 3.0

   Extract the shibboleth file and I have extracted the /apps/soft/shibboleth-identity-provider-3.0.0 directory. Go to the /apps/soft/shibboleth-identity-provider-3.0.0/bin directory and execute the ./install.sh file and It will install the shibboleth 3.o as follows:

Executing the Installable File

./install.sh

Source (Distribution) Directory: [/apps/soft/shibboleth-identity-provider-3.0.0]

Choosing the Installation Directory

Enter and It will show the following option:

Installation Directory: [/opt/shibboleth-idp]

I have chosen different path because I am going to install shibboleth idp as a non-root user.  My Shibboleth idp location is

/apps/shibboleth-idp

Choosing Host Name :

Hostname: [shib-idp-sandbox.example.edu]







I have selected the default host name and press enter button and it will display the following screen.

SAML EntityID: [https://shib-idp-sandbox.example.edu/idp/shibboleth]




Choosing Attribute Scope :

Attribute Scope: [example.edu]
I have selected the default attribute scope and press enter button and it will display the following screen:


Entering the TLS and Cookie Encryption Key Password:


TLS Private Key Password:
Re-enter password:
Cookie Encryption Key Password:
Re-enter password:

Warning: /apps/shibboleth-idp/bin does not exist.
Warning: /apps/shibboleth-idp/dist does not exist.
Warning: /apps/shibboleth-idp/doc does not exist.
Warning: /apps/shibboleth-idp/system does not exist.
Warning: /apps/shibboleth-idp/webapp does not exist.
Generating Signing Key, CN = shib-idp-sandbox.example.edu URI = https://shib-idp-sandbox.example.edu/idp/shibboleth ...
...done
Creating Encryption Key, CN = shib-idp-sandbox.example.edu URI = https://shib-idp-sandbox.example.edu/idp/shibboleth ...
...done
Creating TLS keystore, CN = shib-idp-sandbox.example.edu URI = https://shib-idp-sandbox.example.edu/idp/shibboleth ...
...done
Creating cookie encryption key files...
...done
Rebuilding /apps/shibboleth-idp/war/idp.war ...
...done

Shibboleth was installed successfully.

Post Shibboleth Installation:

4.1 Setting the idp.home system variable in tomcat

Edit the /apps/apache-tomcat-8.0.18/bin/catalina.sh file and add the idp.home java system property. This property is required for loading the configuration files in the tomcat server.

JAVA_OPTS="$JAVA_OPTS -Didp.home=/apps/shibboleth-idp"

4.2 Adding the jstl-1.2.jar in the tomcat lib directory

Download the jstl-1.2.jar file and add the /apps/apache-tomcat-8.0.18/lib directory. This jar file is required for execute the velocity templates.

4.3 Deploy the idp.war file in tomcat

   Create the idp.xml file in  /apps/apache-tomcat-8.0.18/conf/Catalina/localhost/ directory and add the following content to deploy the idp.war file in tomcat

  <Context docBase="/apps/shibboleth-idp/war/idp.war"
    privileged="true"
    antiResourceLocking="false"
    antiJARLocking="false"
    unpackWAR="true"
    swallowOutput="true" />                             

4.4 Restart the tomcat

Go to the /apps/apache-tomcat-8.0.18/bin directory and execute the following commands to restart the tomcat server:

./shutdown.sh - it will stop the tomcat server
./startup.sh - it will start the tomcat server

4.5 Testing the Shibboleth Installation:


Access the shibboleth status page (https://localhost/idp/status ) and it will display the following content in the browser:

### Operating Environment Information
operating_system: Linux
operating_system_version: 2.6.32-504.8.1.el6.x86_64
operating_system_architecture: amd64
jdk_version: 1.8.0_31
available_cores: 4
used_memory: 714 MB
maximum_memory: 1751 MB

### Identity Provider Information
idp_version: 3.0.0
start_time: 2015-02-03T15:11:50-08:00
current_time: 2015-02-04T10:55:25-08:00
uptime: 71015020 ms

service: shibboleth.LoggingService
last successful reload attempt: 2015-02-03T23:11:06Z

service: shibboleth.ReloadableAccessControlService
last successful reload attempt: 2015-02-03T23:11:09Z

service: shibboleth.MetadataResolverService
last successful reload attempt: 2015-02-03T23:11:08Z

 metadata source: ShibbolethMetadata

service: shibboleth.RelyingPartyResolverService
last successful reload attempt: 2015-02-03T23:11:09Z

service: shibboleth.NameIdentifierGenerationService
last successful reload attempt: 2015-02-03T23:11:07Z

service: shibboleth.AttributeResolverService
last successful reload attempt: 2015-02-03T23:11:07Z

service: shibboleth.AttributeFilterService
last successful reload attempt: 2015-02-03T23:11:07Z




Tuesday, December 9, 2014

How to Develop and Deploy WCF REST Servvice Web Deployment Manager / Jenkins

The following steps needs to be followed to deploy the WCF REST service in IIS using the Web Deployment Manager and Jenkin. They are

1. Download and Install Web Platform Installer

2.  Open the Microsoft Web Platform Installer and Install the following components to execute the MSBuild targets and also deploy the web application in IIS through Web Deployment Manager.

  2.1 Microsoft.Net Framework 4.5

     This component is required for to install the SharpDevelop IDE and also Run time environment for the IIS. 

  2.2 Web Deployment Manager

   This component is required for to deploy the REST FULL Web Services through Remote

  2.3 Visual Studio 2010 Shell (Isolated)

This component is required for to deploy the REST FULL Web Services using MSBuild targets. For example  /p:DeployOnBuild=True

3. Install the IIS 

This step is only required if your not installed IIS in Windows 7. I have highlighted the required component in bold font. Open the Control Panel --> Programs and Features -->  Turn Windows Feature On or Off --> Select Internet Information Services and Click OK Button. It will install the IIS.

  3.1 Enabling the AST..Net Handler

   This component is required to enable the ASP.net Mapping Handler components in IIS. This component was not installed after installing the IIS.  Open the Control Panel --> Programs and Features -->  Turn Windows Feature On or Off --> Select Internet Information Services --> Select World Wide Web Services --> Select ASP.NET check box and Click OK Button. It will install the ASP.NET feature.

  3.2 Enabling the WCF Handler

   This component is required to enable the WCF Mapping Handler  components in IIS. This component was not installed after installing the IIS.  Open the Control Panel --> Programs and Features -->  Turn Windows Feature On or Off --> Select Microsoft .NET Framework 3.5.1  --> Select Windows Communication Foundation HTTP Activation and  Windows Communication Foundation Non-HTTP Activation  and Click OK Button. It will install the WCF feature.

4. Download and install the Sharpdevelop IDE

 

5. Create the REST Service Project Using the Sharpdevelop IDE

Open the SharpDeveop IDE --> File --> Solution --> C# --> WCF -->  Select WCF REST Service and Enter Name is RestDemoService and Click Create Button and It will create the WCF REST Service Project. My Sample Code is given below. I am deploying the default generated code rest full wcf servce using web deployment manager and jenkin job.


using System;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace RestDemoService
{
    [ServiceContract]
    public interface IService
    {
       [OperationContract]
       [WebGet(UriTemplate = "operation/{name}")]
       string MyOperation(string name);
    }
  
    public class Service : IService
    {
       public string MyOperation(string name)
       {
          // implement the operation
          return string.Format("Operation name: {0}", name);
       }
    }
}


6. Include the Visual Studio MSBuild Targets

 By default sharpdevlop ide was included the visual studio web application msbbuild targets. These msbuild targets are required to package the rest full wcf service as a zip file and also publish the zip files into the IIS Web Site.

Open the RestDemoService.csproj file and import the Microsoft.WebApplication.targets file. 
 
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

My windows 7 operating system is 32 bit machine and I have installed the  Visual Studio 2010 Shell 32 bit version. If your installed 64 bit version choose the path MSBuildExtensionsPath64. The sample 64 bit version as follows:

<Import Project="$(MSBuildExtensionsPath64)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />


  Include the .svc and .config file in the Package


   By default .svc and .config files are not included in the package. We need to modify the .csproj file 

Original Version:

<ItemGroup>
    <None Include="Service.svc" />
    <None Include="web.config" />
  </ItemGroup>

Modified Version:

 <ItemGroup>
    <Content Include="Service.svc" />
    <Content Include="web.config" />
  </ItemGroup>

7. Check in the Code into your repository. 

My sample repository is svn.

8. Download the Jenkins and Install


9. Configuring the MSBuild .Net Plugin


Open the Jenkin Console and Click Manage Jenkins --> Manage Plugins --> Available  --> Select MsBuild Plugin -->Click Install Without Restart Button. It will install the MSBuild .Net Plugin

10.  Configuring the MSBuild Compiler

Open the Jenkin Console and Click Manage Jenkins --> Configure System --> Add MSBuild  -->Enter the following details.

MSBuild Name: MsBuild - 4.0
Path to MSBuild: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

In my example i am using the .net framework 4.0 and I have entered the msbuild .net 4.0 as shown above.

Click Save and It will save the MSBuild Configuration.

11.  Creating the Jenkin Job


Open the Jenkin Console --> Click New Item and Enter the following details to create the Jenkin Job:

1. Enter Item Name: Rest Demo Service
2. Select Freestyle project.

Click OK Button and It will create the Jenkin Job.


12. Configuring the Source Control

Open the Jenkin Console --> Click Jenknin job Rest Demo Service -> Configure --> Select Subversion in the Source Code Management and Enter the Repository URL. After entering the URL and It will ask the Credentials. Please click the Credentials and it will authenticate the user against the SVN Authentication repository. Leave the rest of the options as it is and Click Save Button and It will configure the subversion.

13.  Triggering the Build

Open the Jenkin Console --> Click Jenknin job Rest Demo Service -> Select Poll SCM and Enter the Schedule Time. My Sample build needs to be run every 11 Hours once. I have configured as follows:

H 11 * * *

14. Configuring the Build

Open the Jenkin Console --> Click Jenknin job Rest Demo Service -> Enter the following details:

1. MSBuild Version:

    This msbuild version is already configured in the configure system. Please select the MSBuild Version in the Combo box. In My case MSBuild Version is MSBuild - 4.0

2. MSBuild Build File:

   Enter the Solution File or Project File. In my example Solution File Name is RestDemoService.sln

3. Command Line Arguments:


/t:clean /t:rebuild /p:Configuration=Debug /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=RemoteAgent /p:CreatePackageOnPublish=True /p:DeployIisAppPath="Default Web Site/RestDemoService" /p:MsDeployServiceUrl=<Remote Agent Host Name>  /p:username="Administrator User Name" /p:password=<Admin Password> 

I am deploying the application in Default Web Site/RestDemoService. You can replace with your Web Site/Application Name.

Deploying the Application Remote Server

MSDeployPublishMethod = RemoteAgent
MsDeployServiceUrl = Remote Host Name


Deploying the Application Local Machine

 MSDeployPublishMethod = InProc


username=Administrator User Name
password=Administrator Password



The above command will clean the build, compile the build and package as a zip file and publish to the IIS using the Deployment Manager using msbuild.


15. Running the Jenkin Job

Open the Jenkin Console --> Click Jenknin job Rest Demo Service -> Click Build Now. It will build the web application and deploy web application into the IIS.


16. Testing the WCF REST Service


Open the Browser and Access the following URL to test the WCF Web Service:

http://localhost/RestDemoService/Service.svc/operation/add

Response:

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Operation name: add</string> 



 

Thursday, November 20, 2014

javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.


Error:

javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.

        at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:182)
        at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:153)
        at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:284)
        at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:246)
        at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:197)
        at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:187)
        at weblogic.wsee.jaxws.spi.WLSServiceDelegate.<init>(WLSServiceDelegate.java:84)
        at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.<init>(WLSProvider.java:598)
        at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:120)
        at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:112)
        at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:83)
        at javax.xml.ws.Service.<init>(Service.java:56)
        at edu.sfsu.excs.ExchangeConnectorService.<init>(ExchangeConnectorService.java:42)
        at edu.sfsu.exchange.connector.util.ExchangeConnectorUtil.getExchangeConnectorServiceSoap(Unknown Source)
        at edu.sfsu.exchange.connector.adapter.ExchangeConnectorWrapper.buildEXCSConfig(Unknown Source)
        at edu.sfsu.exchange.connector.adapter.ExchangeConnectorProcessTask.createUser(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpEXCS_CREATEUSER.CREATEUSER(adpEXCS_CREATEUSER.java:110)
        at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpEXCS_CREATEUSER.implementation(adpEXCS_CREATEUSER.java:54)
        at com.thortech.xl.client.events.tcBaseEvent.run(tcBaseEvent.java:196)
        at com.thortech.xl.dataobj.tcDataObj.runEvent(tcDataObj.java:2492)
        at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(tcScheduleItem.java:2919)
        at com.thortech.xl.dataobj.tcScheduleItem.eventPostUpdate(tcScheduleItem.java:742)
        at com.thortech.xl.dataobj.tcDataObj.update(tcDataObj.java:664)
        at com.thortech.xl.dataobj.tcDataObj.save(tcDataObj.java:508)
        at com.thortech.xl.dataobj.tcScheduleItem.checkChildrenIfCompleted(tcScheduleItem.java:1808)
        at com.thortech.xl.dataobj.tcScheduleItem.checkChildren(tcScheduleItem.java:1852)
        at com.thortech.xl.dataobj.tcScheduleItem.eventPostUpdate(tcScheduleItem.java:723)
        at com.thortech.xl.dataobj.tcDataObj.update(tcDataObj.java:664)
        at com.thortech.xl.dataobj.tcDataObj.save(tcDataObj.java:508)
        at com.thortech.xl.dataobj.tcORC.completeSystemValidationMilestone(tcORC.java:1190)
        at com.thortech.xl.dataobj.tcOrderItemInfo.completeCarrierBaseMilestone(tcOrderItemInfo.java:735)
        at com.thortech.xl.dataobj.tcOrderItemInfo.eventPostInsert(tcOrderItemInfo.java:172)
        at com.thortech.xl.dataobj.tcUDProcess.eventPostInsert(tcUDProcess.java:237)
        at com.thortech.xl.dataobj.tcDataObj.insert(tcDataObj.java:604)
        at com.thortech.xl.dataobj.tcDataObj.save(tcDataObj.java:474)
        at com.thortech.xl.dataobj.tcTableDataObj.save(tcTableDataObj.java:2906)
        at com.thortech.xl.dataobj.tcORC.autoDOBSave(tcORC.java:3002)
        at com.thortech.xl.dataobj.util.tcOrderPackages.createOrder(tcOrderPackages.java:526)
        at com.thortech.xl.dataobj.util.tcOrderPackages.orderPackageForUser(tcOrderPackages.java:177)
        at com.thortech.xl.dataobj.tcOIU.provision(tcOIU.java:527)
        at com.thortech.xl.dataobj.tcOIU.eventPostInsert(tcOIU.java:306)
        at com.thortech.xl.dataobj.tcDataObj.insert(tcDataObj.java:604)
        at com.thortech.xl.dataobj.tcDataObj.save(tcDataObj.java:474)
        at com.thortech.xl.dataobj.tcTableDataObj.save(tcTableDataObj.java:2906)


Cause:

Renew the SSL Certificates are imported into the Web Logic Trusted Key Store.

Solution:

To resolve the above error, We need to enable ssl JSSE implementation in web logic server as follows:

1. Modify the startNodeManager.sh file
Add the JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.ssl.JSSEEnabled=true"
2. Modify the setDomainEnv.sh File
 Add the JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.ssl.JSSEEnabled=true"

After adding modifying the startNodeManager.sh and setDomainEnv.sh file and restart the Node Manager and Web Logic Managed Server and also Admin Server. The issue will be resolved.

Client Side:

If the issue is getting the client side, add the following property into a java system variable and the issue will be resolved.

-Dweblogic.security.SSL.enableJSSE=true











Monday, September 15, 2014

Configuring Openldap TLS/SSL

Configuring Openldap TLS/SSL

Environment: Cent OS 6.5 64 Bit

1. Configuring the TLS open Ldap

    The following steps needs to be performed to enable the TLS in openldap:

    1.1 Login as a root or sudo user with root previliges

    1.2 Create the ssl Directory

          Create the ssl directory to store the new Certificate Authority, Server Certicate, and Server Key.
       
      mkdir ssl
      cd ssl

     1.3 Create the new Certificate Authority

     
      Execute the following command to create the new ca

       /etc/pki/tls/misc/CA -newca
     
      The following input parameters needed after executing the newca command and I have highlighted  the steps in bold font.

      
       a) Enter Command to create the New CA Private Key
       b) Enter the PEM Pass Phrase
       c) Enter the CA Certificate details and the Common Name is mandatory field.
             
     
      CA certificate filename (or enter to create)
   
     stored in the /etc/pki/CA/private/ as a cakey.pem.
     
Making CA certificate ...
Generating a 2048 bit RSA private key
................................+++
..................+++
writing new private key to '/etc/pki/CA/private/./cakey.pem'


Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:US
State or Province Name (full name) []:CA
Locality Name (eg, city) [Default City]:San Francisco
Organization Name (eg, company) [Default Company Ltd]:Example.EDU
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:Example.EDU
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for /etc/pki/CA/private/./cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 9263543358417925999 (0x808eb79aa7edf76f)
        Validity
            Not Before: Sep 15 16:35:54 2014 GMT
            Not After : Sep 14 16:35:54 2017 GMT
        Subject:
            countryName               = US
            stateOrProvinceName       = CA
            organizationName          = Example.EDU
            commonName                = Example.EDU
        X509v3 extensions:

            X509v3 Subject Key Identifier:
                10:45:D2:A1:9F:2D:3C:69:8D:86:AD:48:CD:97:3C:97:13:B2:A1:AA
            X509v3 Authority Key Identifier:
                keyid:10:45:D2:A1:9F:2D:3C:69:8D:86:AD:48:CD:97:3C:97:13:B2:A1:AA

            X509v3 Basic Constraints:
                CA:TRUE
Certificate is to be certified until Sep 14 16:35:54 2017 GMT (1095 days)

Write out database with 1 new entries
Data Base Updated


   1.4 Copy the CA certificate from /etc/pki/CA/newcerts/ to ssl

The ca certificate stored in the  /etc/pki/CA/newcerts/ as a random generated string with pem extension. In my example ca certificate name is 808EB79AA7EDF76F.pem.

cp /etc/pki/CA/newcerts/808EB79AA7EDF76F.pem exampleca.pem

You can replace example.pem to your own name.

  1.5 Creating the Cert Reqest

   The following command is being used to create the cert request and it requires the common name parameter as a mandatory parameter and that parameter should be host name of the openldap server. In my example host name is localhost.localdomain.

openssl req -new -nodes -keyout newreq.pem -out newreq.pem





The -nodes argument above prevents encryption of the private key. OpenLDAP only works with unencrypted private keys


Generating a 2048 bit RSA private key
...............................................................................................................................................+++
.+++
writing new private key to 'newreq.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:US
State or Province Name (full name) []:CA
Locality Name (eg, city) [Default City]:San Francisco
Organization Name (eg, company) [Default Company Ltd]:Example
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:localhost.localdomain
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:


After executing the above command it will create the newreq.pem file in the ssl directory.


   1.6 Signing the Certificate

Execute the following command to sign the certificate and it will stored in the ssl directory as newcert.pem.

/etc/pki/tls/misc/CA -sign


sing configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for /etc/pki/CA/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 9263543358417926000 (0x808eb79aa7edf770)
        Validity
            Not Before: Sep 15 16:43:45 2014 GMT
            Not After : Sep 15 16:43:45 2015 GMT
        Subject:
            countryName               = US
            stateOrProvinceName       = CA
            localityName              = San Francisco
            organizationName          = Example
            commonName                = localhost.localdomain
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            Netscape Comment:
                OpenSSL Generated Certificate
            X509v3 Subject Key Identifier:
                83:46:4D:C7:B6:3A:3F:62:3B:87:D5:C4:75:10:18:07:FC:45:5D:9A
            X509v3 Authority Key Identifier:
                keyid:10:45:D2:A1:9F:2D:3C:69:8D:86:AD:48:CD:97:3C:97:13:B2:A1:AA

Certificate is to be certified until Sep 15 16:43:45 2015 GMT (365 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 9263543358417926000 (0x808eb79aa7edf770)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=US, ST=CA, O=Example.com, CN=Example.EDU
        Validity
            Not Before: Sep 15 16:43:45 2014 GMT
            Not After : Sep 15 16:43:45 2015 GMT
        Subject: C=US, ST=CA, L=San Francisco, O=Example, CN=localhost.localdomain
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:c2:20:e8:2b:c3:5c:0d:90:cc:ad:81:3c:34:08:
                    fc:36:d0:ca:6a:0c:06:8c:46:4f:c3:4f:1f:ef:b7:
                    b1:50:42:a7:43:5d:88:73:2f:d2:3e:0a:4e:fe:50:
                    ae:0f:65:26:17:a4:24:cc:4f:1f:5b:72:81:61:fc:
                    ec:32:8e:0f:e5:c3:8e:89:da:87:a7:25:b1:b2:e1:
                    29:db:7e:17:c1:a0:d1:df:80:f1:54:94:2d:30:ef:
                    ab:9f:61:ac:70:24:29:41:7e:a1:31:9f:d4:41:4e:
                    db:23:2e:75:49:b4:c5:e5:92:b2:5f:d9:4b:bd:e3:
                    13:0f:e7:4b:56:a0:bf:70:9b:61:e7:e1:cc:2e:ea:
                    e6:a2:cc:68:ad:83:02:ef:ce:40:31:3f:6a:c4:a0:
                    01:d1:b2:e8:08:a8:a2:93:5f:35:76:56:80:47:3a:
                    4e:65:b3:86:3d:7c:b6:a0:50:66:ca:52:15:7f:f0:
                    4b:41:8e:4d:77:b0:45:ca:f7:ed:ae:c9:a8:26:4e:
                    3d:76:7a:70:f3:ca:ab:2f:89:4c:e3:bb:22:be:24:
                    93:c5:4f:19:c4:a5:3d:99:14:2b:8b:9d:97:57:51:
                    24:c5:d8:88:75:98:fb:d7:35:f7:2c:ab:41:a6:88:
                    40:14:46:c1:2b:88:f7:0c:68:85:97:a8:ad:bb:56:
                    4d:91
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            Netscape Comment:
                OpenSSL Generated Certificate
            X509v3 Subject Key Identifier:
                83:46:4D:C7:B6:3A:3F:62:3B:87:D5:C4:75:10:18:07:FC:45:5D:9A
            X509v3 Authority Key Identifier:
                keyid:10:45:D2:A1:9F:2D:3C:69:8D:86:AD:48:CD:97:3C:97:13:B2:A1:AA

    Signature Algorithm: sha1WithRSAEncryption
         aa:03:f3:dc:bc:20:88:ba:bc:3d:16:06:17:c5:25:a7:87:c8:
         18:96:a8:e0:33:9e:21:3f:ce:a0:54:c8:fd:13:c3:9c:3a:c7:
         1d:d7:0d:b3:8d:a9:64:9f:bf:32:50:59:26:2a:2d:9c:a6:fa:
         f7:67:87:ec:1e:f3:ac:0e:9f:b5:48:47:56:af:93:a5:b7:86:
         bf:9c:63:f7:ab:25:73:d1:8e:55:79:2a:7a:23:16:21:77:28:
         93:ad:a8:64:eb:bc:07:e7:a0:eb:14:69:61:b5:52:a9:2a:47:
         ef:84:9d:c6:5b:1d:c8:bd:8b:b4:61:64:14:88:91:45:68:4f:
         17:61:b1:33:f7:9c:3d:91:a9:31:33:54:ed:9b:7b:13:35:22:
         36:1b:52:23:fe:20:f4:3b:33:74:6f:71:fb:e5:ed:76:28:92:
         00:69:d6:12:03:44:a6:c8:02:ed:72:c1:7e:57:57:0c:58:a2:
         95:a3:db:1c:57:89:b6:92:64:64:4e:f2:2d:d2:8f:95:35:91:
         1b:4c:cd:89:87:44:01:68:2c:91:c9:af:79:69:0b:b1:a2:75:
         a3:15:2f:35:02:a3:26:08:5d:01:6f:6b:8e:d0:f3:36:f7:4f:
         c2:26:d2:a0:7f:ce:cc:36:b1:5a:2a:fb:fb:26:f6:93:c9:87:
         1b:59:fe:c4
-----BEGIN CERTIFICATE-----
MIIDqDCCApCgAwIBAgIJAICOt5qn7fdwMA0GCSqGSIb3DQEBBQUAMEYxCzAJBgNV
BAYTAlVTMQswCQYDVQQIDAJDQTEUMBIGA1UECgwLRXhhbXBsZS5jb20xFDASBgNV
BAMMC0V4YW1wbGUuRURVMB4XDTE0MDkxNTE2NDM0NVoXDTE1MDkxNTE2NDM0NVow
ZDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1TYW4gRnJhbmNp
c2NvMRAwDgYDVQQKDAdFeGFtcGxlMR4wHAYDVQQDDBVsb2NhbGhvc3QubG9jYWxk
b21haW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDCIOgrw1wNkMyt
gTw0CPw20MpqDAaMRk/DTx/vt7FQQqdDXYhzL9I+Ck7+UK4PZSYXpCTMTx9bcoFh
/Owyjg/lw46J2oenJbGy4SnbfhfBoNHfgPFUlC0w76ufYaxwJClBfqExn9RBTtsj
LnVJtMXlkrJf2Uu94xMP50tWoL9wm2Hn4cwu6uaizGitgwLvzkAxP2rEoAHRsugI
qKKTXzV2VoBHOk5ls4Y9fLagUGbKUhV/8EtBjk13sEXK9+2uyagmTj12enDzyqsv
iUzjuyK+JJPFTxnEpT2ZFCuLnZdXUSTF2Ih1mPvXNfcsq0GmiEAURsEriPcMaIWX
qK27Vk2RAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5T
U0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBSDRk3Htjo/YjuH1cR1
EBgH/EVdmjAfBgNVHSMEGDAWgBQQRdKhny08aY2GrUjNlzyXE7KhqjANBgkqhkiG
9w0BAQUFAAOCAQEAqgPz3LwgiLq8PRYGF8Ulp4fIGJao4DOeIT/OoFTI/RPDnDrH
HdcNs42pZJ+/MlBZJiotnKb692eH7B7zrA6ftUhHVq+TpbeGv5xj96slc9GOVXkq
eiMWIXcok62oZOu8B+eg6xRpYbVSqSpH74SdxlsdyL2LtGFkFIiRRWhPF2GxM/ec
PZGpMTNU7Zt7EzUiNhtSI/4g9DszdG9x++XtdiiSAGnWEgNEpsgC7XLBfldXDFii
laPbHFeJtpJkZE7yLdKPlTWRG0zNiYdEAWgskcmveWkLsaJ1oxUvNQKjJghdAW9r
jtDzNvdPwibSoH/OzDaxWir7+yb2k8mHG1n+xA==
-----END CERTIFICATE-----
Signed certificate is in newcert.pem

  1.7 Renaming the Certicates

    This step is optional. For naming convention we are renaming the certs.

     mv newcert.pem servercert.pem
     mv newreq.pem serverkey.pem

  1.8 Copy the Certifcates from ssl to /etc/openldap/certs/


    cp exampleca.pem /etc/openldap/certs/
    cp server* /etc/openldap/certs/

  1.9 Change the OwnerChip from root to ldap

   chown ldap:ldap /etc/openldap/certs/exampleca.pem
   chown ldap:ldap /etc/openldap/certs/server*

  1.10  Include the Server Certificate and Server Key in the cn=Config Object

ldapmodify -D cn=config -H ldap://localhost.localdomain -W
Enter Password:

dn: cn=config
changetype: modify
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/servercert.pem

dn: cn=config
changetype: modify
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/openldap/certs/serverkey.pem

   1.11 Modifying the ldap.conf file in the /etc/openldap/

    Add the following parameters into the ldap.conf file to enable the TLS.

   SSL ON
   TLS_CACERTDIR   /etc/openldap/certs
   TLS_REQCERT Allow

  1.12 Restart the OpenLdap Server

  /etc/init.d/slapd stop
  /etc/init.d/slapd start


   1.3 Testing the TLS

ldapsearch -H ldap://localhost.localdomain -D cn=Manager,dc=example,dc=edu -b dc=example,dc=edu -s base -W -ZZ
 
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=edu> with scope baseObject
# filter: (objectclass=*)
# requesting: ALL
#

# example.edu
dn: dc=example,dc=edu
objectClass: dcObject
objectClass: organization
o: Example
dc: example

# search result
search: 3
result: 0 Success

# numResponses: 2
# numEntries: 1
In the above command i have used -ZZ parameter because to start the TLS Session and also it mandatory to start the TLS Session.


2. Configuring the SSL open Ldap

      2.1 Modify the /etc/sysconfig/ldap file

       Modify the following parameters in the /etc/sysconfig/ldap file to enable the   ssl

SLAPD_LDAPS=yes

    2.2 Restart the OpenLdap Server

     Restart the Open Ldap Server and Take effect the changes.
     
     /etc/init.d/slapd stop
     /etc/init.d/slapd start

     2.3 Testing the SSL Configuration

ldapsearch -H ldaps://localhost.localdomain -D cn=Manager,dc=example,dc=edu -b dc=example,dc=edu -s base -W
 
Enter LDAP Password:
 
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=edu> with scope baseObject
# filter: (objectclass=*)
# requesting: ALL
#

# example.edu
dn: dc=example,dc=edu
objectClass: dcObject
objectClass: organization
o: Example
dc: example

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

3. References


Tuesday, September 9, 2014

ldap_add: Other (e.g., implementation specific) error (80) additional info: olcRefintAttribute : attribute type undefined

Hi

Error:

I got the following error while adding the config object to the openldap.

ldapadd -D cn=Config -H ldap://localhost -W

dn: olcOverlay=refint,olcDatabase={2}bdb,cn=config
changetype: add
objectClass: olcConfig
objectClass: olcRefIntConfig
objectClass: olcOverlayConfig
objectClass: top
olcRefIntAttribute: memberof member manager owner seeAlos
olcOverlay: refint


ldap_add: Other (e.g., implementation specific) error (80)
    additional info: olcRefintAttribute <seeAlos>: attribute type undefined

Cause:

seeAlos attribute not available in the schema and also syntax error.

Solution:

I have modified the attribute name from seeAlos to seeAlso and issue is resolved.


Tuesday, July 29, 2014

OIM Account Restore User Status From Deleted to Active

Restoring the Deleted Account in OIM


When you delete the user from the Oracle Identity Manager System, the user will not been removed physically from the system and also it changes the status from Active to Deleted. It also revoke the resources from the target system for the deleted user.


I need to reactivate the deleted user from the Oracle Identity Manager as follows:

1. Login to the OIM data base user into the data base and update the user status from Deleted to Active.

2. Execute the following sql to update the user status

UPDATE USR SET USR_STATUS = 'Active' WHERE usr_login='login id'

replace login id with your login id.

3. Login to the OIM Admin Console and verify the user status is changed  from Deleted to Active.

4. Re-Provision the users.