Why Cleaning Up Is an Important Part of Your IBM i Security Practice

IBM i (OS/400, i5/OS)
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Don’t ignore the risks presented by objects, profiles, and products that are no longer in use.

I don’t know about you, but I like to start the year with a fresh slate. I create a new set of files for the new year, start new status reports for my clients, etc. But I also like to get rid of things—files containing old sample code or white papers that are no longer relevant, for example. What does this have to do with your IBM i security strategy? Just like it would do damage to my business if I were to send out inaccurate or irrelevant code or recommendations, it may do your business harm if you keep old stuff in your system. This is a great time to make a fresh start with your IBM i and make sure you don’t have outdated stuff lying around. In this article, I discuss the areas of the system you’ll want to examine and provide ways to determine what’s old and not in use.

User Profiles

I’ve said it before, and I’ll say it again: Leaving inactive user profiles on your system poses a risk to your organization. If it wasn’t obvious before, given the recent social-engineering attacks, it should be apparent now that leaving inactive profiles is a door into your system. Depending on how well your help desk is trained to reject social-engineering attacks, it usually doesn’t take much for a bad actor to get an inactive profile re-enabled and reset the password to make an inactive profile usable again. So why are you leaving inactive profiles on your system?! Sorry to harp on this, but this is a real pet peeve of mine! If you don’t already have a method of identifying inactive profiles, running the following SQL provides a list of profiles that have not been used or created within the last three months.

SELECT user_name,

       date(last_used_timestamp) as last_used,

       timestamp(previous_signon, 0) as last_signon,

       timestamp(creation_timestamp, 0) as create_time,

       status,

       text_description

   FROM QSYS2.USER_INFO

   WHERE (last_used_timestamp IS NULL

             OR last_used_timestamp < CURRENT TIMESTAMP - 3 MONTHS)

         AND (creation_timestamp < CURRENT TIMESTAMP - 3 MONTHS);

I know that some of you are hesitant to delete profiles for fear that you’ll delete profiles that are actually needed. But the key is to look at the right dates. You must be examining the Last used date. If you look at the Previous sign-on date, you’ll miss profiles running batch jobs or making ODBC connections. And don’t worry about orphaning objects: IBM i won’t delete a profile if it owns objects. Perhaps you’re uncomfortable deleting profiles that have only been out of use for three months. Fine, change the timeframe, but please don’t leave inactive profiles on your system!

Old Objects in Libraries

I’ve heard the QGPL library being nicknamed Q Garbage Pail Library. Because it ships as *PUBLIC *CHANGE, it is a known library where objects can be created, and they often are. But how often are these objects cleaned up? Rarely. I’ve seen files in QGPL from queries that contain very sensitive data, are publicly available, and are literally years old. Here’s the SQL that looks for all objects in QGPL that haven’t been used for the last year.

SELECT *

   FROM TABLE (

           qsys2.object_statistics('QGPL', '*ALL')

       )

   WHERE last_used_timestamp < CURRENT TIMESTAMP - 1 YEAR;

Obviously, this IBM i service isn’t limited to QGPL. You can (and should) use this service to look for old objects in other libraries, especially user libraries. Why? One example is developers: They will often make a copy of production data to either test a fix or to make a copy of the database file prior to adding a column. These copies are rarely secured the way the production version is secured. The result is production data widely available via user libraries. I’m sure you can think of other examples.

Old Objects in the IFS

The IFS is probably an even larger repository of old data. And just like you can find old objects in a library, you can also discover old objects in a directory. (Thank you, Scott Forstie and your IBM team, for making this so easy!)

SELECT path_name,

       object_type,

       create_timestamp,

       last_used_timestamp,

       object_owner

   FROM TABLE (

           qsys2.ifs_object_statistics(start_path_name => '/tmp', subtree_directories => 'YES', OBJECT_TYPE_LIST => '*ALLSTMF')

       )

   WHERE last_used_timestamp < CURRENT TIMESTAMP - 6 MONTHS

order by path_name;

Obviously, this example is for the ‘/tmp’ directory so you’ll want to modify it and run this against the directories on your system. I wouldn’t change it to ‘/’ (root) unless you want this to run for quite awhile! I’d rather run it against a subdirectory so I get a more manageable list of objects.

Other Old Stuff

Inactive profiles and old objects aren’t the only things that need to be examined and removed from your system. Take a look at the products you have installed. Over the years, I’ve found clients with products they had once implemented but no longer use. Why is this an issue? Think of the log4j exposure we experienced a couple of years ago. All vendors with log4j exposures notified their clients so their products could be upgraded to a version with the exposure removed. What if you’re no longer in the vendor database but their product remains on your system? Your system may have serious security exposures and you won’t know it. Another scenario I’ve seen are old copies of vendor products currently in use. This often occurs because you make a copy of the product before upgrading it. I understand this practice. But what I don’t understand is not cleaning up (that is, deleting) the old version once you’re satisfied that the upgrade was successful. Why is leaving these old versions around a problem? Increasingly, vendors are providing more security services or ways to restrict access to their product or shipping their product’s objects with more restrictive permissions. By leaving the old versions around, users may be able to access the older, less secure version, circumventing the new restrictions.

Summary

It should go without saying that you’ll want to back up your system before you start this housekeeping project! But once you’ve done that, I hope that you’ll start the new year with a cleaner (and more secure) system.

More examples of using SQL to manage your IBM i security can be found in my book Mastering IBM i Security. Click here to order.

Carol Woodbury

 

Carol Woodbury is IBM i Security SME and Senior Advisor to Kisco Systems, a firm focused on providing IBM i security solutions. Carol has over 30 years’ experience with IBM i security, starting her career as Security Team Leader and Chief Engineering Manager for iSeries Security at IBM in Rochester, MN. Since leaving IBM, she has co-founded two companies: SkyView Partners and DXR Security. Her practical experience and her intimate knowledge of the system combine for a unique viewpoint and experience level that cannot be matched.

Carol is known worldwide as an author and award-winning speaker on security technology, specializing in IBM i security topics. She has written seven books on IBM i security, including her two current books, IBM i Security Administration and Compliance, 3rd Edition and Mastering IBM i Security, A Modern, Step-by-Step Approach. Carol has been named an IBM Champion since 2018 and holds her CISSP and CRISC security certifications.


MC Press books written by Carol Woodbury available now on the MC Press Bookstore.

IBM i Security Administration and Compliance: Third Edition
Don't miss the newest edition by the industry’s #1 IBM i security expert.
List Price $71.95

Now On Sale

Mastering IBM i Security Mastering IBM i Security
Get the must-have guide by the industry’s #1 security authority.
List Price $49.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: