23
Mon, Dec
3 New Articles

What's the Difference Between a Profile Swap and Adopted Authority?

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

Carol discusses the differences between these two methods of elevating authority on the IBM i.

 

Many organizations have the requirement to reduce the number of profiles to which special authorities—especially *ALLOBJ specially authority—have been assigned. In many cases, the excess capabilities can simply be removed because they aren't required for the person to perform their job functions. *SAVSYS special authority is a good example. Unless the person is performing system saves—i.e., is in the role of system operator or system administrator—the user does not need *SAVSYS assigned to their profile.

 

However, there may be cases when some users occasionally need a special authority to perform their tasks. In this case, you'll want to use a method that provides the user the special authority they need but not permanently assign it to their user profile. IBM i provides two methods to accomplish this: profile swap and adopted authority. I've written about adopted authority previously but haven't contrasted that method with swapping to another profile. Since many vendors provide tools to assist with privilege escalation and most provide the ability to either adopt or swap, I thought it might be helpful to explain the differences. First, let me explain how each method accomplishes the elevation of privileges.

 

Adopted authority is configured through a program's User profile (USRPRF) attribute. When the program is called, the adopted authority is in effect for as long as it's in the call stack. The authority the user gains while the program is in the stack is the program owner's authority, including any special authorities the program owner has. Therefore, for as long as the program is in the stack, IBM i will check the caller of the program as well as the owner of the program for sufficient authority to access objects or perform tasks.

 

A profile swap is performed by calling an API. When a profile swap occurs, the current user for the job is changed to be the profile you've swapped to. Now, when IBM i checks authority, it's no longer the original user's authority that's checked; it's the authority of the profile that's been swapped to. The profile's special authorities, groups, limited capability, and audit settings are all swapped in and become the new settings for the job where the profile swap API was invoked.

 

To sum it up, adopted authority provides you with the opportunity to use the authority of program owners to perform tasks or gain access to objects. Swapping to a profile changes the job to run as the profile being swapped to. Both allow the user who originally started the job to have more authorities than what's assigned to their profiles. Now let's see where they're different.

 

Current User

When calling a program that adopts, the profile that calls the program remains as the current user of the job. Not so with a profile swap. When the profile swap API is run, the current user changes to be the profile swapped to. This has implications when managing this job. It's important to understand that there are two profiles associated with a job: the job user and the current user. The job user is the profile under which the job originally started. The current user is the user under which the job is currently running. The job user will never change. Even after a profile swap, the job user will stay the original user. A good example would be the pre-started jobs used for ODBC. Those jobs start running as QUSER and, when identifying that job, QUSER will always remain as that middle component of the job name—for example, 078348/QUSER/QZDASOINIT. However, the current user of the job is always the profile that made the ODBC connection. There's nothing "wrong" or "bad" about this; it's just something to be aware of. You may remember that the User field on the Work with Active Jobs display was changed several releases ago to display the Current user rather than the Job user. This was done to help eliminate confusion over which user was running the job.

 

The other affected area is the audit journal. When elevating by calling a program that adopts, the User profile field in the audit journal entry will contain the user doing the work—that is, the Current user. In the case of a profile swap, there can be some confusion. In this case, the User profile field will contain the name of the swapped-to profile. This won't cause confusion except when all users swap to the same profile (which I've seen happen in many organizations.) In this case, the User profile field in all of the audit entries created after the profile swap contains the same name. If you are examining the audit journal and are trying to determine the person who actually did the work, you'll have to refer back to the job user field, which is called the User name. (The names of the audit entry profile fields are confusing, I know. The way I tell them apart is to look at the fields that surround them. You can tell the job user field because it's right after the Name of job field and right before the Job number field in the audit journal entry. The User profile field, that is, the Current user, comes several fields later.) To avoid the confusion of trying to tell which user did the work, I recommend that a separate profile be created so that individuals swap to a profile with elevated privileges that's easily identified with their profile prior to the swap. For example, CJW is the name of my profile with no privileges, and I swap to a profile called POWERCJW.

 

Submitted Jobs

I've said that adopted authority is in effect for as long as the program is in the call stack. That presents problems when you're submitting a job and you want the new job to run with the adopted authority. When a job is submitted, it's a brand-new job and a new call stack. Therefore, when you submit a job, the program that provided the adopted authority is out of the call stack and the adopted authority is gone. If you want the new job to elevate using adopted authority, then you'll have to re-establish the adopted authority—that is, call a program that adopts in the new (submitted) job.

 

When you submit a job after doing a profile swap, the new job runs as the swapped-to profile. In other words, the elevated privilege is still in effect in the new job.

 

Accessing Objects in the IFS

The IFS has some quirks to be sure, and one of them is that when accessing an object in the IFS, the operating system ignores adopted authority when checking a user's authority to an object. If you want to access an object in the IFS with elevated privileges, you must use the profile swap method.

 

Owned Objects

When calling a program that adopts, any objects that the user creates will be owned by that user. When using profile swap, anything created after swapping will be owned by the swapped-to profile. Challenges may arise if the job swaps back to the original user and that user needs to access the objects created by the swapped-to profile but doesn't have sufficient authority to access the object. Spooled files are a good example. If a spooled file is generated while the job is swapped and the job swaps back to the original user, the original user won't have authority to view the spooled file.

 

Final Thoughts

How do you decide whether to use adopted authority or profile swap? Sometimes it comes down to personal preference. I happen to prefer adopted authority because there's never any question in the audit entries about who performed a task. But some IBM i functions ignore adopted authority, such as accessing the IFS or creating a user profile and specifying group profiles. In this case, there's no choice but to use profile swap. My only concern with profile swap is when organizations choose to have multiple people swap to the same profile. To me, this can cause confusion when looking at audit journal entries. I'm also concerned when organizations always swap to a very powerful profile such as QSECOFR. Like all other approaches to security, you should swap to a profile with only the authorities required to perform the task. Performing a profile swap does not require that you swap to an all-powerful profile, just a profile with the authorities needed to perform the job function.

 

I hope this article has provided you with some insights on adopted authority and profile swap so that you can more easily determine which approach to take when elevating privileges.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • 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.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • 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

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • 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: