Share

Friday, September 9, 2016


A Brief and Practical introduction to Splunk

Splunk is a well known and popular log management and application monitoring operation intelligence technology/product. It generally parse logs(machine data) and take them as a raw data and lets users to search, monitor, analyze and visualize them.

Here I will give you little practical overview and show how it looks.

I have downloaded the splunk enterprise trail for our testing. you can download it from here

My platform is linuxmint ( ubuntu based) with minimal configuration.

I downloaded the product binaries and installed using alien

alien -i splunk-6.4.3-b03109c2bad4-linux-2.6-x86_64.rpm

By default, it will get installed into /opt/splunk directory. Go there and start your splunk server.

Before going there, we have little prerequisite to read. you should have little understanding about how splunk handles the data and what types of data splunk can read/index ? what types of data sources can splunk support ? etc..

I recommend you to go here once and read.

well..! I hope you have read  and understood the various datasources and forwarders.

now. lets come back to practical.

I have splunk installed in  /opt/splunk directory.  cd to /opt/splunk/bin and you will see a cli interface named splunk (make sure it has execute permission) 


We need to start the splunk using the command ./splunk start command.
























we can access the management console at  http://<hostname>:8000/.   It has a great GUI console.  If we are accessing a first time username and password would be admin/changeme




once we are logged into splunk .   we should add the data source from where the data will be indexed. If the data is from remote box we need splunk forwarders.























As we click on "Add Data" we will be prompted to select the source method. Here we are going to monitor the local file. So we are going with monitor option


















Select the Files & Directories option as our data source is a directory then we should give additional details about the file to be monitored like source location of the file. source type/ index etc.   


























After the source is selected. ( in my case am going to add the tomcat logs from /opt/tomcat/apache-tomcat.7.0.68/logs/" directory ) we have to enter the source type and index.  we can create it in the run time on the same page. 










Note*: While creating new index. Except the name, leave all the fields _blank

Now we have created the sourcetype and index named tomcat_logs. Here you can refer the index as the normal DataBase(RDBMS) index where your data is going to  be stored. A single index can have multiple sources and source types.

Now its a time to review and submit our configuration. ( Click on review button on the top to review)












































Once submitted.  Data will get indexed and you are ALL SET to be amazed with Search Processing Language of Splunk and its capabilities.


Yes!. Splunk has its own query language called SPL. For more information regarding SPL click here

Splunk search can present data as a chart (or) as a statistics (or) as a report and many more.

Splunk also having the monitoring facilities as it can trigger email on certain conditions. It can act like a superb applicaiton monitoring and transaction monitoring product as well.

Look at the examples below.












Hope it helps. 

Feel free to let me know you feedback through comments. If you like it. Share it  :)


See you soon in another post, Thanks
AKSarav

Monday, August 22, 2016

Servlet Filtering with Apache Log4j

What is Servlet Filtering ?



Servlet filtering, a feature of servlets introduced in the Servlet 2.3 specification, provides a declarative technique for intercepting HTTP requests and performing any desired preprocessing or conditional logic before the request is passed on to the final target JSP page or servlet. 

Filters are very useful for implementing common behaviors such as caching page output, logging page requests, providing debugging information during testing, and checking security information and forwarding to login pages.

Placing a filter in the path of a particular servlet or JSP request is a simple two-step process: Build a class that implements the javax.servlet.Filter interface, and register that class as a filter for the desired pages and servlets using either entries in the web.xml descriptor file or annotations in the filter class. 


What is Apache Log4j

log4j is a java based logging utility.  which makes the application level logging ease and more reliable. 

It's an API , can be directly imported and used in your application as a jar file.

log4j is highly configurable through external configuration files at runtime. It views the logging process in terms of levels of priorities and offers mechanisms to direct logging information to a great variety of destinations, such as a database, file, console, UNIX Syslog, etc.
log4j has three main components:
  • loggers: Responsible for capturing logging information.
  • appenders: Responsible for publishing logging information to various preferred destinations.
  • layouts: Responsible for formatting logging information in different styles.
Audit_Filter Application (Filtering with Log4j)

We have designed an application named LoggerFilter to demonstrate/test this filtering and logging.

This is how our project look like in eclipse.




















Here I have used weblogic 12c as the application server where the application has been deployed.

Its necessary to import the log4j API jar file in the project using  

LoggerFilter(RightClick) -> Properties -> Java Build Path -> AddExternal JARs

Also we should copy the same jar file into the domain/lib directory of weblogic to avoid getting class not Found exceptions during  run time.






Preceding illustration shows my domain's lib directory (MWIDomain is my domain name)

This is the content of  log4j.properties file we have bundled into the war file.


log4j.logger.com.logger.app.SnoopFilter=TRACE, C
log4j.appender.C=org.apache.log4j.RollingFileAppender
log4j.appender.C.File=D:/Tomcat_logs/loggerapp1_debug.log
log4j.appender.C.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.C.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#log4j.appender.R.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.C.MaxFileSize=200KB
log4j.appender.C.MaxBackupIndex=1


All the code used in this program can be found on my github you can download the war file as well from git hub and try it.

How it has been setup ?

in web.xml  SnoopFilter.java has been registered as Filter class for all incoming requests as we have used /* as our url matching pattern

<filter>
 <filter-name>AuditFilter</filter-name>
<filter-class>com.logger.app.SnoopFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuditFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

When you are accessing any of the resources in that project (Index.jsp/Home). Filter will monitor your request and print the request info into the log file configured in the log4j.properties file  (D:/Tomcat_logs/loggerapp1_debug.log)








Query String can be anything. What ever you give as a "query string" will be captured and printed.







With little modifications you can use this sample code for your project and filter your incoming requests.

Here we just do a Auditing by capturing the request information. we can do more using filter and log4j.

Hope it helps.

Thanks,
SaravAK


Thursday, May 19, 2016

Weblogic NodeManager SSL HandShake Exception while starting

Exception:

<May 19, 2016 4:37:35 AM PDT> <Warning> <Security> <BEA-090476> <Invalid/unknown SSL header was received from peer localhost - 127.0.0.1 during SSL handshake.>
<May 19, 2016 4:37:35 AM> <WARNING> <Uncaught exception in server handlerjavax.net.ssl.SSLHandshakeException: [Security:090476]Invalid/unknown SSL header was received from peer localhost - 127.0.0.1 during SSL handshake.>
javax.net.ssl.SSLHandshakeException: [Security:090476]Invalid/unknown SSL header was received from peer localhost - 127.0.0.1 during SSL handshake.
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source)
        at com.certicom.tls.record.ReadHandler.fireAlert(Unknown Source)
        at com.certicom.tls.record.ReadHandler.getProtocolVersion(Unknown Source)
        at com.certicom.tls.record.ReadHandler.checkVersion(Unknown Source)
        at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
        at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source)
        at com.certicom.tls.record.ReadHandler.read(Unknown Source)
        at com.certicom.io.InputSSLIOStreamWrapper.read(Unknown Source)

Resolution:

By Default Node Manager will start in a secure port and it should be disabled in "nodemanager.properties"

<May 19, 2016 4:58:36 AM> <INFO> <Secure socket listener started on port 5556>
May 19, 2016 4:58:36 AM weblogic.nodemanager.server.SSLListener run
INFO: Secure socket listener started on port 5556


[weblogic@localhost nodemanager]$ more nodemanager.properties
#Tue May 10 00:52:47 PDT 2016
DomainsFile=/opt/wls/wlserver/common/nodemanager/nodemanager.domains
LogLimit=0
PropertiesVersion=10.3
DomainsDirRemoteSharingEnabled=false
javaHome=/usr/java/jdk1.7.0_79/
AuthenticationEnabled=false
NodeManagerHome=/opt/wls/wlserver/common/nodemanager
JavaHome=/usr/java/jdk1.7.0_79/jre
LogLevel=INFO
DomainsFileEnabled=true
StartScriptName=startWebLogic.sh
ListenAddress=
NativeVersionEnabled=true
ListenPort=5556
LogToStderr=true
SecureListener=false
LogCount=1
DomainRegistrationEnabled=false
StopScriptEnabled=false
QuitEnabled=false
LogAppend=true
StateCheckInterval=500
CrashRecoveryEnabled=false
StartScriptEnabled=false


Update the StartNodeManager.sh  JAVA_OPTS section with below startup argument  ( Update the StartNodeManager.sh and put this line before weblogic.NodeManager)

 "-Dweblogic.nodemanager.sslHostNameVerificationEnabled=false"

Update the AdminServer JAVA_OPTS with the below argument


java -server -Xmx512m -Xms512m -XX:MaxPermSize=128m -DWeblogic.Name=AdminServer -Dweblogic.Stdout="/tmp/AdminOut.log" -Dweblogic.Stderr="/tmp/AdminErr.log" -Dweblogic.security.SSL.ignoreHostnameVerification=true weblogic.Server

Start the Node Manager now using "/opt/wls/wlserver/server/bin/StartNodeManager.sh" script or by commandline as follows


/usr/java/jdk1.7.0_79//bin/java -Xms32m -Xmx200m -Dcoherence.home=@COHERENCE_HOME -Dbea.home=/opt/wls -Djava.security.policy=/opt/wls/wlserver/server/lib/weblogic.policy -Dweblogic.nodemanager.javaHome=/usr/java/jdk1.7.0_79/ -Djava.library.path=/opt/wls/wlserver/server/native/linux/x86_64/ -Dweblogic.nodemanager.sslHostNameVerificationEnabled=false weblogic.NodeManager

Check the Node manager Status in the Console. Now it should be Reachable



Friday, May 13, 2016

Apache Tomcat JDBC Realm with mysql and Form Based Web Application.

In my earlier post, we have designed and tested the Web Application  in Apache Tomcat with Default Authentication Provider . this time we will use JDBC realm as the Authentication provider and we will use mysql as the Database.

Let's get started

Note*:  I presume that you have basic knowledge of Linux user setup and Tomcat installation and administration. So I am skipping few basic steps here, I believe  you should be able to understand. in case of any doubts of further support please comment.

Technology Stack

Operating System: RHEL6
MySQL Version: 5.7.12
Tomcat Version7.0.69

MYSQL SETUP


Download the product here

Install mysql community server using RPM and YUM


[root@localhost mysql]# yum install mysql-community-{server,client,common,libs}-* mysql-5.*  
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Examining mysql-community-server-5.7.12-1.el6.x86_64.rpm: mysql-community-server-5.7.12-1.el6.x86_64
Marking mysql-community-server-5.7.12-1.el6.x86_64.rpm to be installed
Examining mysql-community-client-5.7.12-1.el6.x86_64.rpm: mysql-community-client-5.7.12-1.el6.x86_64
Marking mysql-community-client-5.7.12-1.el6.x86_64.rpm to be installed
Examining mysql-community-common-5.7.12-1.el6.x86_64.rpm: mysql-community-common-5.7.12-1.el6.x86_64
Marking mysql-community-common-5.7.12-1.el6.x86_64.rpm to be installed
Examining mysql-community-libs-5.7.12-1.el6.x86_64.rpm: mysql-community-libs-5.7.12-1.el6.x86_64
Marking mysql-community-libs-5.7.12-1.el6.x86_64.rpm to be installed
Examining mysql-community-libs-compat-5.7.12-1.el6.x86_64.rpm: mysql-community-libs-compat-5.7.12-1.el6.x86_64
Marking mysql-community-libs-compat-5.7.12-1.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.12-1.el6 will be installed
---> Package mysql-community-common.x86_64 0:5.7.12-1.el6 will be installed
---> Package mysql-community-libs.x86_64 0:5.7.12-1.el6 will be obsoleting
---> Package mysql-community-libs-compat.x86_64 0:5.7.12-1.el6 will be obsoleting
---> Package mysql-community-server.x86_64 0:5.7.12-1.el6 will be installed
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be obsoleted
--> Finished Dependency Resolution

Dependencies Resolved


Install       5 Package(s)

Total size: 843 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
.....
.....

Installed:
  mysql-community-client.x86_64 0:5.7.12-1.el6               mysql-community-common.x86_64 0:5.7.12-1.el6          mysql-community-libs.x86_64 0:5.7.12-1.el6         
  mysql-community-libs-compat.x86_64 0:5.7.12-1.el6          mysql-community-server.x86_64 0:5.7.12-1.el6         
                     

Complete!


[root@localhost mysql]# 



Start the mysql Server

[root@localhost mysql]# /etc/init.d/mysqld start
Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]


Check the version of mysql server

[root@localhost mysql]# mysqladmin --version
mysqladmin  Ver 8.42 Distrib 5.7.12, for Linux on x86_64


grep 'temporary password' /var/log/mysqld.log

[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log
2016-05-13T18:33:49.054595Z 1 [Note] A temporary password is generated for root@localhost: >!ds6sfiEijp

Login with that temporary Password

[root@localhost ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.12

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

Update the  password for "root" account

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'secure';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mwi@4321';
Query OK, 0 rows affected (0.02 sec)


Execute the SQL queries given below one by one (or) All at once.

DROP DATABASE IF EXISTS mwidb;
CREATE DATABASE mwidb;
USE mwidb;
CREATE TABLE tomcat_users (
user_name varchar(20) NOT NULL PRIMARY KEY,
password varchar(32) NOT NULL
);
CREATE TABLE tomcat_roles (
role_name varchar(20) NOT NULL PRIMARY KEY
);
CREATE TABLE tomcat_users_roles (
user_name varchar(20) NOT NULL,
role_name varchar(20) NOT NULL,
PRIMARY KEY (user_name, role_name),
CONSTRAINT tomcat_users_roles_foreign_key_1 FOREIGN KEY (user_name) REFERENCES tomcat_users (user_name),
CONSTRAINT tomcat_users_roles_foreign_key_2 FOREIGN KEY (role_name) REFERENCES tomcat_roles (role_name)
);
INSERT INTO tomcat_users (user_name, password) VALUES ('sarav', 'mwi@4321');
INSERT INTO tomcat_users (user_name, password) VALUES ('mwiuser', 'mwiuser');
INSERT INTO tomcat_roles (role_name) VALUES ('webuser');
INSERT INTO tomcat_roles (role_name) VALUES ('manager');
INSERT INTO tomcat_roles (role_name) VALUES ('manager-gui');
INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('mwiuser', 'webuser');
INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('sarav', 'webuser');
INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('sarav', 'manager-gui');
INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('sarav', 'manager');

COMMIT;


mysql> DROP DATABASE IF EXISTS mwidb;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE DATABASE mwidb;
Query OK, 1 row affected (0.00 sec)

mysql> USE mwidb;
Database changed
mysql> CREATE TABLE tomcat_users (
    -> user_name varchar(20) NOT NULL PRIMARY KEY,
    -> password varchar(32) NOT NULL
    -> );
Query OK, 0 rows affected (0.13 sec)

mysql> CREATE TABLE tomcat_roles (
    -> role_name varchar(20) NOT NULL PRIMARY KEY
    -> );
Query OK, 0 rows affected (0.09 sec)

mysql> CREATE TABLE tomcat_users_roles (
    -> user_name varchar(20) NOT NULL,
    -> role_name varchar(20) NOT NULL,
    -> PRIMARY KEY (user_name, role_name),
    -> CONSTRAINT tomcat_users_roles_foreign_key_1 FOREIGN KEY (user_name) REFERENCES tomcat_users (user_name),
    -> CONSTRAINT tomcat_users_roles_foreign_key_2 FOREIGN KEY (role_name) REFERENCES tomcat_roles (role_name)
    -> );
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO tomcat_users (user_name, password) VALUES ('sarav', 'Sara@4321');
Query OK, 1 row affected (0.08 sec)

mysql> INSERT INTO tomcat_users (user_name, password) VALUES ('mwiuser', 'mwiuser');
Query OK, 1 row affected (0.02 sec)

mysql> INSERT INTO tomcat_roles (role_name) VALUES ('webuser');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO tomcat_roles (role_name) VALUES ('manager');
Query OK, 1 row affected (0.02 sec)


mysql> INSERT INTO tomcat_roles (role_name) VALUES ('manager-gui');
Query OK, 1 row affected (0.13 sec)


mysql> INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('mwiuser', 'webuser');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('sarav', 'webuser');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('sarav', 'manager');
Query OK, 1 row affected (0.01 sec)


mysql> INSERT INTO tomcat_users_roles (user_name, role_name) VALUES ('sarav', 'manager-gui');
Query OK, 1 row affected (0.10 sec)


mysql> COMMIT;
Query OK, 0 rows affected (0.00 sec)

Verify the tables and its record set.


mysql> show tables;
+--------------------+
| Tables_in_mwidb    |
+--------------------+
| tomcat_roles       |
| tomcat_users       |
| tomcat_users_roles |
+--------------------+
3 rows in set (0.01 sec)

mysql> select * from tomcat_roles;
+-----------+
| role_name |
+-----------+
| manager   |
| webuser   |
+-----------+
2 rows in set (0.00 sec)

mysql> select * from tomcat_users;
+-----------+-----------+
| user_name | password  |
+-----------+-----------+
| mwiuser   | mwiuser   |
| sarav     | mwi@4321 |
+-----------+-----------+
2 rows in set (0.00 sec)

mysql> select * from tomcat_users_roles;
+-----------+-------------+
| user_name | role_name   |
+-----------+-------------+
| sarav     | manager     |
| sarav     | manager-gui |
| mwiuser   | webuser     |
| sarav     | webuser     |
+-----------+-------------+
4 rows in set (0.00 sec)

TOMCAT SETUP



Download the Tomcat Application Server ZIP Distribution here and un compress it under /opt/tomcat directory

[tomcat@localhost tomcat]$ pwd
/opt/tomcat
[tomcat@localhost tomcat]$ ls -lrt
total 4
drwxr-xr-x. 9 tomcat tomcat 4096 Apr 11 10:59 apache-tomcat-7.0.69


Download the JConnecter JDBC Driver from here  and get the jar file

[sarav@localhost Downloads]$ ls -rlt
total 138660
-rw-rw-r--. 1 sarav sarav   3899019 May 13 12:44 mysql-connector-java-5.1.39.tar.gz

[sarav@localhost Downloads]$ pwd
/home/sarav/Downloads

[sarav@localhost Downloads]$ gunzip mysql-connector-java-5.1.39.tar.gz 

[sarav@localhost Downloads]$ ls -lrt
total 145824
-rw-rw-r--. 1 sarav sarav 138082565 May  1 22:07 jdk-7u79-linux-x64.rpm
-rw-rw-r--. 1 sarav sarav  11233280 May 13 12:44 mysql-connector-java-5.1.39.tar

[sarav@localhost Downloads]$ tar -xf mysql-connector-java-5.1.39.tar

[sarav@localhost Downloads]$ ls -lrt
total 145828
-rw-rw-r--. 1 sarav sarav 138082565 May  1 22:07 jdk-7u79-linux-x64.rpm
drwxr-xr-x. 4 sarav sarav      4096 May  4 04:11 mysql-connector-java-5.1.39
-rw-rw-r--. 1 sarav sarav  11233280 May 13 12:44 mysql-connector-java-5.1.39.tar

[sarav@localhost Downloads]$ ls -lrt mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar 
-rw-r--r--. 1 sarav sarav 989497 May  4 04:11 mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar

Copy the jar file to Lib directory of Tomcat

[sarav@localhost Downloads]$ cp mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar /opt/tomcat/apache-tomcat-7.0.69/lib/ls -lrt^C
[sarav@localhost Downloads]$ ls -lrt /opt/tomcat/apache-tomcat-7.0.69/lib/mysql-connector-java-5.1.39-bin.jar 
-rw-rw-r--. 1 tomcat tomcat 989497 May  4 04:11 /opt/tomcat/apache-tomcat-7.0.69/lib/mysql-connector-java-5.1.39-bin.jar


Server.xml changes

Find the section LockOutRealm and Comment  the below lines with <!--     -->

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>

and Add the JDBC Realm values

<Realm  className="org.apache.catalina.realm.JDBCRealm"
                             driverName="com.mysql.jdbc.Driver"
                                                            connectionURL="jdbc:mysql://localhost:3306/mwidb" connectionName="root" connectionPassword="mwi@4321" userTable="tomcat_users" userNameCol="user_name" userCredCol="password" userRoleTable="tomcat_users_roles" roleNameCol="role_name" />




Here, 

1) jdbc:mysql://localhost:3306/mwidb is the JDBC URL and mwidb is the DataBase Name2) connectionName is the username I am using to access the Database3) connectionPassword is the password of the connectionName account mentioned.

Find the Below Resource and Comment this as well with <!--     -->

<Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />





Now restart the tomcat server with ./shutdown.sh & ./startup.sh scripts

Access the manager app at http://localhost:8080/manager/  and enter the credentials of  account "sarav" and you should be able to get through without any issues as it is having "manager-gui" privilage.  





Application Design and Deployment


Hope you have checked out my previous tutorial about web application designing and form based auth at http://www.mwinventory.in/2015/12/apache-tomcat-web-application.html 

we can use the same Application here as well (without any code changes).  you can download the war file from here.

Once you have downloaded,  copy the war file to tomcat/webapps location to get it deployed. (Hot Deployment)

[tomcat@localhost webapps]$ ls -lrt
total 24
drwxr-xr-x.  3 tomcat tomcat 4096 Apr 11 10:58 ROOT
drwxr-xr-x.  5 tomcat tomcat 4096 Apr 11 10:58 manager
drwxr-xr-x.  5 tomcat tomcat 4096 Apr 11 10:58 host-manager
drwxr-xr-x.  7 tomcat tomcat 4096 Apr 11 10:58 examples
drwxr-xr-x. 14 tomcat tomcat 4096 Apr 11 10:58 docs
drwxrwxr-x.  3 tomcat tomcat 4096 May 13 14:30 TestSecApp
[tomcat@localhost webapps]$ pwd
/opt/tomcat/apache-tomcat-7.0.69/webapps

Restart the tomcat instance after application installation and make sure the app gets deployed by checking the logs. you should be able to see the app deploying message

INFO: Deploying web application directory /opt/tomcat/apache-tomcat-7.0.69/webapps/TestSecApp

Application Testing.

Application Name is the "ContextRoot" of the application here. so you can test the application at http://localhost:8080/TestSecApp


Screen1 :  User Form, Enter the  "sarav" account credentials to test


Screen2: Sucessfull login 


Screen3: logout screen



Screen4: Test it with some incorrect credentials and you will not be able to login