WebSphere Security Auditing

48
WebSphere Security Auditing Source: http://www.themiddlewareshop.com/2012/07/01/websphere-security-auditing- part-1/ Posted by Steve Robinson on Jul 1, 2012 in Blog, WebSphere, WebSphere Application Server This blog series will cover the basics of WebSphere Security Auditing. This is a feature of WAS that is often not implemented and so I thought it would be a good mini-series to discuss. I shall be producing 9 small bit-size blog items and some may be more detailed than others. Below is the main outline of what I will be delivering in the 9 part series. 1. ENABLE ADMINISTRATIVE SECURITY FOR THE PROFILE 2. CREATE AN USER 3. MAP USER TO AUDITOR ROLE 4. CONFIGURE AUDIT MONITOR 5. VERIFYING GENERATION OF AUDIT MESSAGES 6. GENERATE A HTML REPORT USING BINARYAUDITLOGREADER 7. CREATING AN EVENT FILTER 7A. CONFIGURING AUDIT SERVICE PROVIDER 7B. CONFIGURING AUDIT EVENT FACTORY 8. SIGNING YOUR SECURITY AUDIT RECORDS 9. ENCRYPTING THE SECURITY AUDIT LOG 9.A CONFIGURING KEYSTORE AND CERTIFICATE REQUIRED FOR ENCRYPTION 9.B AUDIT RECORD ENCRYPTION CONFIGURATION 1

Transcript of WebSphere Security Auditing

Page 1: WebSphere Security Auditing

WebSphere Security Auditing

Source: http://www.themiddlewareshop.com/2012/07/01/websphere-security-auditing-part-1/

Posted by Steve Robinson on Jul 1, 2012 in Blog, WebSphere, WebSphere Application Server

This blog series will cover the basics of WebSphere Security Auditing. This is a feature of WAS that is often not implemented and so I thought it would be a good mini-series to discuss. I shall be producing 9 small bit-size blog items and some may be more detailed than others. Below is the main outline of what I will be delivering in the 9 part series.

1. ENABLE ADMINISTRATIVE SECURITY FOR THE PROFILE

2. CREATE AN USER

3. MAP USER TO AUDITOR ROLE

4. CONFIGURE AUDIT MONITOR

5. VERIFYING GENERATION OF AUDIT MESSAGES

6. GENERATE A HTML REPORT USING BINARYAUDITLOGREADER

7. CREATING AN EVENT FILTER

7A. CONFIGURING AUDIT SERVICE PROVIDER

7B. CONFIGURING AUDIT EVENT FACTORY

8. SIGNING YOUR SECURITY AUDIT RECORDS

9. ENCRYPTING THE SECURITY AUDIT LOG

9.A CONFIGURING KEYSTORE AND CERTIFICATE REQUIRED FOR ENCRYPTION

9.B AUDIT RECORD ENCRYPTION CONFIGURATION

Introduction

This document explains the steps involved in turning on security auditing feature in WebSphere application server.

1

Page 2: WebSphere Security Auditing

Security Auditing feature enables logging of security events like successful/failed login attempts of users. Remember, this is a not a mechanism to control who can access what. The events are logged to a text file which can be read through a text editor. WebSphere also provides a tool called binaryAuditLogReader which can convert this text file into an html file for easier reading.

WebSphere also helps in making sure that this audit log is not tampered with, by allowing the log to be digitally signed with a Digital certificate, if this is really required. A digitally signed log is Base-64 encoded and is tamper-proof, but is still not encrypted, so can be read by anyone. To make it completely unavailable to intruders, the log can also be encrypted using a key held in a key store. To decrypt the log back, the binaryAuditLogReader tool can be used.

The dependency diagram shows what configuration is dependent on what. For example, if Security Auditing is disabled, then everything under that will not work.

2

Page 3: WebSphere Security Auditing

Steps Involved

1. Enable Administrative Security for the profile

Administrative Security has to be enabled for the Security Audit feature to work. So to turn on Administrative Security, do the following.

Start the server if it is not running. Open WebSphere Administrative console. Expand Security and click on Global Security

Select Enable administrative security as shown in the screen capture.

3

Page 4: WebSphere Security Auditing

Restart the server. (If this was already enabled, then the server need not be restarted)

4

Page 5: WebSphere Security Auditing

2. Create a User

WebSphere Application server supports role based access control to various features. Security Auditing is one such feature which can be configured by a user mapped to Auditor role. This role was introduced in WebSphere Application Server Version 7.0.

Search and confirm that a user with the same name does not exist before creating a new one.

Expand Users and Groups in Administrative Console in the Navigation Pane. Click Manage Users To view all the users, enter “*” in the “Search for” field and then click on Search button.

Create a new user to represent Security Auditor.

5

Page 6: WebSphere Security Auditing

Click Manage Users link under Users and Groups. Enter the following detail

o User ID: An ID that will be used later on to login to WebSphere Administrative consoleo Password: User’s passwordo First name: User’s first nameo Last name: User’s last nameo E-mail: User’s Email ID

Click on Create button

Mandatory text fields are given a light brown background color in WebSphere administrative console. They are also marked with an asterisk.

6

Page 7: WebSphere Security Auditing

A confirmation message is displayed as shown below.

7

Page 8: WebSphere Security Auditing

3. Map User to Auditor Role

Now the user needs to be mapped to Auditor role, so that the user can login to WebSphere administrative console and configure security auditing.

Now click on Administrative user roles link on the left navigation pane Click on the Add button

1. Select the role Auditor.2. Then Click on Search to locate the user. Users are shown in the Available section.3. Select the user from Available section and move it to “Mapped to role” section by clicking on

the arrow that point to the right.4. Click OK button.

The “OK” button did not work properly in Google Chrome browser at the time of writing this course material. It worked properly in Mozilla Firefox browser.

8

Page 9: WebSphere Security Auditing

The following message is displayed, asking for confirmation.

Click Save hyperlink

9

Page 10: WebSphere Security Auditing

4. Configure Audit Monitor

”Did you know? You can buy my WebSphere 8 Network Deployment Essentials course for only $99 From The Middleware Shop.”

Audit Monitor has to be configured next, which sends out notification if the security auditing subsystem fails.

Click Security auditing under Security from the left navigation pane Click Audit monitor Link under Related Items in the content pane

Click New button

10

Page 11: WebSphere Security Auditing

Enter a name to the notification Check Message log check box Click OK

11

Page 12: WebSphere Security Auditing

Click Save hyperlink

Check Enable Monitoring option. Select the notification created previously. Click OK button.

12

Page 13: WebSphere Security Auditing

Click Save button when the following message is displayed

Note that the server has to be restarted for these changes to take effect

Check Enable security auditing check box. Select Log warning in Audit subsystem failure action drop-down

o If you select No warning, then no notification is given in case of audit subsystem failureo Terminate server option will make the server to shutdown gracefully

Select the primary auditor user name Click Apply button.

13

Page 14: WebSphere Security Auditing

Click Save button

Note: This change requires a server restart to come into effect. At this point of time, the Security Auditing feature is enabled, and further configuration is optional.

14

Page 15: WebSphere Security Auditing

5. Verifying generation of audit messages

Restart Server

The audit log can be viewed through a text editor.

Go to <profile_root>/logs/<server_name> directory and open the file with the nameo BinaryAudit_<cell_name>_<node_name>_<server_name>.log

Note: Every event starts with a sequence number.

The event type is displayed next. The fields are separated by a “|” character. This is hard to read, but easy to grep.

15

Page 16: WebSphere Security Auditing

Now let us generate a security event and check the audit log.

Logout of the console Try to Login with an incorrect user name, say “hacker”

16

Page 17: WebSphere Security Auditing

A security event should be generated and written to the log file.

Open the log file again and check.

17

Page 18: WebSphere Security Auditing

18

Page 19: WebSphere Security Auditing

6. Generate a HTML report using binaryAuditLogReader

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$ sudo ./wsadmin.sh -lang jython -username security_auditor -password websphere[sudo] password for steve:

WASX7209I: Connected to process “server1″ on node node01 using SOAP connector; The type of process is: UnManagedProcess

WASX7031I: For help, enter: “print Help.help()”

wsadmin>AdminTask.binaryAuditLogReader(‘-interactive’)

Binary Audit Log Reader

Binary Audit Log Reader Command

*File name of the Binary Audit log (fileName): /opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/BinaryAudit_steve-H67N-USB3-B3Node01Cell_node01_server1.log

Report mode selection (reportMode): basic

Event(s) filter (eventFilter):

Outcome(s) filter (outcomeFilter):

Sequence filter (sequenceFilter):

Timestamp filter (timeStampFilter):

Key Store Password (keyStorePassword):

*Output HTML file location (outputLocation): /home/steve/Documents/basicAuditReport.html

Data points to report (dataPoints):

Binary Audit Log Reader

F (Finish)

C (Cancel)

Select [F, C]: [F] F

WASX7278I: Generated command line: AdminTask.binaryAuditLogReader(‘[-fileName /opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/BinaryAudit_steve-H67N-USB3-

19

Page 20: WebSphere Security Auditing

B3Node01Cell_node01_server1.log -reportMode basic -outputLocation /home/steve/Documents/basicAuditReport.html ]‘)

‘true’

wsadmin>

20

Page 21: WebSphere Security Auditing

7. Creating an event filter

