IBM Security Z Security

 View Only
Expand all | Collapse all

Compare RACF Databases

  • 1.  Compare RACF Databases

    Posted Wed March 22, 2023 09:37 AM

    Does zSecure have a utility that would compare one RACF DB to another RACF DB?   Or compare 2  zSecure unloads?

    Our multiple systems are connected via RRSF, so in theory the databases should be in sync.   However, I do some cases where that is not the case.   I would like to produce a report of what is out of sync and show it to our administration team to verify these situations are intentional, or do I have a different issue.



    ------------------------------
    Linnea Sullivan
    ------------------------------


  • 2.  RE: Compare RACF Databases

    Posted Wed March 22, 2023 01:34 PM

    Hi Linnea, 

    zSecure supports a feature that is named "Show differences" that is capable of comparing RACF DBs, UNLOADs, and/or CKFREEZE data sets from different systems or from the same system at different points in time. 
    When you have access to the IBM Security Learning Services Academy, you can find 2 videos that I have recorded about this topic:

    For your your convenience here's a link to the Academy: https://www.securitylearningacademy.com/

    I hope this answers your question. 



    ------------------------------
    Tom Zeehandelaar
    z/OS Security Enablement Specialist - zSecure developer
    IBM
    ------------------------------



  • 3.  RE: Compare RACF Databases

    Posted Thu March 30, 2023 12:34 PM

    Tom, so my team looked at those 2 videos, and have ran some tests, and we have a few questions:

    1. We are rolling out zOS 2.5.   PHRINT(Phrase Interval) is new with 2.5.    When I compare against a 2.4 system every User ID is an exception.    Anyway to exclude a field from the comparision?
    2. When comparing groups I see this on a number of groups USERID(->).    Normally I would see USERID(ABCD123->) or USERID(->XYZ1234).   What is USERID(->) telling me?
    3. When I run the process under TSO I see the list of Users or Groups that are not the same.     I can put a "S" beside the User or Group and see the difference.     But if I have a lot of Users/Groups I don't want to select them one by one.    I tried PRINT FORMAT thinking it may have a column to show the differences.    Any thoughts on how to list the changes in PRINT FORMAT?

    Thanks



    ------------------------------
    Linnea Sullivan
    ------------------------------



  • 4.  RE: Compare RACF Databases

    Posted Fri March 31, 2023 05:30 AM
    Edited by Tom Zeehandelaar Fri March 31, 2023 05:53 AM

    Hi Linnea. Thanks for the feedback. Let me try to answers your questions to the best of my ability.

    1. I do not know of an easy way to exclude a field from the comparison. The 'Show differences' function uses a CARLa COMPAREOPT specification. In the UI, zSecure uses the so called 'default COMPAREOPT specification'. This specification simply runs the 'Show differences' function for all fields that support comparisons. However, the CARLa Command Reference contain a section about this COMPAREOPTS keyword that explains how you can specify you own COMPAREOPT specification that only compares the fields that you are interested in to compare. 

    2. When comparing groups, the field USERID represents a user ID that is connected to that group. Thus, when you encounter USERID(ABCD123->) this indicates that user ID ABCD123 was connected to that group in the compare base, but this user ID is no longer connected to that group in the main set. Encountering USERID(->XYZ1234) means that user ID XYZ1234 is not connected to the selected group in the compare base but it connected to this group in the main set that you allocated.

    3. Well indeed the Print format would be your way to go with this one. However, by default, the one line users with changes overview only contain a column about the type (ADD, DEL, CHG, CHG-, or CHG+) of change, but not the details of the change(s). When you select option 'full page form' in the print output format, you will get the change details reported. However, that is in a full page format for each changed user. But when you look at the COMMANDS work data set, you can see that the change details are generated by the following CARLa specification (compareopt=1 ? / COMPARE_CHANGES). 

    If you are only interested in a report of all changed users with the change details, I guess you can customize sortlist of the CARLa that generates the report. I reran my query in print format (without the 'full page format) and then customized COMMANDS like so:

    symbolic num compareopt=1                                              
    DEFAULT COMPAREOPT_SHOW=(ADD,DEL,CHG+,CHG-,CHG)                        
    DEFINE TYPE=* HELPPANEL=CKRT3SHD COMPARE_CHANGES(CMPCHG,0,WW,HEADER),  
     COMPARE_CHANGES                                                       
    DEFINE TYPE=* HELPPANEL=CKRT3SHD COMPARE_RESULT(NOSORTLIST,NODETAIL),  
     COMPARE_RESULT                                                        
    n n=baseu1 segment=BASE required allowrestrict ,                       
     ,                                                                     
     tt="zSecure Admin+Audit for RACF USER overview",                      
     st='All users'                                                        
     s s=base c=user                                                       
     sortlist " - complex"(tt,page) complex(tt,page) stamp(tt),            
     ,                                                                     
     key(8,"User") name (compareopt=1 ? compare_result, COMPARE_CHANGES(0))

     That generates a report with all users that are changed with their name, change type, and change details. On my system it looks like this:

    zSecure Admin+Audit for RACF USER overview - complex ED02      3Oct2018 13:01 
    All users                                                                     
                                                                                  
    User     Name                 Comp Changes                                    
    CR550Q   US TRAINING ID R     DEL                                             
    CR550R   US TRAINING ID R     DEL                                             
    CR550S   US TRAINING ID R     DEL                                             
    CRMBER3  BERT LIND            CHG  CGGRPNM(->CRMBNAG1)
     PHRINT(->0)        
    CRMBHJ2  HAM GOETZ            CHG  PHRINT(->0)            
    CRMBJK1  JERRY KAPLAN         CHG  CGGRPNM(->SYSPROG)     
                                       DFLTGRP(TRAINERS->CRMB)
                                       OWNER(TRAINERS->CRMB)  

    Would that help?


    ------------------------------
    Tom Zeehandelaar
    z/OS Security Enablement Specialist - zSecure developer
    IBM
    ------------------------------



  • 5.  RE: Compare RACF Databases

    Posted Fri March 31, 2023 10:13 AM

    Thanks for the information.   Followup on #2.     I understand when a userid is listed in field, but I am literally seeing  "USERID(->)"    There is no user ID on either side of the ->.

    In Rob's earlier response it pointed me to the sample library where I found C2RJMSYN.     It seems to be capable of analyzing the entire RACF DB (via a unload) and displaying the differences.  Do you know of any pro's / con's of using that process over going through   RA.U  RA.G  RA.D and RA.R to comapre/show differences?



    ------------------------------
    Linnea Sullivan
    ------------------------------



  • 6.  RE: Compare RACF Databases

    IBM Champion
    Posted Fri March 31, 2023 10:50 AM

    I remember seeing GROUP(->) listed when a group was removed and reconnected to a user.  This changes the (chronological) order of group names in CONGRPNM, so a change in the field was found, but the same groups were found, thus the less than sensical GROUP(->).  Now, I do not remember if the USERID field in a GROUP profile is similarly ordered, or if it's alphabetically, but that might be an explanation.

    Regarding MERGE, this was originally designed to synchronize authorities and access controls between RACF databases, so you will find that not all fields are supported.  Consequently, changes to some segment fields may go unobserved.  Also, MERGE may be slow in picking up support for new fields.  But I saw it used as an after the crash cleanup for early implementations of RRSF.  Again, from memory....



    ------------------------------
    Rob van Hoboken
    ------------------------------



  • 7.  RE: Compare RACF Databases

    Posted Fri March 31, 2023 12:36 PM

    Hi Linnea,

    I think for the purpose of listing differences, the section rather points to C2RJMDIF, as the synchronization process  seems to be supposed to be done in a number of separate phases.

    I guess you need to take a look whether the kind of changes you are interested in are flagged by MERGE. In theory I suppose that COMPAREOPT gives you quite fine-grained control--but making use of that might be more laborious.

    Regards,



    ------------------------------
    Jeroen Tiggelman
    Software Development and Level 3 Support Manager IBM Security zSecure Suite
    IBM
    Delft
    ------------------------------



  • 8.  RE: Compare RACF Databases

    IBM Champion
    Posted Thu March 23, 2023 05:35 AM

    You can also read up on the MERGE function in zSecure Admin.  It can be used to list (many) differences between RACF input sources and generate commands to address those https://www.ibm.com/docs/en/szs/2.5.0?topic=guide-using-merge-identify-changes-in-racf 



    ------------------------------
    Rob van Hoboken
    ------------------------------



  • 9.  RE: Compare RACF Databases

    Posted Tue April 18, 2023 01:20 PM

    Rob, we been trying out everyone's suggestions, but so far we think your suggestion fits the best.   But we did notice something and did not know if it was intentional or an oversight.   If we compare the base to the target, we see the target contains USERIDs that do not exist on the base.   We think the IDs used to exist on the base but for whatever reason the delete user commands did not get propagated to the target.      We were not sure if we should expect to see DELUSER commands to remove these IDs from the target.      My assumption is that the process just makes sure the UserIDs/Groups/Profiles that exist on the base, gets built on the Target.    But nothing cleans up extra UserIDs/Groups/Profiles that exist on the target.

    Thanks



    ------------------------------
    Linnea Sullivan
    ------------------------------



  • 10.  RE: Compare RACF Databases

    Posted Tue April 18, 2023 01:36 PM

    Hi Linnea,

    The first step mentioned for actually merging database is to make sure that the database have reasonable referential integrity: https://www.ibm.com/docs/en/szs/2.5.0?topic=reference-pdf , so I would not recommend relying on results from MERGE if your databases have such structural errors. 

    So I would recommend using VERIFY PERMIT and VERIFY CONNECT to clean up the databases first.

    Regards,



    ------------------------------
    Jeroen Tiggelman
    Software Development and Level 3 Support Manager IBM Security zSecure Suite
    IBM
    Delft
    ------------------------------



  • 11.  RE: Compare RACF Databases

    Posted Tue April 18, 2023 01:39 PM

    Hmmm.. that link does not actually seem to locate the right section. This one might be better: https://www.ibm.com/docs/en/szs/2.5.0?topic=database-cleaning-up-security-databases



    ------------------------------
    Jeroen Tiggelman
    Software Development and Level 3 Support Manager IBM Security zSecure Suite
    IBM
    Delft
    ------------------------------



  • 12.  RE: Compare RACF Databases

    IBM Champion
    Posted Wed April 19, 2023 03:47 AM
    Edited by Rob van Hoboken Wed April 19, 2023 03:54 AM

    True enough, Linnea.  MERGE primarily adds profiles into the current database, when they are found in mergesource but not in current.  So I had to write explicit support for the reverse, using newlist type=merge, I think:

    newlist type=merge nopage dd=ckrcmd
      s class=dataset missing(field) exists(profile) missing(src_profile)
      sortlist "deldsd '" | profile(0) | "'"
    newlist type=merge nopage dd=ckr2pass
      s class=user missing(field) exists(profile) missing(src_profile)
      sortlist "remove user=" | profile(0)

    At least, that's what I remember from 15 (?) years ago.  Maybe I had to reverse the current and mergesource ALLOC commands, so MERGE wants to create profiles (found in current), and use these findings to create the delete commands.  Just run a merge report on the reversed allocations to see what src_profile, cur_profile and profile indicate:

    newlist type=merge 
      s class=user
      sortlist profile(8) src_profile(8) cur_profile(8) field value src_value cur_value

    Add your own code for groups, general resources and connects.  Fix concept errors... and test thoroughly.

    ------------------------------
    Rob van Hoboken
    ------------------------------



  • 13.  RE: Compare RACF Databases

    Posted Mon May 01, 2023 02:57 PM

    Rob, we are continuing to play with the merge function, but we are seeing some strange results.   Majority of the changes the merge suggests is right on target just these 2 instances are strange:

    #1.   In the STARTED Class SITEA has several profiles create with no access list.   SITEB does not have these profiles.    The merge generates PERMIT profile1 CLASS(STARTED) RESET commands.   I would have thought since the profiles did not exist on SITEB  RDEF and RALT commands would be generated.

    #2.  In the DB2 Class MDSNGV  SITEA  does not certain profiles.   Site B does have the profiles.   But the merge is showing permit commands that need to be run on SITEB this should not be possible since SITEA does not have the profiles.       We thought we had the input files reversed, but we noticed the PERMIT commands that were generated hand a lot more groups on the PERMIT command than what existed in the profile on SITEB.   We have run the merge on lots of other systems successfully, so we feel we don't have the input files reversed, but we can't figure out why this is happening.   Its also happening on a couple of user defined classes as well.     Any suggestions to try?



    ------------------------------
    Linnea Sullivan
    ------------------------------



  • 14.  RE: Compare RACF Databases

    IBM Champion
    Posted Fri May 05, 2023 06:08 AM

    Hi Linnea
    When you run into functions that look like defects, you are probably better off opening a Case and including SYSPRINT etc. for L2 support to look at.



    ------------------------------
    Rob van Hoboken
    ------------------------------



  • 15.  RE: Compare RACF Databases

    Posted Fri March 24, 2023 04:06 AM

    Hi Linnea.

    I can fully appreciate your problem, as I have been facing the same. In order to shed light on the problem, I have developed a number of queries that compares unloads from multiple RACF databases and highlights the core differences in a simple and very compressed format.

    The below is an example of comparing some of the contents of user profiles in three unloads, but you may add more unloads and more fields as you please.
    alloc type=UNLOAD DD=UNL1 complex=SYS1
    alloc type=UNLOAD DD=UNL2 complex=SYS2
    alloc type=UNLOAD DD=UNL3 complex=SYS3

    define  xSYS1(HB,2,"S1") boolean where complex=SYS1
    define  xSYS2(HB,2,"S2") boolean where complex=SYS2
    define  xSYS3(HB,2,"S3") boolean where complex=SYS3
    define  xInterval AS passint   where NOT(protected)

    NEWLIST  n=USERBASE retain tt="USER class basic comparison"
      select class=user segment=base
    summary  key(8,"User") Name DfltGrp Owner,   
             xSYS1(2,"S1") xSYS2(2,"S2") xSYS3(2,"S3"),
             Special(1,"S",hb) ! Operations(1,"O",hb) ! , 
             Auditor(1,"A",hb) ! ROAudit(1,"R",hb),
             Protected(1,"P",hb) xInterval(3,"Int") UAudit(6,"UAUDIT"), 
             key:uid(10)  count(<3)

    The last one, count(<3), will eliminate all users that are identical in all three unloads, leaving only the ones that you want your security admins to look at.
    The same technique can be used for groups, user-to-group connects, dataset and general resource classes and access control lists.

    Best regards
    Mikael Rasmussen
    Danske Bank



    ------------------------------
    Mikael Rasmussen
    Senior Mainframe Security Engineer
    Danske Bank
    Brabrand
    +4540766221
    ------------------------------