首页 > 学技术 > 技术网文 > IBM AS400应用论坛 > 正文

[精彩] 如何记录用户登录和退出的时间?


来源 chinaunix.net 酷勤网整理

现在需要在短时间内记录几个用户的登录和退出时间(qinter内的),如何能很快的方便的获取呢?



 居士 回复于:2005-11-25 12:59:17

我一般的做法,就是修改用户的jobd, Log CL program commands  . . . .   *NO  
里面可以记录下用户登陆期间运行的CL命令,然后退出后会保存成splf文件。可以检查用户登陆退出时间,以及做了些什么操作。



                        Change Job Description (CHGJOBD)                        
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Accounting code  . . . . . . . .   *USRPRF                                     
 Routing data . . . . . . . . . .   'QCMDI'                                     
                                                                                
 Request data or command  . . . .   *NONE                                       
                                                                                
                                                                                
                                                                                
 CL syntax check  . . . . . . . .   *NOCHK        0-99, *SAME, *NOCHK           
 Initial library list . . . . . .   *SYSVAL       Name, *SAME, *SYSVAL, *NONE   
                + for more values                                               
 End severity . . . . . . . . . .   30            0-99, *SAME                   
 Message logging:                                                               
   Level  . . . . . . . . . . . .   4             0-4, *SAME                    
   Severity . . . . . . . . . . .   00            0-99, *SAME                   
   Text . . . . . . . . . . . . .   *NOLIST       *SAME, *MSG, *SECLVL, *NOLIST 
 Log CL program commands  . . . .   *NO           *SAME, *NO, *YES              
                                                                        More...


 居士 回复于:2005-11-25 13:00:38

Log CL program commands  . . . .   *NO    这个改成*yes


 qingzhou 回复于:2005-11-25 19:03:52

如果想狠一点,就修改SIGNOFF的默认参数LOG(*NOLIST)—>*LOG(*LIST),每个登陆400的用户操作全记载。

不过建议短暂使用,不用时及时修改回去,因为会造成系统产生大量SPLF,会消耗系统ASP%资源的。


 porKiller 回复于:2005-11-25 20:07:47

居士兄的方法还暂时没有试,qingzhou的办法先前用过,但效果不理想,虽然可以从wrksplf 用户名中看到start和end的时间,但很不直观--log太多,我只需要starting time and end time 。

我在另一个400论坛也问了,fh2001(估计你们都知道吧)回答的方法我试了试,还不错,就是dsplog msgid(cpf1164), 很直观,一排一排的,有登录用户的结束时间。但缺点是还有其他不少log信息--筛选的还不够干净--不知道该如何做到最佳审计--仅审计用户何时登录、何时注销。
谢谢,今天下午忙坏了,所以现在才来感谢。还没吃饭。


 gpm 回复于:2005-11-26 23:57:52

DSPLOG JOB(QZSOSIGN) MSGID(CPIAD0B CPF1164)


 居士 回复于:2005-11-27 10:17:19

gpm 说的方法我测试了一下。看不到用户的登陆退出信息。

另外MSG ID : CPIAD0B的描述如下:

                                                            
 Message ID . . . . . . . . . :   CPIAD0B                                       
 Message file . . . . . . . . :   QCPFMSG                                       
   Library  . . . . . . . . . :     QSYS                                        
                                                                                
 Message . . . . :   *SIGNON server job &3/&2/&1 processing request for user &4 
   on &5 in subsystem &6 in &7.                                                 
 Cause . . . . . :   The *SIGNON server is processing request &8 for user &4.   
   The types of requests supported are as follows:                              
     1 -- Retrieve Signon Information                                           
     2 -- Change Password                                                       
     3 -- Generate Authentication Token                                         
     4 -- Generate Authentication Token on Behalf of Another User               
     5 -- Start Server                                                          
                                                                                




Display the history log
Each time a client user successfully connects to a server job, that job is swapped to run under the profile of that client user. To determine which job is associated with a particular client user, you can display the history log with the DSPLOG command. Look for the messages starting with: 

CPIAD0B (for signon server messages) 
CPIAD09 (for messages relating to all other servers) 


signon 服务的描述:

Signon server
The Signon server provides security for clients. This security function prevents access to the system by users with expired passwords, validates user profile passwords and returns user profile security information for use with password caching and iSeries(TM) Navigator Application Administration. 

The programs listed in the following table are included with this server. 
Signon server programs Program name  Library  Description  
QZSOSIGN  QSYS  Server program  
QZSOSGND  QSYS  Daemon program  


所以,gpm 说的signon服务,不是说的用户登陆,而是指系统的一个服务。所以我认为gpm说的方法是有问题的。


 porKiller 回复于:2005-11-27 11:03:15

我瞎想一下,有没有这种可能:(我在微机端这么做过),就是修改signoff的cl命令,使在signoff时获取系统时间;为用户属性增加一个字段--退出时间,将上述signoff时获取的系统时间写进该字段。
简单说就是现在400只有“上次登录时间”,没有“上次结束时间”--能否加一个呢?我不知道。

另:居士兄2楼的方法我还没有试,仔细看了一下,是否是:也是通过修改系统jobd的默认值,记录或者不记录job期间运行的cl命令,但都是有登录和退出时间的?会否即使不记录cl命令,splf(log)内还是很多内容?明天上班试一下。

大家动脑筋好好玩。


 居士 回复于:2005-11-27 20:00:14

修改singoff命令,记录下登陆的joblog的方法有个弊端
如果用户直接关闭窗口,就会造成无法记录


 mickeycheng 回复于:2005-11-30 15:02:03

以下方法不知道是否可行:
1、为该用户单独定制JobD,如MYJOBD,在MYJOBD中指定RTGDTA参数为特定字符串,如:"MYDATA"
2、将该用户的简要表中的JobD参数修改为MYJOBD
3、定制一个路由入口程序MYENTCMD。
  PGM
         /* ADD Record Start-time Process Here */
          ...
  
         Call QCMD

         /* ADD Record End-Time Process Here */
           ...
      ENDPGM

将该程序编译到 MYLIB下

4、ADDRTGE   SBSD(QINTER) SEQNBR(800)  CMPVAL("MYDATA")  PGM(MYLIB/MYENTCMD) 

5、完成


 utirei 回复于:2005-11-30 16:36:21

我们当前的系统监控sesion。但是每个用户都定义一个UID 。


 YZG 回复于:2005-11-30 17:00:05

直接处理WRKACTJOB中的信息得了.


 hanyu 回复于:2005-11-30 18:58:07

如果需要在signoff 的时候,强制记点东西,可以给signoff加个校验程序,记个登陆退出是没问题的。但作为安全应用审计,还是只能通过对目标、对事件的审计完成。应该说400的审计功能还是相当强大的。


 qingzhou 回复于:2005-11-30 22:43:51

一般是利用AS/400的审记功能来起到监控用户操作或监控对敏感数据的访问,这样比较有意义。

如果要仅仅只显示用户登陆/退出的时间,估计要通过写代码才能过滤干净的数据。


 beeryj 回复于:2005-12-07 17:31:54

先为用户设置Initial program将Job name,User name,Job Number信息记录到文件中,然后用命令
DSPLOG JOB(033362/USERNAME/DSP01) MSGID(CPF1124 CPF1164)




原文链接:http://bbs.chinaunix.net/viewthread.php?tid=656071
转载请注明作者名及原文出处



收藏本页到: