Protection from Adventurous FTP Users
Question: I am the sole AS/400 manager at a small company (75 employees). Currently, our shop is using V3R2 at security level 20. This has worked fine for us since all users (with the exception of a handful of managers) are menu secured. We have just set up FTP with a couple of clients, which could create problems if our users are not careful or if they decide to become adventurous. They are supposed to access only send and receive files in one mailbox library. However, because of our setup, they could conceivably mess up files in our production libraries if they try to change directories.
I’d like to upgrade to security level 30, but I’m “AS/400 security challenged,” so I’ve been doing a lot of research. (Thank goodness for Midrange Computing’s ResourceCD/400! Your March 1994 article, “A Guide to Changing QSECURITY,” on upgrading from level 20 to 30 is becoming very dog-eared.) I’ve read several other articles, as well as the IBM manuals, and I think I have a plan. I’d like to run it by you and ask some questions.
In your August 1993 article, “Security Design for Performance,” you recommend assigning authority at the library level. This makes a lot of sense to me, as we have only a few production libraries. Here’s my plan:
1. Set *PUBLIC authority on our production libraries to *ALL, and set all of the FTP user IDs to *EXCLUDE for these libraries.
2. Set authority on the individual files in the mailbox library to their specific FTP user ID (i.e., *ALL for *PUBLIC, *EXCLUDE for other FTP IDs).
Given this plan, I have some questions: What about other libraries, including IBM’s? Should these be secured also? In looking at our system, a lot of objects (most of which were created before I got here) do not have *ALL public authority. Am I correct in assuming that they would need to be changed to *ALL before this plan can be implemented?
Answer: First, let me thank you for a very complete description of your environment and planned approach. This helps me to provide a better answer. There are several points in your note, and I will respond to each of them.
Your approach consists of the following four items. My comments are listed below each item.
1. Move from security level 20 to security level 30. I agree with your strategy of moving to a higher level of security than level 20. The article you mentioned (“A Guide to Changing QSECURITY”) gives the step-by-step approach to achieve this. However, I would encourage you to move to security level 40 rather than 30. Security level 40 offers better protection, and the effort to move to level 40 is about the same as moving to level 30.
2. Use menu security for existing users to limit their access. Menu-level security does not provide adequate protection from users who have a PC, nor does it restrict FTP users. If PC users attach to the AS/400 using Client Access/400 or most of the other third- party PC attachment packages, they have options to download and upload files that are not restricted by menu security.
Since menu security works well, there may not be a strong motivation to move to resource security. I recommend that, before you attach the FTP client, you implement a more robust security approach similar to application-only access that I described in the January and February 1996 issues of MC. (See “Application-only Access: Implementing the Strategy” and “Application-only Access: Security Exposures Revealed.”) Too often, if we say, “We’ll worry about that later,” nothing gets done until something terrible happens, like a file or library is deleted. I recommend that you protect your information before you attach FTP users. Implementing application-only access can take significant time and planning, so, if schedule pressures require you to implement the FTP access first, you should definitely include plans to get to application-only access.
3. Implement library-level security to limit access of FTP users to a specific mailbox library. For libraries other than a mailbox library, use *PUBLIC *ALL for libraries and *EXCLUDE for FTP users. Library-level security is an easy way to limit access to specific users, which will protect all objects in the library. Users who have access to the library will have access to the objects in the library. However, object-level security can be added to selected objects without changing the basic library security strategy.
The *ALL authority would allow users to delete production libraries, which is probably not what you intended. A public authority of *CHANGE would allow users to add objects to the library but not delete the library. If users do not add objects to production libraries (for example, program libraries), then a public authority of *USE allows access to the objects in the library but prevents adding additional objects.
You did not explicitly state that *PUBLIC authority will be used for the objects in the library, but *ALL authority at the object level would allow users authorized to the library the authority to delete production objects. I recommend that *PUBLIC have only *CHANGE authority; this will prevent accidental deletion of objects.
Rather than list the individual users as *EXCLUDE on the library object, create a group profile for the FTP users; I will call this profile GRPFTP. Excluding the group profile rather than individual users has the advantage that, should you need to create another FTP user, you will need to add only the user to the GRPFTP profile rather than add the user to every library on your system. In giving the GRPFTP a private authority of *EXCLUDE to individual libraries, using the Primary Group Profile (PGP) has a performance advantage that I mentioned in the September 1998 “Security Patrol” column.
4. For the files in the mailbox library use *PUBLIC *ALL and *EXCLUDE for FTP users. Individual FTP users will be given *ALL authority to their data. Again, my comments about giving *PUBLIC *ALL authority applies to the mailbox library, and I recommend an authority of *CHANGE or *USE rather than *ALL.
If you want to limit the FTP users to accessing only their specific files, I recommend giving individuals *USE or *CHANGE access to allow FTP operations, but giving the group profile GRPFTP *EXCLUDE authority. Again, the GRPFTP profile can use the PGP field for the individual objects, giving it a performance advantage. The AS/400 checks the individual user authority before considering the group access, so users
will be allowed to access their individual mailbox libraries even though they are members of the GRPFTP that has *EXCLUDE access to all of the mailbox libraries. Users will not be able to access other users’ mailboxes.
You will need to protect other libraries, including the IBM libraries, from FTP users. FTP users will require *USE access to all of the libraries on the system and the user portion of the library list. These users should be prevented from accessing other libraries, such as QRPG, by giving the group profile GRPFTP *EXCLUDE access.
Think Like a Devious User
When you design a security strategy, you need to think like a devious user. For example, you need to consider what could happen if one of the existing menu users attempts to access the system using FTP. Because FTP allows users the access to delete files, I do not recommend a *PUBLIC access of *ALL on production files.
The strategy that has been discussed to this point would allow that menu user unrestricted access from FTP. If your PC users are attached using TCP/IP, then they could initiate an FTP session to your AS/400. If you want to limit FTP to selected users only, I recommend implementing a program similar to the program shown in Figure 1. This program limits the users who can run FTP to those who are in the GRPFTP group. The details of the FTP sign-on exit program can be found in the TCP/IP Configuration and Reference. Don’t forget to compile the CL program with RTVCLSRC *NO and exclude users from the source of this exit program itself.
TCP/IP Configuration and Reference (SC41-5420-00,CD-ROM QB3ANL00)
/*FTPLOGON Limit FTP sign-on to users that */
/* are members of group profile GRPFTP */
/* To compile: */
/* CRTCLPGM PGM(XXX/FTPLOGON) SRCFILE(XXX/QCLSRC) + */
/* USRPRF(*OWNER) AUT(*EXCLUDE) */
/* 1. Compile program */
/* 2. Change owner of the program to user QSECOFR. */
/* Adopted authority allows the program to */
/* retrieve the user profile */
/* CHGOBJOWN OBJ(XXX/FTPLOGON) OBJTYPE(*PGM) + */
/* NEWOWN(QSECOFR) */
/* 3. Name the exit program in registration facility */
/* ADDEXITPGM EXITPNT(QIBM_QTMF_SVR_LOGON ) + */
/* FORMAT(TCPL0100) PGMNBR(1)+ */
/* PGM(XXX/FTPLOGON) REPLACE(*NO) + */
/* TEXT('Limit FTP to GRPFTP users') */
/* Additional notes: */
/* 1. When the FTP server logon exit is called, the FTP */
/* server job is running under the QTCP user profile. */
/* 2. IBM strongly recommends that you create the exit */
/* program in a library with *PUBLIC authority set to */
/* *EXCLUDE, and give the exit program itself a *PUBLIC */
/* authority of *EXCLUDE. */
/* The FTP server adopts authority when it is necessary */
/* to resolve and call the exit program. */
FTPSIGNON:PGM PARM(&APPIDIN &USRIN &USRLENIN &AUTIN &AUTLENIN +
&IPADDRIN &IPLENIN &RETCDOUT &USRPRFOUT &PASSWDOUT +
/* Declare input parameters */
DCL &APPIDIN TYPE(*CHAR) LEN(4) /* Application identifier */
DCL &USRIN TYPE(*CHAR) LEN(999)/* User ID */
DCL &USRLENIN TYPE(*CHAR) LEN(4) /* Length of user ID */
DCL &AUTIN TYPE(*CHAR) LEN(999)/* Authentication string */
DCL &AUTLENIN TYPE(*CHAR) LEN(4) /* Length of auth. string */
DCL &IPADDRIN TYPE(*CHAR) LEN(15) /* Client IP address */
DCL &IPLENIN TYPE(*CHAR) LEN(4) /* IP address length */
DCL &RETCDOUT TYPE(*CHAR) LEN(4) /* return code (out) */
DCL &USRPRFOUT TYPE(*CHAR) LEN(10) /* user profile (out) */
DCL &PASSWDOUT TYPE(*CHAR) LEN(10) /* password (out) */
DCL &CURLIBOUT TYPE(*CHAR) LEN(10) /* current library (out) */
/* Declare local copies of parameters (in format usable by CL) */
DCL VAR(&USRLEN) TYPE(*DEC) LEN(5 0)
/* Declare local variables */
DCL VAR(&USRPRF) TYPE(*CHAR) LEN(10)
DCL VAR(&GRPPRF) TYPE(*CHAR) LEN(10)
/* Assign input parameters to local copies */
CHGVAR VAR(&USRLEN) VALUE(%BINARY(&USRLENIN))
/* Check for USER is a member of GRPFTP if not prevent logon */
CHGVAR VAR(&USRPRF) VALUE(%SST(&USRIN 1 &USRLEN))
RTVUSRPRF USRPRF(&USRPRF) GRPPRF(&GRPPRF)
IF COND(&GRPPRF = 'GRPFTP') THEN(CHGVAR +
ELSE CMD(CHGVAR VAR(%BINARY(&RETCDOUT)) VALUE(0))
Figure 1: Program to limit FTP to selected users