Now open WebSphere Administrative console as “security_auditor”, the user who plays Auditor administrative role to create a new Event Type filter. An Event Type filter represents a type of security event, and when added to an Audit Event Factory and Audit Service Provider, allows this event to be sent to the audit log. WebSphere comes with four Event Type filters pre-configured.

Expand Security in Navigation pane Click Security auditing Click Event type filters under “Related Items”

Enabling Verbose Auditing will result in additional information being written to the audit log for every event.

Click New button

21

Page 22: WebSphere Security Auditing

Give a name to the Event Type filter Select the type of event, say SECURITY_AUTHZ Select the type of outcome, say DENIED Click OK button

22

Page 23: WebSphere Security Auditing

Click Save hyperlink

23

Page 24: WebSphere Security Auditing

7a. Configuring Audit Service Provider

The Audit Service Provider is a key component to be configured. This controls the security audit log file rotation policy as well. The event type filter created in the previous step has to be added to the Audit Service Provider to allow the events represented by the event type filter to be written to the audit log.

Open Administrative console as Auditor Expand Security in Navigation pane Click Security Auditing hyperlink Click Audit service provider under Related Items

24

Page 25: WebSphere Security Auditing

An Audit service provider is already pre-configured.

Click the existing Audit service provider

25

Page 26: WebSphere Security Auditing

You will find the new Event Type filter under Selectable Filters

Select it and click on the right arrow to move it to Enabled Filters section Click OK button

Click Save hyperlink

7b. Configuring Audit Event Factory

26

Page 27: WebSphere Security Auditing

The Audit event factory is responsible for receiving the audit event messages and created event objects and forwards them to the Audit Service Provider. So in a way the Audit service provider is dependent on the Audit event factory object.

Open Administrative console as Auditor Expand Security in Navigation pane Click Audit event factory configuration

Click on the pre-configured Audit event factory object

27

Page 28: WebSphere Security Auditing

Select the Event type filter created earlier Click the right arrow to move it from Selectable filters to Enabled filters Click OK button

28

Page 29: WebSphere Security Auditing

Click Save hyperlink

Restart Application server Try to stop the server using Auditor credentials

Notice that a message “ADMN0022E: Access is denied for the stop operation on Server MBean because of insufficient or empty credentials” is displayed in the command line.

29

Page 30: WebSphere Security Auditing

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$ sudo ./stopServer.sh server1 -username security_auditor -password websphereADMU0116I: Tool information is being logged in file/opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/stopServer.logADMU0128I: Starting tool with the appsrv01 profile

ADMU3100I: Reading configuration for server: server1

ADMU0111E: Program exiting with error: javax.management.JMRuntimeException:

ADMN0022E: Access is denied for the stop operation on Server MBean

because of insufficient or empty credentials.

ADMU4113E: Verify that username and password information is correct. If

running tool from the command line, pass in the correct -username

and -password. Alternatively, update the <conntype>.client.props

file.

ADMU1211I: To obtain a full trace of the failure, use the -trace option.

ADMU0211I: Error details may be seen in the file:

/opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/stopServer.log

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$

Open audit log using a text editor Note the SECURITY_AUTHZ event written to the audit log

30

Page 31: WebSphere Security Auditing

31

Page 32: WebSphere Security Auditing

8. Signing your security audit records

Audit log can be digitally signed to make it tamper-proof. When the log is digitally signed, it is also Base-64 encoded which makes it impossible to read through a text editor without decoding it back. So the only way to read a digitally-signed audit log is by generating a html report using binaryAuditLogReader tool.

Open Administrative console as Auditor

Expand Security under Navigation Pane

Click on Security Auditing

Click on Audit record signing configuration under Related Items

Check Enable signing

32

Page 33: WebSphere Security Auditing

Select a managed keystore (Accept the default value) Select default for Certificate alias Click OK button

Click Save hyperlink Restart application server

33

Page 34: WebSphere Security Auditing

Open audit log (found under <profile_root>/logs/<server_name>)

Note: The certification information used to sign is written under Signing_information element

Also note that the event is base-64 encoded

34

Page 35: WebSphere Security Auditing

Generate HTML report and check whether you are able to still see the events

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$ sudo ./wsadmin.sh -lang jython -username security_auditor -password websphere

WASX7209I: Connected to process “server1″ on node node01 using SOAP connector; The type of process is: UnManagedProcess

WASX7031I: For help, enter: “print Help.help()”

wsadmin>AdminTask.binaryAuditLogReader(‘-interactive’)

35

Page 36: WebSphere Security Auditing

Binary Audit Log Reader

Binary Audit Log Reader Command

*File name of the Binary Audit log (fileName): /opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/BinaryAudit_steve-H67N-USB3-B3Node01Cell_node01_server1.log

Report mode selection (reportMode): basic

Event(s) filter (eventFilter):

Outcome(s) filter (outcomeFilter):

Sequence filter (sequenceFilter):

Timestamp filter (timeStampFilter):

Key Store Password (keyStorePassword):

*Output HTML file location (outputLocation): /home/steve/Documents/report.html

Data points to report (dataPoints):

Binary Audit Log Reader

F (Finish)

C (Cancel)

Select [F, C]: [F] F

WASX7278I: Generated command line: AdminTask.binaryAuditLogReader(‘[-fileName /opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/BinaryAudit_steve-H67N-USB3-B3Node01Cell_node01_server1.log -reportMode basic -outputLocation /home/steve/Documents/report.html ]‘)

‘true’

wsadmin>quit

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$

36

Page 37: WebSphere Security Auditing

37

Page 38: WebSphere Security Auditing

9. Encrypting the Security Audit Log

The Audit log can be encrypted to make the information unavailable for intruders. Configuration is a two step process. The keystore is to be configured with a digital certificate in the first step. Encryption has to be enabled with this keystore in the second step.

Digitally Signing the audit log, Encrypting the audit log, Selecting several Event Types to be written to the log, all these take up some CPU cycles. So evaluate your requirements carefully before enabling them, as otherwise they burden the CPU unnecessarily.

9.a Configuring Keystore and certificate required for encryption

Open Administrative Console and expand Security in Navigation pane Click Security auditing Click Audit encryption key stores and certificates

38

Page 39: WebSphere Security Auditing

Click New

Give a name to the keystore Enter the path where the keystore is to be created (Enter

<profile_root>/properties/AuditKeyStore.p12) Give a password for the keystore (You need to keep this password safe) Confirm password by entering it again Select PKCS12 as keystore type Click OK button

39

Page 40: WebSphere Security Auditing

Click Save hyperlink

Click on the keystore created just now

Click on Personal certificates hyperlink under Additional Properties Click Create self-signed Certificate button (Note that for production use, you need to get this

from a CA)

40

Page 41: WebSphere Security Auditing

The encryption strength depends on the size of the key. The alias name is used to locate the certificate within the keystore.

Give an alias name Select 1024 bits as the key size Give a common name Give the validity period for the certificate (Accept default value of 365 days) Click OK button

41

Page 42: WebSphere Security Auditing

9.b Audit record encryption configuration

Expand Security in Navigation Pane Click Security auditing hyperlink Click Audit record encryption configuration under Related Items

42

Page 43: WebSphere Security Auditing

Check Enable Encryption Select the keystore name from the drop-down Select the alias name to locate the certificate within the keystore Click OK button

43

Page 44: WebSphere Security Auditing

Click Save hyperlink

44

Page 45: WebSphere Security Auditing

Restart application server Open audit log using a text editor

Note that the encryption information is written to the audit log confirming that the audit log is encrypted.

To view the contents of the encrypted audit log, the binaryAuditLogReader tool can be used to decrypt and generate an HTML report.

Notice that this time you need to provide the keystore password to successfully generate the HTML report.

45

Page 46: WebSphere Security Auditing

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$ sudo ./wsadmin.sh -lang jython -username security_auditor -password websphere

WASX7209I: Connected to process “server1″ on node node01 using SOAP connector; The type of process is: UnManagedProcess

WASX7031I: For help, enter: “print Help.help()”

wsadmin>AdminTask.binaryAuditLogReader(‘-interactive’)

Binary Audit Log Reader

Binary Audit Log Reader Command

*File name of the Binary Audit log (fileName): /opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/BinaryAudit_steve-H67N-USB3-B3Node01Cell_node01_server1.log

Report mode selection (reportMode): basic

Event(s) filter (eventFilter):

Outcome(s) filter (outcomeFilter):

Sequence filter (sequenceFilter):

Timestamp filter (timeStampFilter):

Key Store Password (keyStorePassword): websphere

*Output HTML file location (outputLocation): /home/steve/Documents/reportDecrypted.html

Data points to report (dataPoints):

Binary Audit Log Reader

F (Finish)C (Cancel)

Select [F, C]: [F] F

WASX7278I: Generated command line: AdminTask.binaryAuditLogReader(‘[-fileName /opt/IBM/WebSphere/AppServer/profiles/apprv01/logs/server1/BinaryAudit_steve-H67N-USB3-B3Node01Cell_node01_server1.log -reportMode basic -keyStorePassword ***** -outputLocation /home/steve/Documents/reportDecrypted.html ]‘)‘true’wsadmin>quit

46

Page 47: WebSphere Security Auditing

steve@steve-H67N-USB3-B3:/opt/IBM/WebSphere/AppServer/profiles/apprv01/bin$

Note: The usage of the binaryAuditLogReader is recorded as a SECURITY_RESOURCE_ACCESS event.

47