22
Fri, Nov
1 New Articles

Validation Lists: Secure iSeries Web Sites Without User Profiles

IBM i (OS/400, i5/OS)
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
Over the last few months, I've been teaching a seminar on CGI Web programming using RPG IV. The seminar has gone well, and I may do more of them in the future.

During the seminars, attendees asked if it was possible to secure a section of a Web site or the entire Web site without creating a unique OS/400 user profile object for each user.

Imagine a Web site with 50,000 or perhaps 50 million Web users. Now, consider that in order to secure a specific location on your Web site, you would have to create an equal number of user profiles on the system to maintain security. This could be a lot of burden on the system. In addition, it would become difficult to maintain unique user profile names because there are only 10 characters available for a user profile name. This is where validation list objects come into play.

A validation list is an OS/400 object that may contain identification data, encrypted data, and descriptive data. A validation list may also be used to secure a folder on the IFS. By creating a validation list, adding "Web user IDs" and passwords to the list, then securing a folder with the validation list, you end up with a new model for user profiles: Web user profiles. The best part is that the user IDs stored in a validation list may be up to 100 bytes long, and their passwords may be up to 600 bytes long (encrypted). Additionally, you may store up to 1,000 bytes of miscellaneous data for each validation list entry. That's enough space to save all the information for most Web users.

Because validation lists are OS/400 objects, they are restricted to 10-character names and are placed in a library. You can use the Create Validation List (CRTVLDL) command to create the validation list and the Delete Validation List (DLTVLDL) command to delete the validation list. The bad news is that there are no validation list commands other than Create and Delete. There are only APIs.

Validation List APIs

Actually, there are two sets of validation list APIs. There are the traditional QSYADVLE-style APIs with eight-character names that can be called from any programming language (including RPG III), and there are the QsyAddValidationLstEntry-style APIs that may be called only from ILE languages, such as C, C++, and RPG IV.

The table below shows both types.

Function
Any Language
ILE Languages
Add Validation List Entry
QSYADVLE
QsyAddValidationLstEntry
Change Validation List Entry
QSYCHVLE
QsyChangeValidationLstEntry
Find Validation List Entry
QSYFDVLE
QsyFindValidationLstEntry
Open Validation List
QSYOLVLE

Get List Entries From Handle
QGYGTLE

Find List Entries From Handle
QGYFNDE

Close Validation List
QGYCLST

Find First Validation List Entry

QsyFindFirstValidationLstEntry
Find Next Validation List Entry

QsyFindNextValidationLstEntry
Find Validation List Entry

QsyFindValidationLstEntry
Find Validation List Entry Attributes

QsyFindValidationLstEntryAttrs
Remove Validation List Entry
QSYRMVLE
QsyRemoveValidationLstEntry
Verify Validation List Entry

QsyVerifyValidationLstEntry
Add Validation List Certificate
QSYADDVC
QsyAddVldlCertificate
Check Validation List Certificate
QSYCHKVC
QsyCheckVldlCertificate
List Validation List Certificates
QSYLSTVC
QsyListVldlCertificates

The validation list APIs with traditional API names, such as QSYADVLE, are called from RPG IV using the traditional CALL/PARM syntax or with the CALLP and a program prototype. The other APIs, such as QsyAddValidationLstEntry, may be called with a prototype from RPG IV, but they are really designed to be called from C or C++.

Using Validation Lists

While you can get some interesting function out of the validation list APIs, typically you want to do the following:

  • Create a validation list
  • Add entries to a validation list
  • Remove entries from a validation list

Creating a validation list is easy; just issue the CRTVLDL command, specifying the validation list name and its library. Note, the object type is *VLDL.

Adding and removing entries from a validation list requires the use of the APIs. I have written two simple RPG IV procedure wrappers for the QSYADVLE and QSYRMVLE APIs. But rather than post the source code here, in the newsletter, I am featuring only the syntax for the procedures themselves. The source code for these procedures is shown at the end of this article.

Add Validation List Entry (ADDVLDLE)

The ADDVLDLE procedure adds an entry to an existing validation list object. If the validation doesn't exist or there is a duplicate entry, the procedure fails. The syntax for ADDVLDLE is as follows:

int = AddVldle( vldl-name : vldl-library : entry : password [ : extra-data ] )

