Tuesday, December 1, 2009

gcc library missing during run

edit /etc/ld.so.conf and run ldconfig.

In fedora
/etc/ld.so.conf -> include /etc/ld.so.conf.d/

all config in the above folder should include lib directory

e.g. pbc.conf
/usr/local/lib


http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/dlls.html

Tuesday, October 20, 2009

SunJDK weblogic

Reference: http://buttso.blogspot.com/2009/09/switching-between-jrockit-and-sun-jdk.html


Switching Between JRockit and Sun JDK with WebLogic Server

Need to swap between JRockit and the Sun JDK when starting your WebLogic Server instance?

Looking at the start scripts $DOMAIN_HOME/bin/setDomainEnv.cmd, I just realized that this operational task is basically taken care of in the scripts we have.

To swap between the Sun JDK and JRockit to launch a WLS instance, all you need to do is set the JAVA_VENDOR environment variable to either "Sun" or "Oracle" and the scripts will take of launching WLS using the specified JDK.

Snippets from setDomainEnv.cmd:
set BEA_JAVA_HOME=d:\wls1031\jrockit_160_05_R27.6.2-20
set SUN_JAVA_HOME=d:\wls1031\jdk160_11

if "%JAVA_VENDOR%"=="Oracle" (
set JAVA_HOME=%BEA_JAVA_HOME%
) else (
if "%JAVA_VENDOR%"=="Sun" (
set JAVA_HOME=%SUN_JAVA_HOME%
) else (
set JAVA_VENDOR=Sun
set JAVA_HOME=d:\wls1031\jdk160_11
)
)

Where JAVA_HOME is then used by startWebLogic.cmd script when it launches the WLS instance to identify the JDK to use.

Snippets from startWebLogic.cmd
%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS%
-Dweblogic.Name=%SERVER_NAME%
-Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy
%JAVA_OPTIONS%
%PROXY_SETTINGS%
%SERVER_CLASS%

With this information at hand, then switching between the two different JDKs is as simple as setting an environment variable before launching WebLogic Server.

Using JRockit:
>set JAVA_VENDOR=Oracle
>startWebLogic.cmd
...
d:\wls1031\JROCKI~1.2-2\bin\java -jrockit -Xms512m -Xmx512m -Dweblogic.Name=AdminServer ...

And just as easy to switch back to Sun. Note here that you could just unset the JAVA_HOME environment variable, which will set the script to use whatever default was configured when the domain was created.

Using Sun JDK:
>set JAVA_VENDOR=Sun
>startWebLogic.cmd
...
d:\wls1031\JDK160~1\bin\java -client -Xms256m -Xmx512m -Dweblogic.Name=AdminServer ...

Monday, October 12, 2009

OpenSSL resources

http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html
http://www.herongyang.com/crypto/OpenSSL_Signing_keytool_CSR_5.html
http://security.ncsa.uiuc.edu/research/grid-howtos/usefulopenssl.php

To view the details of the certificate signing request contained in the file server.csr, use:
openssl req -noout -text -in server.csr


c:\OpenSSL\bin\openssl asn1parse -inform der -in demo.p7 -i > c:\demo.asn1

c:\OpenSSL\bin\openssl pkcs7 -inform der -in demo.p7 -text -print_certs -noout

View certificate details
C:\Program Files\LunaPCI\keys>openssl x509 -inform PEM -in cert0.cer -text


------------------------------------------------------------------------------

1) Generate RSA key:
$ openssl genrsa -out key.pem 1024
$ openssl rsa -in key.pem -text -noout

2) Save public key in pub.pem file:
$ openssl rsa -in key.pem -pubout -out pub.pem
$ openssl rsa -in pub.pem -pubin -text -noout

3) Encrypt some data:
$ echo test test test > file.txt
$ openssl rsautl -encrypt -inkey pub.pem -pubin -in file.txt \
-out file.bin
$ ll file.bin
-rw-r--r-- 1 root root 128 2007-07-11 01:58 file.bin

4) Decrypt encrypted data:
$ openssl rsautl -decrypt -inkey key.pem -in file.bin
test test test

But you should have public key in so called SubjectPublicKeyInfo format
(look at RFC2459).
You can look at ASN.1 structure of public key with command:
$ openssl asn1parse -in pub.pem
0:d=0 hl=3 l= 159 cons: SEQUENCE
3:d=1 hl=2 l= 13 cons: SEQUENCE
5:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption
16:d=2 hl=2 l= 0 prim: NULL
18:d=1 hl=3 l= 141 prim: BIT STRING

Sample Public key
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRzVwcS4JP8K5iihVc4j26QZWp
4n4Bh9cTxdCovsrCd50lxPNRUPPGqPcPwYGLVyyTG8+DR9RtqcVrC3gYtI20G2+0
HbWTRWAAa/LF/x937nt3Q92CDu010eRY0CDtvyLcg90yLV/84TOc5PRwbCwuURgu
3Nzn+7BiEZ7lYCyXGQIDAQAB
-----END PUBLIC KEY-----


