Fact: System Auditing and Reporting (SAR)
Fact: NetIQ Security Solutions for iSeries 8.0
Fact: PSAudit 8.0
Goal: How can I receive notifications when a specific command is used?
To generate real-time alerts for the usage of commands other than the pre-configured SQL and Query commands, you must use the attached source code to create a program that will allow you to register additional command processing programs (CPPs) for monitoring by the PSAudit SQL/QRY Monitor.
To use SQL/QRY Monitor for any command:
- Save the linked file to the root directory of the local drive (C:\) on your PC.
- Copy the file from the PC to the iSeries using FTP:
- Open a new DOS or command window.
- Type the following command where
servernameis the name or IP address of your iSeries server and press Enter.
- Type a user ID at the FTP prompt, and press Enter.
- Type the associated password at the FTP prompt, and press Enter.
- Type the following commands, pressing Enter after each:
put c:\SAR0581C.txt QGPL/QCLSRC.SAR0581C
- From the iSeries server command line, type the following commands, pressing Enter after each:
CRTCLPGM QGPL/SAR0581C QGPL/QCLSRC TEXT('Load CPP into SAR0511F') ALWRTVSRC(*NO) AUT(*EXCLUDE) TGTRLS(*CURRENT)
CHGOBJOWN QGPL/SAR0581C *PGM NEWOWN(PSOBJOWN)
GRTOBJAUT QGPL/SAR0581C *PGM REFOBJ(PSAUDIT/SAR0515C)
- From PSMENU, select options 1, 1, and 7.
- Press F10 (Cmd Line).
CALL QCMDand press Enter.
- Back up the file containing SQL/QRY CPPs by typing the following command and pressing Enter:
CPYF FROMFILE(SAR0511F) TOFILE(PSAUDIT/SAR0511F75) MBROPT(*REPLACE) CRTFILE(*YES)
- Back up the file containing SQL/QRY commands by typing the following command and pressing Enter:
CPYF FROMFILE(SAR0515F) TOFILE(PSAUDIT/SAR0515F75) MBROPT(*REPLACE) CRTFILE(*YES)
- Call program to register a command for monitoring. For example, to register command CRTUSRPRF in QSYS:
CALL PGM(SAR0581C) PARM(CRTUSRPRF QSYS SAR0511F)
Please note that multiple related commands may use the same CPP. For example, the CRTUSRPRF command uses CPP QSYUP which is also used by CHGUSRPRF command. Similarly, the CHGDTA command uses CPP QDZCMDP which is also used by commands DLTDFUPGM, DSPDTA, and UPDDTA.
- Press F12 (Cancel) twice to exit the command line and return to the menu.
- To load the list of commands, select option 28 (Work with SQL/QRY Auditing).
- Press F7 (Load).
- In the Run interactively field, type
*YESand press Enter.
- When the list of commands finishes loading, press F5 (Refresh).
- To activate alerts for a command, select option 28 (Work with SQL/QRY Auditing) and specify option 8 (Start Alert) for the appropriate command.
The SQL/QRY Monitor subsystem does not need to be active to send alerts. The command usage alerts are sent to PSDetect and can be managed there through alert queue PSDAPI. To forward alerts to a specific msgque instead of to PSDetect, use option 29 (Maintain Audit Alert MSGQ).
- To activate Auditing for a command, select option 28 (Work with SQL/QRY Auditing) and specify option 2 (Start Audit) for the appropriate command.
The command usage audit entries are sent to journal QAUDJRN. To report on command usage audit entries, from PSMENU, select options 1, 1, 5, 3, and 9. The SQL/QRY Audit Report will include events for all monitored commands that are being audited by the SQL/QRY Monitor.
- To register an additional command, repeat steps 9 through 16.