VLDL-NAME is the name of the validation list object. This parameter is required.

VLDL-LIBRARY is the name of the library that contains the validation list. This parameter is required.

ENTRY specifies the user ID to add to this validation list entry. This parameter is required and is case-sensitive.

PASSWORD specifies the password that the user will need to type. It is stored encrypted in the validation list. This parameter is required and is case-sensitive.

EXTRA-DATA specifies any additional data to store with the user validation list entry. This parameter is optional.

Remove Validation List Entry (RMVVLDLE)

The RMVVLDLE procedure deletes an entry to an existing validation list object if the validation doesn't exist. The syntax for RMVVLDLE is as follows:

int = RmvVldle( vldl-name : vldl-library : entry  )

VLDL-NAME is the name of the validation list object. This parameter is required.

VLDL-LIBRARY is the name of the library that contains the validation list. This parameter is required.

ENTRY specifies the user ID to be removed. This parameter is required and is case-sensitive.

Using a Validation List to Secure Your Web Site

You can secure your Web site with a validation list, OS/400 object-level security, or both. To secure the Web site with a validation list, add the Protection directive to your HTTP configuration file. In that Protection directive, you will specify the validation list name.

Once the Protection directive has been added and the HTTP server is ended and restarted, the IFS directory specified within the context of the Protection statement will be secured. Only those Web users whose user IDs appear in the validation list will be permitted to view and access Web pages in that directory.

In order to gain access, Web users will be required to enter their user ID and password, exactly as it appears in the validation list. Unlike traditional OS/400 user profiles and passwords, validation list user profiles and passwords are case-sensitive. Using the wrong case is perhaps the single biggest typographical error users make when entering these values. Be sure you let your Web users know that user IDs and passwords are case-sensitive.

To activate security using validation lists, specify the validation list name on the PasswdFile statement within the Protection directive of your HTTP configuration file (WRKCFGHTTP). Look at the spelling of this statement; it is "PasswdFile." Strange abbreviations run rampant in the HTTP configuration file world.

In the following example, a validation list named WEBUSERS in the QUSRSYS library is used to secure access to the IFS directory named /mywebsites/rpgiv/files/secure. All files and subdirectories in that folder are also secured by this Protection directive.

Protection MYSECURITY {
            ServerID  RPGIVNETWORK
            Authtype Basic
            PasswdFile QUSRSYS/WEBUSERS
            GroupFile /mywebsites/rpgiv/files/secure
}

With the above Protection directive in place, anyone attempting to access a file in the /mywebsites/rpgiv/files/secure IFS folder will be prompted to enter a user ID and password. The system will then match the information that's entered against the entries in a validation list named WEBUSERS. Note the ServerID statement that is included this Protection directive. The ServerID statement is used to specify information that is displayed when the system prompts the user for a user ID and password. In other words, it informs the end-user of the name of the system they are about to sign on to. This name can be anything and does not need to be a real system name.

Validation List Summary

A validation list and a few lines in the HTTP configuration file can secure your Web site's private pages from prying eyes. Also, you could create a members-only section of your Web site, providing access only to those who have paid a registration fee.

Source Code

Validation List Wrapper RPG IV Source

