Friday, 6 November 2009

Correct openmotif for suse 10

I have the correct version of openmotif on suse 10, the version that the oracle’s installation guide said, but I have a lot of errors on my oas because of openmotif, so I have to obtain a fixed version of the Motif 2.1.30 package from Novell support:
If you have “openmotif21-libs-2.1.30MLI4-143.2” , then it needs to be replaced by:

  • RPM for x86_64 machines:
openmotif21-
libs-32bit-2.1.30MLI4-143.2.PTF.378190.0.x86_64.rpm
or
     openmotif21-libs-32bit-2.1.30MLI4-143.6.x86_64.rpm


  • RPM for x86 32-bit machines:
openmotif21-libs-2.1.30MLI4-143.2.PTF.378190.0.i586.rpm
or
openmotif21-libs-2.1.30MLI4-143.6.i586.rpm



Notes:
1.      Please note that the extension “PTF.378190.0” does not change the package version, but indicates a temporary bug fix inclusion (that is required in this case).
2.      As of January 2009, there is a new package version available (shown above) which has this bug fix included into a regular package version:
            openmotif21-libs-2.1.30MLI4-143.6.i586.rpm (32bit)
           openmotif21-libs-32bit-2.1.30MLI4-143.6.x86_64.rpm

           (64bit)
           This package has been tested successfully inhouse.


After replace the openmotif all these errors on my oas was :


·         Error: Frm-92102
oracle.forms.net.ConnectionException:500

·         Error on OC4J_BI_FORMS’s server.log
/opt/oracle/bi_forms/j2ee/OC4J_BI_Forms/log/OC4J_BI_Forms_default_island_1/server.log
java.lang.UnsatisfiedLinkError: /opt/oracle/bi_forms/lib/librwu.so: /usr/X11R6/lib/libXm.so.2: undefined symbol: _Xsetlocale

The report server will cause OC4J_BI_Forms to fail with an error similar to below if you do not have the proper openmotif RPM installed on you system:
    * 08/01/04 05:31:03 Oracle Application Server Containers
      for J2EE 10g (10.1.2.2.0) initialized
      08/01/04 05:31:03 ListenerServlet init()
      08/01/04 05:31:29 java.lang.UnsatisfiedLinkError:
      <oracle_home>/lib/librwu.so:
      /usr/X11R6/lib/libXm.so.2: undefined symbol: _Xsetlocale
      oracle.reports.server.RWServer.startServer
(RWServer.java:289)
      08/01/04 05:31:29 at      java.lang.Thread.run(Thread.java:534)
      **********************************

·         Error on OC4J_BI_FORMS’s application.log
/opt/oracle/bi_forms/j2ee/OC4J_BI_Forms/application-deployments/discoverer/OC4J_BI_Forms_default_island_1/application.log

09/08/21 09:37:55 discoverer: [ERROR] [Orion Launcher] oracle.discoverer.applications.viewer.view.DiscovererPageBroker.init oracle.discoverer.applications.protocol
system property is not set.Defaultinf to http

·         Error on report showjobs pages

REP-52266: The in-process Reports Server rep_oas_bi_forms failed to start.java.lang.InterruptedException


Get PORTAL password

On Portal 10.1.2.0.2 or Portal 10.1.4 on OAS 10.1.2.1.2 to get the password of portal user:

1. Please run the following so we can get the PORTAL password:

ldapsearch -D "cn=orcladmin" -w orcladmin1 -p 389 -h oidhostname.domain -b "cn=IAS,cn=Products,cn=OracleContext" -s sub -v OrclresourceName=PORTAL orclpasswordattribute

Check the line in the output:-

orclpasswordattribute = ------------



2. Alter the portal password in SQL*Plus to match what has been displayed from the ldapsearch command in step 1.


3. Access the Application Server Control and change the Portal password to any new password that you want (this is the correct way of doing it, since it changes the OID and Database passwords and mantain them in sync).

Go to Application server control - Midtier instance - Infrastructure link at the top - Change schema password - Select the 'PORTAL' schema radio button and change the password and Click OK.

Thursday, 5 November 2009

libXm.so.2: cannot open shared object file

When i was installing component Business Intelligence and Forms of oracle application server 10g R2 (10.1.2.1.2) on suse 9 64 bit i got this error:

j ava.lang.UnsatisfiedLinkError: /opt/oracle/bi_forms2/lib/librwu.so: libXm.so.2: cannot open shared object file: No such file or directory

I had to download the openmotif that forms need, so check this url http://c2anton.blogspot.com/2006/05/installing-oracle-10g-as-w-forms-on.html

Ulimit not set as expected - oas 10.1.2 suse 9

When i was installing oracle application server 10g release 10.1.2 on suse 9 32 bit the set of ulimit on oracle user was not setting correctly, the cause was:

The mechanism used to set the ulimit depends on PAM limits being used, but the required module(pam_limits.so) is not loaded by default for various applications (ssh, gdm, kde, xdm,su ). The OracleAS 10g installation guide only explains how to configure the "login" mechanism.

In addition to setting the hard and soft values in /etc/security/limits.conf, add the line "session required pam_limits.so" in file used for your session type. Change of the following files may be required
/etc/pam.d/login
/etc/pam.d/su
/etc/pam.d/sshd
/etc/pam.d/xdm
/etc/pam.d/gdm
/etc/pam.d/kde

Some linux installations are using pam system_auth service. Limits for most applications are set changing /etc/pam.d/system_auth

Configure Oracle Application Server 10.1.2

I have install OAS 10g R2 (infraestructure and Business Intelligence and Forms component) on suse 9 32 bit, suse 9 64 bit and suse 10 64 bit, so I will describe here the steps that I follow to configure oas to use forms and reports 10g:

1.      First of all, before start editing files do a configuration backup of the middletier and the infraestructure.

It is necessary to put the database on archivelog to do the backup of infraestructure:
To enable ARCHIVELOG mode:
1.      Run the following sql query to check if the flashback_recovery_area is setup:
         show parameters db_recovery

If the flashback_recovery_area is setup, the query returns:
Name                         Type        Value
db_recovery_file_dest  string      /private2/AS1012Installs/AS1012Infra/
                                          flash_recovery_area
db_recovery_file_dest_size   big integer  2G

If the flashback_recovery_area is setup, then the destination specified by the db_recovery_file_dest parameter is used as the archivelog destination, and you do not need to specify the destination directory for your archives in the following step.

2.      Specify the destination directory for your archives by including the initialization parameter LOG_ARCHIVE_DEST_n in the initialization file. If spfile is used, then the following command can be issued:

alter system set log_archive_dest_n="LOCATION= ‘backup directory’ " scope=spfile;

In the log_archive_dest_n parameter, n is a number of 1 through 10.
If pfile is used, the following initialization file must be edited: 
INFRA_ORACLE_HOME/dbs/initSID.ora

Change the LOG_ARCHIVE_DEST_n parameter to:
LOG_ARCHIVE_DEST_n="LOCATION=’backup directory’"

(Optional) The default filename format for archive logs is:
%t_%s.dbf

If you would like to use a different format, include the initialization parameter LOG_ARCHIVE_FORMAT in the initialization file, for example:
LOG_ARCHIVE_FORMAT = 'log%t_%r_%s.arc'

In the above example, t represents the thread number, r represents the reset log ID, and s represents the log sequence number.

3.      Make sure that the ORACLE_HOME and ORACLE_SID (the default is orcl) environment variables are properly set.

4.      Make sure that no one is using the database.

5.      Perform a clean, normal shutdown of the database instance:
INFRA_ORACLE_HOME/bin/sqlplus /nolog
connect sys/password as sysdba
shutdown

6.      Start up the instance and mount, but do not open the database:
startup mount;

7.      Enable database ARCHIVELOG mode:
alter database archivelog;

8.      Shut down and restart the database instance:
shutdown
startup

9.      Verify the database is now in ARCHIVELOG mode.
Execute the following command and verify that Database log mode is Archive Mode and Automatic archival is Enabled.  
archive log list;
Database log mode             Archive Mode
Automatic archival            Enabled
Archive destination           /disk1/oraHome/archive
Oldest on-line log sequence   997
Next log sequence to archive  999
Current log sequence          999

2.      Modify tnsnames to access databases.

Go to oracle_home_middletier/network/admin/tnsnames.ora
Backup it and then edit it and add the entry for the databases that you want to access from oas:
For example:
orcl =
  (DESCRIPTION =
    (ADDRESS_LIST =
        (ADDRESS =
          (PROTOCOL = TCP)
          (Host = ip or hostname)
          (Port = 1521)
        )
    )
    (CONNECT_DATA = (SID = orcl)
    )
  )

3.      I create folders to put the forms, menues and reports, one folder for production (fmx, mmx, rdf) and other for development.
I must compile the forms, plls and menus because we develop them on windows and then copied them to server.

    Compile forms:
/opt/oracle/frs1/bin/frmcmp.sh module=$1  userid=pp/pp@orcl module_type=FORM compile_all=yes

    Compile menus:
/opt/oracle/frs1/bin/frmcmp.sh module=$1 userid=pp/pp@orcl module_type=menu compile_all=yes

    Compile plls:
/opt/oracle/frs1/bin/frmcmp.sh module=$1 userid=pp/pp@orcl module_type=library compile_all=yes

4.      More than one enviroment.
I want to have two enviroments production and development: so I copy /oracle_home_middletier/forms/server/default.env file to default_prod.env and default_dev.env, and then modifed them:
default_prod.env:
FORMS_PATH=/opt/oracle/applications/production

default_dev.env:
FORMS_PATH=/opt/oracle/applications/development

We will use this prod and dev enviroment files when we edit the file formsweb.cfg on envFile argument.
        
5.      Jar files
In our forms we use some jar files so I must copy them to /oracle_home_middletier/forms/java
You also must add the jar files in formsweb.cfg (see 5.)

6.      Icons
I copy the directory  where I have my icons to /oracle_home_middletier/forms and then modify the file: /oracle_home_middletier/forms/server/forms.conf, I add a new alias:
/oracle_home_middletier/forms /java/icons
AliasMatch ^/forms/java/icons/(..*) "/oracle_home_middletier/forms/java/icons/$1"

And also modify the file /oracle_home_middletier/forms/registry/Registry.dat:

default.icons.iconpath=/forms/java/icons/
default.icons.iconextension=gif

7.      Use configurations to run forms applications
Modfied the file /oracle_home_middletier/forms/server/formsweb.cfg to add my configurations: production and testing, and with jinitiator and with jpi:

#Configuracion para XXX test jinitiator
[xxx_test]
pageTitle=App XXX
form=Form_start_xxx.fmx
width=980
splashScreen=no
background=no
lookAndFeel=Oracle
colorScheme=blue
logo=no
archive_jini=frmall_jinit.jar,ModCursor.jar,HyperLink.jar
otherparams=useSDI=yes
height=750
envFile=default_dev.env
restrictedURLparams=HTMLbodyAttrs,HTMLbeforeForm,pageTitle,HTMLafterForm,log,allow_debug,allowNewConnections,form,pageTitle,width,splashScreen,background,lookAndFeel,colorScheme,archive_jini,logo,height,envFile,otherparams

#Configuracion para XXX prod jinitiator
[xxx]
pageTitle=App XXX
form=Form_start_xxx.fmx
width=980
splashScreen=no
background=no
lookAndFeel=Oracle
colorScheme=blue
logo=no
archive_jini=frmall_jinit.jar,ModCursor.jar,HyperLink.jar
otherparams=useSDI=yes
height=750
envFile=default_prod.env
restrictedURLparams=HTMLbodyAttrs,HTMLbeforeForm,pageTitle,HTMLafterForm,log,allow_debug,allowNewConnections,form,pageTitle,width,splashScreen,background,lookAndFeel,colorScheme,archive_jini,logo,height,envFile,otherparams

#Configuracion para XXX jpi
[xxxjpi]
baseHTMLJInitiator=basejpi.htm
jpi_classid=clsid:8AD9C840-044E-11D1-B3E9-00805F499D93
jpi_codebase=https://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=1,4,2,4
jpi_mimetype=application/x-java-applet;version=1.4.2
jpi_download_page=https://java.sun.com/j2se/1.5.0/download.html
pageTitle= App XXX
form=Form_start_xxx.fmx
width=980
splashScreen=no
background=no
lookAndFeel=Oracle
colorScheme=blue
logo=no
archive_jini=frmall_jinit.jar,ModCursor.jar,HyperLink.jar
otherparams=useSDI=yes
height=750
envFile=default_prod.env
restrictedURLparams=HTMLbodyAttrs,HTMLbeforeForm,pageTitle,HTMLafterForm,log,allow_debug,allowNewConnections,form,pageTitle,width,splashScreen,background,lookAndFeel,colorScheme,archive_jini,logo,height,envFile,otherparams

#Configuracion para XXX test jpi
[xxxjpi_test]
#baseHTMLJInitiator=basejpi.htm
baseHTMLJInitiator=webutiljpi.htm
jpi_classid=clsid:8AD9C840-044E-11D1-B3E9-00805F499D93
jpi_codebase=https://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=1,4,2,4
jpi_mimetype=application/x-java-applet;version=1.4.2
jpi_download_page=https://java.sun.com/j2se/1.5.0/download.html
pageTitle=App XXX
form=Form_start_xxx.fmx
width=980
splashScreen=no
background=no
lookAndFeel=Oracle
colorScheme=blue
logo=no
#archive_jini=frmall_jinit.jar,ModCursor.jar,HyperLink.jar
archive_jini=frmall_jinit.jar,ModCursor.jar,HyperLink.jar,share.jar,frmwebutil.jar,jacob.jar
otherparams=useSDI=yes
height=750
webUtilArchive=frmwebutil.jar,jacob.jar
envFile=default_dev.env
restrictedURLparams=HTMLbodyAttrs,HTMLbeforeForm,pageTitle,HTMLafterForm,log,allow_debug,allowNewConnections,form,pageTitle,width,splashScreen,background,lookAndFeel,colorScheme,archive_jini,logo,height,envFile,otherparams

8.      More than one enviroment for reports

Modified the file of my report server to have two enviroments for reports:

/oracle_home_middletier/reports/conf/rep_middletier_instance.conf :

  <environment id="prod">
      <envVariable name="REPORTS_PATH" value="/opt/oracle/applications/production/"/>
   </environment>

   <environment id="dev">
      <envVariable name="REPORTS_PATH" value="/opt/oracle/applications/development/"/>
   </environment>

9.      Configuring Oracle HTTP Server to use SSL

1. Open ORACLE_HOME_middletier/opmn/conf/opmn.xml in a text editor and find this block of code:
<ias-component id="HTTP_Server">
<process-type id="HTTP_Server" module-id="OHS">
<module-data>
<category id="start-parameters">
<data id="start-mode" value="ssl-disabled"/>
</category>
</module-data>
<process-set id="HTTP_Server" numprocs="1"/>
</process-type>
</ias-component>


2. Change the start-mode parameter value to ssl-enabled:
<ias-component id="HTTP_Server">
<process-type id="HTTP_Server" module-id="OHS">
<module-data>
<category id="start-parameters">
<data id="start-mode" value="ssl-enabled"/>
</category>
</module-data>
<process-set id="HTTP_Server" numprocs="1"/>
</process-type>
</ias-component>

3. Force OPMN to reload the modified opmn.xml configuration file:
opmnctl reload

10.  Running a Form with SSL
Running a Forms application that uses an HTTPS port requires a certificate to be imported.
If you access Oracle HTTP Server through port 4444, you need to import the Oracle HTTP Server certificate.

To import the Oracle HTTP Server Certificate:

1. Invoke Wallet manager: /oracle_home_middletier/bin/owm
2. Open /oracle_home_middletier/Apache/Apache/conf/ssl.wlt/default.
3. Enter welcome as the password.
4. Select Auto Login.
5. Select FOR TEST PURPOSES ONLY.
6. Choose [Operations]-[Export Trusted Certificate] and provide a name.
7. Open this file in a text editor and copy all of its contents and append it to
C:\Program Files\Oracle\JInitiator1.3.1.21\lib\security\certdb.txt.
(If you use jinitiator)
8.      Run the Form Servlet as https://hostname:4444/forms/frmservlet
     9. Verify that the JInitiator log window displays the HTTPS protocol

11.  Disable reports url access
The security team ask me to disable this urls:
http://hostname:port/reports/rwservlet/showjobs
http:// hostname:port/reports/rwservlet/showenv
http:// hostname:port/reports/rwservlet/showmap

so edit file /oracle_home_middletier/reports/conf/rwservlet.properties and set:
DIAGNOSTIC=NO
RELOAD_KEYMAP=YES
   
     So we must use the cgicmd.dat for reports.

    Add to this file the key for your reports, for example:
keyprod: userid=user/pass@sid destype=cache SERVER=report server name envid=prod %*

keytest: userid=<user>/<pass>@<sid> destype=cache SERVER=<report server name> envid=test %*

Edit file En /oracle_home_middletier/reports/conf/<your report server name>.conf and find this:
<identifier confidential="yes" encrypted="yes">RwZAF1u2H1CXwMiHwQ6RDk5W</identifier>

And modified:
<identifier confidential="yes" encrypted="yes">user/pass</identifier>

Only with this user pass you will have access to these urls:
http://hostname:port/reports/rwservlet/showjobs
http:// hostname:port/reports/rwservlet/showenv
http:// hostname:port/reports/rwservlet/showmap

12.  Enable Mod_security on Apache

The mod_security module is installed by default with the HTTP Server and it is disabled by default.
In order to enable the same, you have to follow the steps given below.


1. Edit the httpd.conf file present under $ORACLE_HOME/Apache/Apache/conf directory
2. Add the following lines into the file, at the appropriate location in the httpd.conf file where the other 'AddModules' entries are present
The first two lines are the ones that enable the module and the remaining lines are the filter commands to configure the filters
LoadModule security_module libexec/mod_security.so

<IfModule mod_security.c>

    # Turn the filtering engine On or Off
    SecFilterEngine On
    #Should mod_security inspect POST payloads
    SecFilterScanPOST On
    # The type of auditing
    SecAuditEngine RelevantOnly
    # The name of the audit log file
    SecAuditLog /opt/oracle/frs1/Apache/Apache
   /logs/modsec_audit.log
    # Action to take by default
    #SecFilterDefaultAction "deny,log,status:406"
    # Only check the body of the POST request
    #SecFilterSelective POST_PAYLOAD 333
    # XSS protection but allows common HTML tags
    SecFilter "<( |\n)*script"
    # Prevent XSS atacks (HTML/Javascript injection)
    #SecFilter "<(.|\n)+>"
    # Filters to prevent SQL injection attacks
    SecFilter "delete[[:space:]]+from"
    SecFilter "insert[[:space:]]+into"
    SecFilter "select.+from"
</IfModule>
3. Save the file
4. The entries given below is an example and you will have to change it as per your needs
5. dcmctl updateconfig
6. Restart the HTTP Server

13.  Securing the Welcome Page

By default, the Oracle Application Server Welcome page is accessible from this URL:
http://hostname.domain:7777

This page contains links to useful information like demos and code samples which can be used to compromise the security of your site. You can secure your Welcome page by:

Creating Your Own Custom Welcome Page

To deploy a new Welcome page for Oracle Application Server:

   1.  Create the new Welcome page you want to use. This page must be named index.html.
   2.  Save the new Welcome page in a directory. It is recommended that you save the page in a different directory than the htdocs directory.
   3.  Start the Application Server Control Console.
   4.  Select the OracleAS Infrastructure instance. You will be prompted to login.
   5.  Click HTTP Server.
   6.  Click Administration.
   7.  Click Properties.
   8.  Enter the directory for your new page in the Document Root field.
   9.  (Optional) Enter the administrator's e-mail address in the Administrator's Email field.
  10.  Click Apply.

14.  Customize error pages on Apache
The security team ask me to customize the error pages on Apache, the reason was to avoid to show messages that could identified that the server has installed an oracle application server.

Edit the file httpd.conf and find this “# Customizable error response” and add:

ErrorDocument 500 "El servidor genero el error 500. Consulte al administrador.”
ErrorDocument 401 "El servidor genero el error 401. Consulte al administrador.”
ErrorDocument 402 "El servidor genero el error 402. Consulte al administrador.”
ErrorDocument 404 "El servidor genero el error 404. Consulte al administrador.”