PAM RADIUS Authentication for Non-Local Accounts
Skyhigh Secure Web Gateway installations rely on the PAM RADIUS module to authenticate SSH users against a central RADIUS server. The system executes an authentication sequence that compares incoming user information across two distinct directory databases:
- Local Linux User Accounts
- RADIUS Directory Lookups
Any user attempting to log in must satisfy their presence in both databases simultaneously. Consequently, an enterprise user (for example, SAM) who does not possess a local Linux account on the target system cannot complete the login process.
The Linux operating system enforces this restriction due to the operational order of services defined in the /etc/nsswitch.conf file, which prioritizes local username checks before processing any subsequent PAM modules.
Current Authentication Problem Sequence:
- User SAM attempts to initiate an SSH login to Skyhigh Secure Web Gateway using valid RADIUS directory credentials.
- The local system detects that SAM lacks a local Linux user account.
- The lookup confirms that SAM has a valid and working account within the external RADIUS directory.
- The authentication attempt for SAM fails because no matching user ID exists within the local host operating system.
Non-Local Authentication via libswgpam-nss
Important: This non-local authentication feature is exclusively supported starting with Skyhigh Secure Web Gateway version 12.2.24 and later.
To eliminate legacy local user account creation workarounds, version 12.2.24 introduces direct support for authenticating non-local user accounts via the libswgpam-nss library. This integration allows external RADIUS users to authenticate seamlessly while dynamically generating the required environment mapping configurations.
Deploy the Configuration Modules
To deploy the configuration modules, perform the following steps:
- Log on to the target Web Gateway appliance with administrative privileges.
- Run the package manager command to install the library module:
Bash
yum install libswgpam-nss -
Edit the
/etc/nsswitch.confsystem file and addswgpamdirectly to the end of the passwd: entry. -
Edit the
/etc/pam.d/sshdconfiguration file and insert account sufficientpam_swgaccount.soas the very first entry of the account block. -
Within the same
/etc/pam.d/sshdfile, modify the RADIUS authentication entry to auth sufficientpam_radius_auth.so(if your distribution has not done so automatically), or explicitly add it. Ensure that this stands as the first active entry within the auth block. -
Open the
/etc/pam_radius_auth.confconfiguration file, retain only your active remote RADIUS server entries, and comment out or remove all other default loopback or placeholder listings. -
Create the master module configuration file at
/etc/swgpam_nss.conf, restrict its access permissions by runningchmod 644 /etc/swgpam_nss.conf, and populate it.You can customize these parameters to align with your organization's system conventions.
Below is the example of sample configuration file:# Specifies the starting UID baseline assigned to incoming non-local users.# Example: If user1, user2, and user3 log in sequentially,# The system automatically issues UIDs 80000, 80001, and 80002.uid_base = 80000# Establishes the maximum number of simultaneous external PAM users allowed.# Setting this value to 1000 bounds the generated UIDs from 80000 to 81000.uid_range = 1000# Assigns the target GID of the group created for your PAM-only accounts.gid = 990# Defines the shared base home directory path for the non-local profiles.home_dir = /home/pamuser# Declares the default command line shell environment for the incoming user.shell = /bin/bash -
Restart the SSH daemon to load your updated configuration:
Bash
systemctl restart sshd
Note: Customers need to ensure that there is no collision with the assigned UIDs on the system, when providing uid_base and uid_range.
Create the Local System Group and Home Directory
Before non-local users initiate connection strings, you must establish the local landing paths and system boundaries on the appliance file system:
- Create the Target Group: Define the system group matching your configuration file GID:
Bash
groupadd -g 990 onlypam - Create the Home Directory Infrastructure: Initialize the path and apply the corresponding ownership parameters:
Bash
mkdir /home/pamuser
chroot root:onlypam /home/pamuser
chmod 2770 /home/pamuser - [Optional] Populate User Environment Profiles: Copy the baseline shell configuration profiles to define standard terminal behaviors for incoming users:
Bash
cp /root/.bashrc /home/pamuser
cp /root/.bash_profile /home/pamuser
chmod 644 /home/pamuser/.bashrc
chmod 644 /home/pamuser/.bash_profile
Extending Generic PAM Capabilities
The underlying pam_swgaccount component operates as a generic PAM module. You can readily leverage its architecture to enforce external authentication across other local system operations by placing the module library directly within the corresponding service definition file located in /etc/pam.d/.
Example Configuration for sudo Command Execution: To configure non-local user accounts to successfully validate privileges when running unprivileged sudo commands, insert the identical validation entries into the sudo configuration stack:
- Open and edit the
/etc/pam.d/sudosystem file. - Add account
sufficient pam_swgaccount.soas the first active entry of the account block. - Add auth
sufficient pam_radius_auth.soas the first active entry of the auth block.