------------------------------------------------------------------------------
For public key in hex64 ending with '==', use openssl asn1parse -in c:\maybank.pem

-----BEGIN PUBLIC KEY-----
MIGIAoGAq74V/tQfDXWpO821eujW9MOpSROdVKQXncV3m+k1K0Vmnu8QGSzvFq5cBe7R6uHB
/J5gHKwFVG6XgrqjVa46gprk+8vQFfLfshHcFf/Vv79Ykpj0/PWaCAvp7uvcFKKByb1cDhAu
PDmzbBJYMyg7nG3dmAzhEqPK+LLOQ5s7mHkCAwEAAQ==
-----END PUBLIC KEY-----

------------------------------------------------------------------------------








Thursday, October 8, 2009

Netbeans Sign jar

http://ezzatron.com/2009/09/29/automatically-signing-jar-files-in-netbeans/

Wednesday, September 9, 2009

Vmware: Weblogic 9.2, solaris 9, JDK 1.5_12

1. Download solaris 9 from sun.com //Hint: Use Sun download manager
2. Download Weblogic 9.2 from BEA(Oracle) website
3. Download Sun JDK 1.5_12 from sun.com for solaris.

4. Install Solaris 9 iso onto vmware
http://pubs.vmware.com/guestnotes/wwhelp/wwhimpl/common/html/wwhelp.htm?context=guestnotes&file=guestos_solaris9.html

5. Install JDK 1.5_12 into iso
http://java.sun.com/j2se/1.5.0/install-solaris.html
6. Install BEA Weblogic 9.2 referencing JDK 1.5_12
http://download.oracle.com/docs/cd/E13196_01/platform/suppconfigs/configs/solaris/solaris9_91.html#96804

Friday, September 4, 2009

WebLogic truststore keystore

references:
http://jonwilliams.wordpress.com/2009/07/27/configure-ssl-for-nodemanager/
http://download.oracle.com/docs/cd/E13222_01/wls/docs92/ConsoleHelp/taskhelp/security/ConfigureKeystoresAndSSL.html
http://download.oracle.com/docs/cd/E13222_01/wls/docs92/secmanage/ssl.html


Weblogic default
-keystore : DemoIdentity.jks \ DemoIdentityKeyStorePassPhrase
-truststore : DemoTrust.jks \ DemoTrustKeyStorePassPhrase

Sunday, August 2, 2009

Java Tracing & logging

Reference from: http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/tracing_logging.html

Tracing

Tracing is a facility to redirect any output in the Java Console to a trace file.

Java Plug-in

Tracing can be turned on by enabling the property javaplugin.trace. However, it turns on all tracing facilities inside Java Plug-in. To enable more fine-grained tracing, javaplugin.trace.option may be used. You can set trace-level options (0-5) in the Java Console, shown in the previous chapter, with the following meanings:

  • 0 — off
  • 1 — basic
  • 2 — network, cache, and basic
  • 3 — security, network and basic
  • 4 — extension, security, network and basic
  • 5 — LiveConnect, extension, security, network, temp, and basic

This enables tracing on the fly.

Another way to set fine-grained tracing is through the Java Control Panel. For instance, to enable tracing for everthing (option 5 above), enter the following in the "Java Run Time Parameters" textfield:

-Djavaplugin.trace=true
-Djavaplugin.trace.option=basic|net|cache|security|ext|liveconnect|temp

Tracing set through the Control Panel will take effect when the Plug-in is launched, but changes made through the Control Panel while a Plug-in is running will have no effect until restart.

Java Web Start

To set the initial trace level for a Java Web Start application set the deployment property deployment.trace.level. The deployment.trace.level property can have one of the following values:

  • basic
  • cache
  • net
  • security
  • ext
  • liveconnect

To use all the tracing level set deployment.trace.level to all.

Logging

Similar to tracing, logging is a facility to redirect any output in the Java Console to a log file using the Java Logging API. To enable logging perform the following actions:

  • Open Java Control Panel
  • Click Advanced tab.
  • Select Enable Logging under the Debugging option

Other Options

File Names

The names of the trace and log files are

plugin.trace
plugin.log

where the includes the major, minor and patch version numbers; e.g., plugin142_06.trace or plugin150.log

File Locations

The default location (directory) of the trace and log files is:

  • /.java/deployment/log on Unix/Linux
  • \Sun\Java\Deployment\log on Windows

where is as defined here.

If the environment variable USER_JPI_PROFILE is set to then the trace and log files will be written to:

  • /.java/deployment/log on Unix/Linux
  • \Sun\Java\Deployment\log on Windows