PROC-X.com
An online (unofficial) SAS® journal – written by bloggers

Main menu

Skip to content
  • About
  • add your blog
  • Contact us
SAS

Fencing in your SAS users with LOCKDOWN

by Chris hemedinger • February 21, 2014 • Comments Off on Fencing in your SAS users with LOCKDOWN

This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post.

SAS administrators now have another tool to keep SAS users from straying off their permitted path: the LOCKDOWN system option. The option was introduced in “stealth mode” for SAS 9.4. In SAS 9.4M1, it became a true, documented option. For the official guide to creating “locked-down servers”, see the SAS 9.4 Intelligence Platform: Security Administration Guide

LOCKDOWN’s primary purpose is to allow admins to close two perceived holes when supporting SAS programmers:

  1. It shuts down any SAS language feature that provides direct or indirect access to the operating system shell. This includes PROC GROOVY, and the DATA step Java Object and others. You also need to make sure that NOXCMD (shell command integration) and NORLANG (R language integration) are in place, since those avenues would circumvent any SAS-enforced system access.
  2. It allows file access to only those directories that a SAS admin adds to a “whitelist“. This is the key benefit, since it prevents users from assigning arbitrary file-based libraries.

Enabling LOCKDOWN is a two-step process. First, you add the -LOCKDOWN option to the SAS command-line or config file. In a standard deployment, you can add it to the Workspace startup script. I tested this by adding it to my ../Config/Lev1/SASApp/WorkspaceServer/WorkspaceServer_usermods.bat file:

Set USERMODS_OPTIONS=-LOCKDOWN 

Actually, I wanted to test two behaviors: LOCKDOWN versus NOLOCKDOWN. So I added logic to trigger LOCKDOWN only when any non-admin user was connecting to the SAS Workspace:

if %USERNAME%==sascrh(
  Set USERMODS_OPTIONS=
) else (
  Set USERMODS_OPTIONS=-LOCKDOWN 
)

My syntax is for a Windows BAT file. Similar logic applies on UNIX systems, but different syntax.

The second step is to use the LOCKDOWN statement somewhere in the SAS autoexec chain to list the operating system folders that you want the user to be able to access. Again, I need some logic to conditionally set this only when in LOCKDOWN mode. In my test, I modified WorkspaceServer/autoexec_usermods.sas to include:

 %macro lockit;
 %if %sysfunc(getoption(LOCKDOWN)) = LOCKDOWN %then %do;
   /* this adds the user's home directory */
   lockdown path="?FOLDERID_Profile";  
   lockdown list;
 %end;
 %else %PUT "System running under NOLOCKDOWN.";
 %mend;
 options source;
 %lockit;

Note: I could avoid this script-level logic by simply creating another SAS Workspace context in SAS Management Console. I would then group certain users to use the locked-down one instead of the unlocked version. I would using SAS Metadata groups to control visibility/access into the appropriate servers.

If I didn’t add the ?FOLDERID_Profile (Windows only, UNIX uses ‘~’) to the list of allowed paths, my SAS Enterprise Guide users would receive a funny message when connecting to the SAS Workspace. As an inset, I also included the view of the SASApp tree; notice that it has no Files navigation:

That might be what you want. But if it’s not, be sure to either allow the user to access the account’s “home” directory, or else redirect the file navigation root to a usable location.

Tip for extra stealth: In my example, I used LOCKDOWN PATH= to specify the paths in my “whitelist”. As an admin I can obscure that even further by using LOCKDOWN FILE=, and point to an external file (outside of the LOCKDOWN paths) that contains a list of the folders that I want to allow.

In my SAS Workspace log, I can check how the LOCKDOWN settings were reported when logging in as sasdemo, a non-admin user:

NOTE: These pathnames can be accessed when SAS is in the lockdown state:
C:\Program Files\SASHome2\ReportFontsforClients\9.4
C:\Windows\Fonts
C:\Program Files\SASHome2\SASFoundation\9.4
C:\SAS\Config\Lev1\SASApp
C:\Users\sasdemo

All other paths are locked down after the “lockdown point” — when SAS initialization is complete. Thus, if you know that your user needs access to a library or file reference that’s not in your whitelist path, make sure that those resources are allocated during initialization, perhaps in pre-assigned libraries.

So what happens when the user tries to access a path that’s not in the list of allowed paths? Here’s an example of a FILENAME attempt and a LIBNAME attempt:

24         filename out "C:\Projects";
ERROR: The path C:\Projects is invalid because it is not in the 
       list of accessible paths when SAS is in the lockdown 
       state.
ERROR: Error in the FILENAME statement.
25         
26         libname offlimit "u:\Dept\HR\Secret";
ERROR: The path u:\Dept\HR\Secret is invalid because it is not 
       in the list of accessible paths when SAS is in the 
       lockdown state.
ERROR: Error in the LIBNAME statement.

If you decide to use LOCKDOWN in your environment, I recommend that you allocate plenty of time to test — for yourself and for your users. It’s very easy to accidentally exclude a file path that you need to perform work. These might be items that you decide to then add to the whitelist, or else preallocate during the SAS Workspace initialization. Also, some SAS applications are not compatible with LOCKDOWN.

So, are you a SAS admin who admires Mordac, the Preventer of IT Services? It’s okay to say Yes — you’re just doing your job. You can combine LOCKDOWN with Metadata-Bound libraries to really keep those SAS users in check.

tags: LOCKDOWN, metadata-bound libraries, SAS 9.4, sas administration, SAS libraries

This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post.

Tags: LOCKDOWN metadata-bound libraries SAS 9.4 sas administration SAS libraries Uncategorized

Post navigation

← Let’s shed some light on the black box containing Neural Net model weights
Building a SAS Stored Process Log →

Popular Posts

  • SAS – Lowercase (lowcase) / Uppercase (upcase) / Proper Case (propcase)
  • How do I export from SAS to Excel files: Let me count the ways
  • How to Get Row Numbers in SAS Proc SQL (and DO NOT Use the Undocumented MONOTONIC Function)
  • How to convert the datetime character string to SAS datetime value? (ANYDTDTM and MDYAMPM formats)
  • Using SAS Enterprise Guide to run programs in batch
  • Clear the Results viewer in SAS 9.3

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

Sponsors







Dear readers, proc-x is looking for sponsors who would be willing to support the site in exchange for banner ads in the right sidebar of the site. If you are interested, please e-mail me at: tal.galili@gmail.com

Contributors

  • AFHood Group Blog » SAS
  • Avocet Solutions
  • BI Notes
  • Blogging about all things SAS
  • BusinessKen
  • Computing from Out in Left Field
  • Data Steps
  • Enterprise Software Doesn’t Have to Suck
  • Gregor Gorjanc (gg)
  • Heuristic Andrew
  • Jared Prins’ Blog – SAS
  • Ken's SAS tricks
  • Michael @ Scorpio
  • Musings From an Outlier: The SAS Users Blog
  • NOTE: Development With SAS
  • Numbermonger » SAS
  • Peer Revue
  • Peter Flom blog (Statistical Analysis Consulting)
  • platformadmin.com
  • ProcRun;
  • SAS – BioStatMatt
  • SAS – Confounded by Confounding
  • SAS – From a Logical Point of View
  • SAS & Statistics
  • SAS | r4stats.com
  • SAS and R
  • SAS Learning Post
  • SAS Live!
  • Sas on Melinda Higgins, Ph.D
  • SAS Programming for Data Mining
  • SAS support site – SAS Users
  • SAS Users
  • SAS-BI Business Layers
  • SASopedia
  • SASTechies
  • Software & Service
  • Statistical Analysis Consulting
  • StudySAS Blog
  • The SAS Dummy

Recent Posts

  • SAS training: 5 free sessions technologists love
  • Creating a Microsoft Excel report using SAS, Python and SQL!
  • Decode your SAS® macro code with the MFILE and MPRINT options
  • ESM and S9CA: Useful Tools for Migration from SAS 9 to SAS Viya
  • CAS-Action! Advanced Frequency Tables – Part 4
  • CAS-Action! Grouping Frequency Tables – Part 3
  • Using SAS to score a test
  • CAS-Action! Saving Frequency Tables – Part 2
  • CAS-Action! Simple Frequency Tables – Part 1
  • CAS-Action! Rename Columns in a CAS Table
  • Details, details: Updates to The Little SAS Book
  • SAS administrator tip: How to identify and prevent duplicate librefs in SAS metadata
  • Building an Open Source Software Community
  • Unexpected results from missing values with PROC SQL
  • Machine learning models for payment fraud

Copyright © 2022 PROC-X.com. All Rights Reserved. The Magazine Basic Theme by bavotasan.com.