HP 5991-5565 manual Protecting Apache Http Server Authorization with Symas CDS

Page 44

Creating a Password File

Create a password file to contain the HTTPS server passwords using the following steps:

1.Create the password directory by entering the following command:

#mkdir /etc/apache2/passwd

2.Create and update the user password file by entering the following command:

#htpasswd2 -c /etc/apache2/passwd/mypasswords TESTNAME

New password: <*******>

Re-type new password: *******

Creating the Distributed Configuration File

You can create a distributed configuration file, which you place in a directory, that contains configuration directives specific to that directory and all its subdirectories. This allows you the flexibility of defining how your entire directory structure is configured on a per-directory basis. Use the following procedure to create the .htaccess distributed configuration file:

1.Create the following file:

/srv/www/htdocs/test/.htaccess

2.Add the following lines to the file you created in Step 1:

AuthType Basic

AuthName "Restricted Files"

AuthUserFile /etc/httpd/conf/passwd/mypasswords Require user TESTNAME

Restarting the Apache HTTP Server

Restart Apache by entering the following command:

#/etc/init.d/apache2 restart

Verifying the Authentication and Authorization Operations

Verify that the Apache HTTP server authenticates and authorizes server access properly by performing the following steps:

1.Open a browser window and navigate to the following website at: http://<YOUR_WEB_SERVER_IP>/test/

2.When prompted, log in with the user name TESTNAME and the password PASSWORD. If the login succeeds, the following message appears:

The Authentication and Authorization worked !

If the login fails, the following message appears:

Authorization Required

Protecting Apache HTTP Server Authorization with Symas CDS

Symas CDS is a service that can be used by applications to authenticate users and grant authorization. It can protect the contents in Apache using an Apache module, mod_auth_ldap, within the Linux distribution. Another Apache module, mod_ldap, can also be used as part of the LDAP connection pooling and resulting cache services. When a request for the protected data arrives, the LDAP directory looks at all entries to find a unique match. If it is found, mod_auth_ldap uses the domain name (DN) of the entry and the password provided by the HTTP client to bind the directory server.

Configuring CDS and LDAP Services

Use the following procedure to configure the CDS and LDAP services:

44

Image 44
Contents HP Open Source Middleware Stacks Blueprint Copyright 2007 Hewlett-Packard Development Company, L.P Table of Contents Monitor Tomcat with OpenView Tomcat SPI Webalizer Usage Report Oracle Database TestPage List of Tables Page HP Services IntroductionExecutive Summary Intended AudienceTypographic Conventions HP Encourages Your CommentsUserInput Feedback@fc.hp.comHP Open Source Web Server Middleware Stack Web Server Stack ArchitectureWeb Server Stack Architecture Required Packages and Installation Recommendations Installing and Verifying the Linux DistributionInstalling the Linux Distribution Verifying the Linux Distribution Installation YaST Software Selection and System TasksConfiguring the Basic Apache Http Server Installing and Configuring Sun JDK on an HP Proliant SystemTomcat # /etc/init.d/apache2 startFor the alljava.csh file, add the following lines # ln -s /usr/java/jdk1.5.010 /usr/local/jdkFor the alljava.sh file, add the following lines Installing and Configuring Tomcat # java -versionFollowing messages appear # /usr/local/apache-tomcat/bin/startup.shAdvanced Apache Http Server Features Using the Apache Http Server Benchmarking ToolIf necessary, stop Tomcat by entering the following command # /usr/local/apache-tomcat/bin/shutdown.shYou can correct the error by entering the following Apache Http Server Status and InformationApachemodules definition should now look like the following Restart the Apache Http Server for the changes take effectApache Server Status web page opens, as shown in Figure Apache Server Information web page opens, as shown in Figure# webalizer Apache Http Server Log# /etc/init.d/apache2 restart Create the following file Using Virtual Host SupportFor detailed information, see the Webalizer website at On the second server, create the following Html file Using Apache Http Server URL RedirectionConfigure virtual hosting by creating a file named Using Apache Http Server Proxy Features Edit the following configuration fileAdd the following line to the preceding file Add the following lines to the preceding fileError Responses and Redirects Create the following Html fileUsing Per-User Web Directories Populate the preceding file with the following linesConfiguring the Apache and Tomcat Connector Integrating the Web Server Stack ComponentsRestart Apache by entering the following command If there are any errors, check the following log filesInsert the following line below the DocumentRoot line Http//YOURHOSTNAME/jsp-examplesIntegrating the Apache Web Server and PHP Integrating the Apache Web Server and Perl# rpm -q php5 apache2-modphp5 Create the following test fileWeb page displays the following text Connecting Tomcat to a DatabaseIntegrating the Apache Web Server and Python Connecting Tomcat and MySQL # tar zxf mysql-connector-java-version.tar.gz# mysqladmin -u root -p create osmsdb # $CATALINAHOME/bin/startup.sh# ps -efgrep mysqld # /etc/init.d/mysql startConnecting Tomcat and Oracle If needed, start Tomcat by entering the following commandHttp//YOURHOSTNAME8080/mysqltest.jsp Test page opens as shown in FigureObtaining and Installing the Oracle Jdbc Driver Configuring the Oracle ServerTesting the Oracle Database Connectivity Creating an Oracle Data SourceHttp//YOURHOSTNAME8080/oracleTest.jsp Oracle Database TestConnecting Tomcat to MySQL or Oracle Using Hibernate Installing Hibernate, Tomcat, and JDKConfiguring a Database Driver in Tomcat # mysql -u root -p PasswordCreating a Simple Application in Tomcat # sqlplus osmsusr/osmspass@osmsdboraFor a MySQL database server For an Oracle database serverAsm.jar asm-attrs.jar antlr-2.7.6rc1.jar File HibernateSessionFactory.class is generated Preceding command creates a class file named This directory, create a Hibernate Pojo file namedVerifying the Simple Application Operation Http//YOURHOSTNAME8080/SimpleDemo/hibernate.jspRestart Apache by entering the following Secure the Web Server StackEnabling Https Support in the Apache Http Server Apache Http Server Authorization Apache default document root isVerify that the certificate is displayed as in Figure Create the following test Html fileProtecting Apache Http Server Authorization with Symas CDS If the login fails, the following message appearsConfiguring Apache Http Server Services Protecting Tomcat Authorization with Symas CDS Html HeadHtml Head Monitor Tomcat with OpenView Tomcat SPI # $CATALINA/bin/shutdown.sh # $CATALINA/bin/startup.shSoftware Prerequisites and Reference Guides Tomcat SPI ComponentsTools PoliciesComplete these steps Complete these steps Appendix B Frequently Asked Questions # /sbin/SuSEfirewall2 stopAppendix C Vendor Information Reference Following are the contents of the hibernate.jsp file Appendix D Hibernate Test Application Source CodePage Appendix D Hibernate Test Application Source Code