21
Sat, Dec
3 New Articles

Dynamic Change of Group Profile

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

Brief: Group profiles can reduce the amount of authorization assignments you need to manage. But, OS/400 only supports one group profile assignment per user. When a user needs to run a job under a different group profile, several steps are required including signing off. Now, with the command presented in this article, you can change the group profile for a job in one step-without compromising system security.

Many AS/400 installations use group profiles to simplify security management. User authorization can be assigned once for the group profile rather than repeating the authorization for each member of the group. Group profiles address many security management issues, but I frequently encounter one issue that cannot be solved with standard methods. In the business world, users often belong to different groups for different tasks. For example, in a small company, some people in the Order Entry department may also be responsible for Accounts Payable. Software packages sometimes require that users belong to a specific group profile regardless of their other functions.

AS/400 security restricts a user profile to a single group profile and it does not allow a group profile to be a member of another group. The technique most often used to get around this limitation involves assigning each person multiple user profiles with different group profiles. Unfortunately, this solution forces the user to sign on multiple times-once for each job function.

In an alternative method, you dynamically change the user's group profile for specific tasks, as this article explains. This technique eliminates the requirement for any user to have more than one user profile. Chances are good that it will improve your overall security since users are given additional authority only for the specific tasks that require that authority.

Group Profiles

As you create individual user profiles, you assign them membership in a group by naming a group profile in the GRPPRF parameter. For example, the command used to create user profile GLOOP as a member of group profile GRP1 is:

 CRTUSRPRF USRPRF(GLOOP) + PASSWORD(--) GRPPRF(GRP1) + OWNER(*GRPPRF) 

If user GLOOP needs to be associated with a second group profile-GRP2, for instance-the security officer could write a program that adopts the required authority and changes the group profile:

 PGM CHGUSRPRF USRPRF(GLOOP) + GRPPRF(GRP2) ENDPGM 

You might expect that a user could sign on with group profile GRP1 and then run this program to change to the second group, GRP2. This will not work because the currently active job for the user does not reflect the change. OS/400 establishes group profiles at sign-on, and changing the group profile for a user profile does not take effect until a new job starts. A user could change his group profile, sign off and sign on again each time he needs to change group profiles, but this is not an improvement over assigning multiple profiles to the same person.

To solve this problem, I wrote the Set Group Profile (SETGRPPRF) command shown in 1. This utility eliminates the need to sign on and off to change group profiles. The utility takes advantage of the security application program interfaces (APIs). The intended use of these APIs is to allow a server job to handle several users by dynamically changing the user profile associated with a job. The same APIs can also be used to dynamically change the group profile for a job without changing the user profile for the job. Program GRP004CL (2) includes a call to the APIs after the group profile has been changed. The APIs change the active group profile for the job.

To solve this problem, I wrote the Set Group Profile (SETGRPPRF) command shown in Figure 1. This utility eliminates the need to sign on and off to change group profiles. The utility takes advantage of the security application program interfaces (APIs). The intended use of these APIs is to allow a server job to handle several users by dynamically changing the user profile associated with a job. The same APIs can also be used to dynamically change the group profile for a job without changing the user profile for the job. Program GRP004CL (Figure 2) includes a call to the APIs after the group profile has been changed. The APIs change the active group profile for the job.

Those of you who are careful about security may be concerned that a user could use this program that adopts *ALLOBJ and *SEC-ADM access to use any group profile. This program poses no threat to security because the AS/400 doesn't allow use of a group profile unless the user has *OBJMGT and *CHANGE access to the profile. Adopted authority is ignored during the authority check to see if the user is authorized to the group profile. This allows the security officer to control the group profiles a user can activate. The following command grants user ELLEN the required authority to swap to the GRPSALES group profile.

 GRTOBJAUT OBJ(GRPSALES) + OBJTYPE(*USRPRF) + USER(ELLEN) AUT(*OBJOPR + *OBJMGT *READ *DLT *ADD *UPD) 

After this command executes, ELLEN can run SETGRPPRF to switch to the GRPSALES group profile; but she cannot select any other group profile. Group profile swapping is fast and requires less overhead than a sign-off and sign-on.

Group Jobs

The SETGRPPRF command is particularly useful in conjunction with group jobs. Group jobs allow a user to have up to 16 sessions from a single workstation. The Attention key is frequently used to display a menu of group jobs and to allow the user to switch between jobs. One potential use of group jobs and the dynmamic change of group profiles is to start a different group job for each different application that requires a unique group profile. When a group job is started, SETGRPPRF can set the appropriate group profile for the requested application. The user can press the Attention key to switch between group jobs, and each group job can have a different group profile. The group profile only needs to be set once when the group job is started.

Limitation with Batch Jobs

Any batch jobs that you submit after switching group profiles will be started using the group profile specified in the user profile at the time the batch job starts. The batch job may require a different group profile, so you must include a dynamic change of the group profile in the batch job or submit the batch job to run under a different user profile that has the correct group profile.

How the Utility Works

Now that you're sold on the usefulness of the SETGRPPRF utility (or even if you want a little more background before you decide to implement it), you're probably interested in the mechanics behind the operation. The standard error- handler code monitors messages and forwards them to the caller. The key logic for this program is highlighted to distinguish it from the error-handling code.

The program must adopt the authority of a user who has *ALLOBJ and *SECADM special authority. This access is required to change the user profile and to get a profile handle without providing a password. (A handle is a temporary value used to pass the identification of an object between two APIs).

The GRP004CL program changes the user profile to the new group profile, but has the side effect of revoking access to the original group profile. The program then grants the authority revoked by the CHGUSRPRF, so the user can switch back to his original group profile.

The Get Profile Handle (QSYGETPH) API gets the required profile handle needed to swap profiles. The *NOPWD option requires that the user have *ALLOBJ and *SECADM special authority.

The Set Profile (QWTSETP) API changes the job to run under the new group profile. The user profile is changed back to the original group, but the active group profile for the job will be the new group profile.

When the group profile for a user is changed back to the original group profile, there is a side effect of revoking access to the new group profile. The program then grants the authority revoked by the CHGUSRPRF, so the user can swap to the new group profile in the future.

The Net Results

The Set Group Profile utility can change the group profile for a job and eliminate the need for users to have multiple user profiles. This utility can also be used to select the appropriate profile based on the application the user intends to run, which improves usability and reduces the number of user profiles on the system.

Wayne O. Evans is an AS/400 security consultant and a frequent speaker on security topics. During his 27 years with IBM Corporation, he was involved with AS/400 security design issues.


Dynamic Change of Group Profile

Figure 1 Command SETGRPPRF

 /*===============================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/SETGRPPRF) PGM(XXX/GRP004CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*===============================================================*/ SETGRPPRF: CMD PROMPT('Set Group Profile') PARM KWD(GRPPRF) TYPE(*NAME) LEN(10) MIN(1) + PROMPT('Group profile') 
Dynamic Change of Group Profile

Figure 2 CL Program GRP004CL

 /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/GRP004CL) SRCFILE(XXX/QCLSRC) + */ /* USRPRF(*OWNER) */ /* */ /*==================================================================*/ GRP004CL: + PGM PARM(&NEWGRP) DCL VAR(&NEWGRP) TYPE(*CHAR) LEN(10) DCL VAR(&OLDGRP) TYPE(*CHAR) LEN(10) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&HANDLE) TYPE(*CHAR) LEN(12) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&PASSWORD) TYPE(*CHAR) LEN(10) VALUE(*NOPWD) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(50) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&RTNTYPE) TYPE(*CHAR) LEN(2) DCL VAR(&ERROR) TYPE(*LGL) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) RTVUSRPRF RTNUSRPRF(&USER) GRPPRF(&OLDGRP) CHGUSRPRF USRPRF(&USER) GRPPRF(&NEWGRP) GRTOBJAUT OBJ(QSYS/&OLDGRP) OBJTYPE(*USRPRF) USER(&USER) + AUT(*OBJOPR *OBJMGT *READ *DLT *ADD) CALL PGM(QSYGETPH) PARM(&USER &PASSWORD &HANDLE) CALL PGM(QWTSETP) PARM(&HANDLE) CHGUSRPRF USRPRF(&USER) GRPPRF(&OLDGRP) GRTOBJAUT OBJ(QSYS/&NEWGRP) OBJTYPE(*USRPRF) USER(&USER) + AUT(*OBJOPR *OBJMGT *READ *DLT *ADD) GOTO CMDLBL(ENDPGM) ERROR: + IF COND(&ERROR) THEN(GOTO CMDLBL(ENDPGM)) CHGVAR VAR(&ERROR) VALUE('1') RECEIVE: + RCVMSG MSGTYPE(*ANY) MSGID(&MSGID) RTNTYPE(&RTNTYPE) MSGF(&MSGF) + MSGFLIB(&MSGFLIB) IF COND(&RTNTYPE *NE '15') THEN(DO) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*DIAG) GOTO CMDLBL(RECEIVE) ENDDO SNDPGMMSG MSGID(&MSGID) MSGF(&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*ESCAPE) ENDPGM: + ENDPGM 
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: