Pages

Monday 27 August 2012

Adding Microsoft SQL Server JDBC Driver to your local Maven repository

The Microsoft SQL Server JDBC driver is not available in public repositories because of licensing issues but it is easy to install into into the local repository on your machine. This procedure can be used for other libraries as well.


Extract the file and locate the sqljdbc4.jar.


Download the driver JAR from the link provided by Olaf and add it to your local Maven repository with;


mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0


Modify your POM


<dependency>
  <groupId>com.microsoft.sqlserver</groupId>
  <artifactId>sqljdbc4</artifactId>
  <version>4.0</version>
</dependency>

provide your pom the repository of your local machine

<repository>
   <id>local</id>
   <name>local</name>
   <url>file://C:/Users/mywindows/.m2/repository</url>
</repository>


Tuesday 7 August 2012

Generate CSR for Apache-SSL



To generate a CSR on Apache, perform the following steps:
To generate a CSR, a key pair must be created for the server. These two items are a digital certificate key pair and cannot be separated. If the public/private key file or password is lost or changed before the SSL certificate is installed, the SSL certificate will need to be re-issued. The private key, CSR, and certificate must all match in order for the installation to be successful.

The following sequence of commands will generate a 2048 bit key, encrypt it using the triple-DES cipher, and create a CSR based upon it (they assume that openssl is in the path - if not then prefix the openssl command with the path to the binary). It is recommended to use the domain name that will be used for the certificate as the core of the filenames. Also make sure that any existing keys and CSR's are NOT overwritten.


Step 1: Generate Private Key


The utility "OpenSSL" is used to generate the key and CSR. This utility comes with the OpenSSL package and is usually installed under /usr/local/ssl/bin. If the utility was installed elsewhere, these instructions will need to be adjusted accordingly.

Type the following command at the prompt:

openssl genrsa -des3 -out www.yourdomain-example.com.key 2048




This command generates a 2048 bit RSA private key and stores it in the file examplePrivateKey.key.

Note: For all SSL certificates, the CSR key bit length must be 2048.

When prompted for a pass phrase: enter a secure password and remember it, as this pass phrase is what protects the private key. Both the private key and the certificate are required to enable SSL.

NOTE: To bypass the pass phrase requirement, omit the -des3 option when generating the private key. If the private key is left unprotected, RapidSSL recommends access to the server be restricted so that only authorized server administrators can access or read the private key file.

Step 2: Generate the CSR

Type the following command at the prompt:

openssl req -new -key examplePrivateKey.key -out exampleCSR.csr



This command will prompt for the following X.509 attributes of the certificate:




Country Name: Use the two-letter code without punctuation for country, for example: US or CA.

State or Province: Spell out the state completely; do not abbreviate the state or province name, for example: California

Locality or City: The Locality field is the city or town name, for example: Berkeley. Do not abbreviate. For example: Saint Louis, not St. Louis

Company: If the company or department has an &, @, or any other symbol using the shift key in its name, the symbol must be spelled out or omitted, in order to enroll. Example: XY & Z Corporation would be XYZ Corporation or XY and Z Corporation.

Organizational Unit: This field is optional; but can be used to help identify certificates registered to an organization. The Organizational Unit (OU) field is the name of the department or organization unit making the request. To skip the OU field, press Enter on the keyboard.

Common Name: The Common Name is the Host + Domain Name. It looks like "www.rapidssl.com" or "rapidssl.com".

Generate a Certificate Signing Request (CSR) for -Tomcat

Keystore and CSR generation


Generate a private key with the following command:
$JAVA_HOME/bin/keytool -genkey -alias <your_alias_name> -keyalg RSA -keystore <your_keystore_filename> -keysize 2048
You will be prompted for a password. Tomcat uses a default password of "changeit". If you use a different password, you will need to specify a custom password in the server.xml configuration file.
The next field that you will be prompted for is "What is your first and last name?" At this prompt, you must specify the common name (FQDN) of your web site.
You will then be prompted for your organizational unit, organization, etc.

Generate the Certificate Signing Request (CSR):
$JAVA_HOME/bin/keytool -certreq -keyalg RSA -alias <your_alias_name> -file certreq.csr -keystore <your_keystore_filename>
You will now be prompted for the common name, organization, etc. The keytool will use the values that you specify when generating the private key

Create a copy of the keystore file. Having a back-up file of the keystore at this point can help resolve installation issues that can occur when importing the certificate into the original keystore file.

Tuesday 7 February 2012

AppDynamics Lite


AppDynamics is the very first free product designed for troubleshooting java performance while getting full visibility in production environments.