H NOMAIN BNDDIR('QC2LE')
      **-----------------------------------------
      ** Validation List Helper procedures
      **-----------------------------------------
      ** (c) Copyright 2002 by Robert Cozzi, Jr.
      ** Permission to use granted to the public
      ** provided proper Accreditation is given.
      **-----------------------------------------
      ** System API Includes for Validation Lists
      /copy qsysinc/qrpglesrc,qsyvldl

      ** Validation list Procedure prototypes
      /copy newsletter/qrpglesrc,vldl

     PAddVldle         B                   Export
     D AddVldle        PI
     D VldlName                      10A   Const
     D VldlLib                       10A   Value
     D VldlEntry                    100A   Const Varying
     D VldlPwd                      600A   Const Varying
     D VldlEx                      1000A   Const Varying options(*NOPASS)

     D  Api_Error      S             16A   INZ(*ALLX'00')
     D
     D VldList         S             21A
     D QsyAddVldLstE   PR                  Extpgm('QSYADVLE')
     D  VldLst                             LIKE(VLDList)
     D  EntryInfo                          LIKE(QSYEIDI)
     D  EncryptData                        LIKE(QSYEEDI)
     D  ExtraData                          LIKE(QSYEDI)
     D  Atrribute                          LIKE(QSYAR01)
     D  api_ErrorDS                        LIKE(api_Error)
     C                   if        VldlLib = *BLANKS
     C                   Eval      VldlLib = '*LIBL'
     C                   Endif
     C                   Eval      VldList = VldlName + VldlLib

     C                   Eval      QsyEIDI  = *ALLX'00'
     C                   Eval      QsyEEDI  = *ALLX'00'
     C                   Eval      QsyEDI   = *ALLX'00'
     C                   Eval      QSYAR01  = *ALLX'00'
      ** Validation list Entry
     C                   Eval      QSYEIDL  = %Len(%TrimR(VldlEntry))
     C                   Eval      QSYCCSID03 = 0
     C                   Eval      QSYEID = VldlEntry
      ** Password
     C                   Eval      QSYEDL = %Len(%TrimR(VldlPwd))
     C                   Eval      QSYCCSID04 = -1
     C                   Eval      QSYED = VldlPwd
      ** Additional Data
     C                   If        %Parms >= 5
     C                   Eval      QSYEDL00 = %Len(%TrimR(VldlEx))
     C                   Eval      QSYCCSID05 = 0
     C                   Eval      QSYED00 = VldlEx
     C                   endif
      ** Attributes
     C                   Eval      QSYAR01  = *ALLX'00'
      ** Create the validation list entry
     C                   CallP     QSyAddVldLstE( VldList : Qsyeidi :
     C                               Qsyeedi : QSyEDI : Qsyar01 : api_Error)
     PAddVldle         E


Validation List Procedure Prototypes

** Add Validation List Entry
      ** (c) Copyright 2002 by Robert Cozzi, Jr.
      ** Permission to use granted to the public
      ** provided proper Accreditation is given.
     D AddVldle        PR
     D VldLName                      10A   Const
     D VldLLib                       10A   Value
     D VldLEntry                    100A   Const Varying
     D VldLPwd                      600A   Const Varying
     D VldLExData                  1000A   Const Varying options(*NOPASS)


Validation List Test Program

Note: To compile the test program with PDM option 14, you will need to create a binding directory. Please see the inline comments for compiling instructions.

H DFTACTGRP(*NO) ACTGRP('NEWSLETTER') BNDDIR('VLDL')
      ** To compile use option 14 in PDM after creating a
      ** binding directory, or use the following commands:
      **    1) CRTRPGMOD MODULE(TESTVLDL)
      **    2) CRTPGM    PGM(TESTVLDL) MODULE(TESTVLDL VLDLIST) +
      **                 ACTGRP(QILE)  <-- Any name you want.
      ** -------------------------------------------------

      ** The prototype for the Library list procedure(s).
      /COPY NEWSLETTER/QRPGLESRC,VLDL
     D VldlName        S             20A   Inz('COZZI')
     D VldlLibrary     S             20A   Inz('NEWSLETTER')
     D VldlEntry       S            100A   VARYING
     D VldlPwd         S            600A   VARYING
     C                   Eval      VldlEntry = This email address is being protected from spambots. You need JavaScript enabled to view it.'
     C                   Eval      VldlPwd   = 'rosebud'
     C                   CallP     AddVldlE(VldlName : VldlLibrary :
     C                                VldlEntry : VldlPwd)
     C                   Eval      *INLR = *ON

BOB COZZI

Bob Cozzi is a programmer/consultant, writer/author, and software developer. His popular RPG xTools add-on subprocedure library for RPG IV is fast becoming a standard with RPG developers. His book The Modern RPG Language has been the most widely used RPG programming book for more than a decade. He, along with others, speaks at and produces the highly popular RPG World conference for RPG programmers.


MC Press books written by Robert Cozzi available now on the MC Press Bookstore.

RPG TnT RPG TnT
Get this jam-packed resource of quick, easy-to-implement RPG tips!
List Price $65.00

Now On Sale

The Modern RPG IV Language The Modern RPG IV Language
Cozzi on everything RPG! What more could you want?
List Price $99.95

Now On Sale

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: