This version features:
Why another pam_nds authentication module ?
Currently there are at least two others PAM authentication modules against NDS available.
NDS attributes supported:
In Unix world, every user is characterized by some properties (stored in /etc/password) including an unique numeric ID (UID), a home directory, a primary group numeric ID (GID) a shell and an optionnal Gecos field (full name...). The most important informations, Unix ID and GID , are used for rights on the file system.
NDS attributes are handy to centrally store these properties and make sure they are unique and always the same regardless of the workstation user is logging in. This is critical if user's home is not local to the Linux workstation but on some remote NFS servers. User's IDs must match those used on the NFS server where the home directory was created.
Unix groups also must have to same IDs all over the workstations for rights consistency.
Note that for testing purpose, you may simply let the pam_ncp module autocreate Unix IDS and GIDS by fetching "free values" from the local database. Your test user will not have the same IDs on several workstations and of course cannot have yet a NFS home. It is the default behaviour with no user's related command line arguments. But when deploying the full solution, you must consider using NDS as the repository of Unix properties.
These attributes are normally editable using the Console One administrative application and will be honored first by the pam module, if found.
| To replace |
Use |
Remark | Example | Applies to |
| "UNIX:UID" |
U:number |
Should be numeric, unique and between 1000 and 65534 | U:30000 | User |
| "UNIX:Primary GroupName" | No equivalent L string | User | ||
|
"UNIX:Primary GroupID" (*) |
P:number |
Should be numeric, unique, between 100 and 65534. | P:100 | User |
| "UNIX:GID" (*) |
G:number |
Should be numeric, unique, between 100 and 65534. | G:100 | User Group |
| "UNIX:Login Shell" |
S:name of shell |
S:/bin/bash | User | |
| "UNIX:Home Directory" |
H:Unix path to home |
With appropriate flags, this directory will be created in the local file system | H:/home/testuser | User |
| "UNIX:Comments" |
C:comment |
Will be appended to the /etc/passwd gecos field, after the NDS property "Full Name" |
C:test user or c:test user |
User |
| No equivalent DS8 attribute |
O:group name |
Other Unix groups names. | O:wheel With appropriate flags, the user will be also added to Unix group wheel when autocreated or a every login | User |
| No equivalent DS8 attribute |
N:group name |
For automatic creation of Unix group,
specify the name to use in Unix, if you want it different of the NDS name. Remember that with Linux, group names cannot start by a number, are limited to 16 characters and cannot contains "exotic characters". The PAM module has an algorithm to "Unixify" NDS group names, but results may not suit your esthetic sense. |
N:users or n:users
Assigned to NDS group everyone, this will autocreate the Unix group users instead of everyone. Since the PAM module checks for existing groups, the result will likely be in that case that NDS group everyone will not be created on the local database since users group generally exists. |
Group |
| No equivalent DS8 attribute |
Z:zenuxflags |
See below | Z:ABT05 | User Group |
Alternatively, you may manually extend your NDS7 schema with the following dummy attributes (using Schemax or ndssnoop) and associate them with either user or group class:
| Name (case sensitive) | Syntax | Association |
| "LINUX:UID" | SYN_INTEGER | User |
| "LINUX:Primary GroupName" | SYN_DIST_NAME | User |
| "LINUX:Primary GroupID" | SYN_INTEGER | User |
| "LINUX:GID" | SYN_INTEGER | User, Group |
| "LINUX:Login Shell" | SYN_CE_STRING | User |
| "LINUX:Home Directory" | SYN_CE_STRING | User |
| "LINUX:Comments" | SYN_CI_STRING | User |
Either way, the authentication module will always try to get *missing* data from the L attribute. NDS8 (real or dummy) attributes are searched first and have priority; that is, if both exists, NDS8 attributes will be used.
Zenux Flags
The concept on Zenux Flags is an attempt to tune newly created Unix account from additional data read from NDS. Currently they are up to 32 Zenux Flags that can be used :26 letters A to Z (either in upper or lower case) and 6 digits from 0 to 5.
Z:ABT activate automounting of Netware home directory, set Broadcast messages mode to All and allow remote access by Telnet/ssh.
Z:05 activate running zenscript0 (at session opening) and zenscript5 (at session closing).
Refer to the following table for signification and caveats about these 32 flags.
Zenux flags can be assigned on a per user basis or inherited from flags assigned to NDS groups. Currently the inheritance mechanism is simple: groups flags are "ored" together and added to any flag that may have been assigned to user. They are no filtering nor masking logic. Although the Zenux Flags are meant to centralize users account tuning on every possible Unix client, it is possible on some clients to turn off all or some Zenux Flags processing (-ZXXX option ) or to turn on some values (-zXXX option).
examples:
| Flag | Long name | Purpose |
| A | Automount Netware home |
Will try to mount the Netware home directory (read from NDS) in a nwhome directory in Unix user s home
or in a local directory under /mnt if user's home is NFS mounted ( see -l option of the pam module).
For optimal result, ncpfs (and your kernel) should have been compiled with the option (CONFIG_NCPFS_MOUNT_SUBDIR) in /usr/src/linux/fs/ncpfs/Config.in This is normally done by default with 2.4 kernels (?). Otherwise we will mount only the volume where the home is located and the user will have to browse to reach his(her) final home directory. |
| B | Broadcast mode All |
These flags will set the broadcast level of the permanent connection used to automount Netware user's home. They have no effect if Netware home is not mounted by pam_ncp Recognized by the PAM module but not yet honored since spawned ncpmount does not yet accept the -B broadcast setting for permanent connections.(TODO Petr ;-)) |
| C | Broadcast mode Console |
Recognized by the PAM module but not yet honored
since spawned ncpmount does not yet accept the -B broadcast setting for permanent connections.(TODO Petr ;-)) Default broadcast mode is bcast_none (reject any broadcast) |
| D | Reserved for future extension | |
| E | Reserved for future extension | |
| F | Allow Ftp access | If this flag is on, the user may remotely access the Unix client using FTP. Of course, any local restrictions (firewall,ftp.deny,hosts;deny...) will also be enforced. |
| G | Reserved for future extension | |
| H | Allow Rsh access | If this flag is on, the user may remotely access the Unix client using rsh. Please note that this flag is currently untested. I still don't know how to setup and use rsh;-) |
| I | Create ~/.nwinfos file | This file contains in a suitable format all data read from the NDS for the current user, except his password. It will be "sourced " by the six zenscripts to help personalization. This flag is automatically turned on by the PAM module if any of the six numeric flags (0..5) are on. |
| J | Reserved for future extension | |
| K | Reserved for future extension | |
| L | Reserved for future extension | |
| M | Forward Mail | If on, and if the PAM module has got Email information from NDS, it will create a .forward file in Unix users home with the appropriate value. So mails sent to user or user@localhost will be automatically forwarded by sendmail to the correct address. You should be aware that they are two formats for Email addresses in NDS. The "old format", named Foreign Email Address and the new format "Internet Email address" that has been added with the LDAP V2 support. To edit the "Internet Email Address" you hae to use the NWAdmin snapin added with LDAP V2, and for the "Foreign EMail Adress", yo uhave to use either uimport or my specific snapin The PAM module will give priority to the new format. If both entries are found, the new Internet Email address value will be used. |
| N | Create ~/.nwclient file | Most of the ncpfs utilities use a file named .nwclient in current Unix user home to get a server name, an user name and eventually a password. With this flag on, this file will be autocreated at every login. As required by ncpfs utilities, this file will get 600 permissions. |
| O | Overwrite ~/.nwclient file | Normal behavior of the N flag ( Create Nwclient file) is to append the line (server/user passwd) at the end of the file. With this flag on, you overwrite the .nwclient client file at every login. The created file is in the appropriate format for current release of ncpfs, so that flag should be on. |
| P | Password in ~/.nwclient file | If this flag is on, the PAM module will also write the user's Netware password in plain text in the .nwclient file. Despite the 600 permissions, you may not like to have clear Netware password lying in every users home. Just leave this flag off and ncpfs utilities will prompt user for password when needed. |
| Q | Reserved for future extension | |
| R | Allow Rlogin access | If this flag is on, the user may remotely access the Unix client using rlogin. Please note that this flag is currently untested. I still don't know how to setup and use rlogin;-) |
| S | Allow Samba access | If samba is up and running on the Linux client, this user can access his "Homes" share from any samba client or Windows workstation on the network. Quite an easy way to access his Linux home (even on a NFS share) from a Windows workstation. Restrictions put in the /etc/smb.conf file will also be enforced by samba at a later stage. This flag concerns only the initial samba session opening. |
| T | Allow remote Telnet and ssh access |
As the other remote access restrictions this flag will grant remote access to any Unix client by Telnet or ssh. With telnet, the account may be automatically created if it does not exist yet. With openssh , automagic account creation does not work, since ssh dameon first peeks into the local database to fetch credentials before calling PAM. If account does not exist, it refuses connection. Solutions, including automatic synchronization of local database and a nss switch library for ncpfs are under finalization. Details will be available on this site. |
| U | Reserved for future extension | |
| V | Volatile account | Not yet implemented. The idea of this flag was to autocreate an Unix account (with entries in /etc/passwd, /etc/shadow and a suitable local home directory), as in the general case; but to delete it at logout. We did not implemented it yet since if a problem occurs with automatic dismounting the Netware Home directory, deleting the Unix home at logout may erase completely the user's Netware home ! |
| W | Reserved for future extension | |
| X | Allow X access | Same as other remote access flags for X session opening. |
| Y | Reserved for future extension | |
| Z | Reserved for future extension | |
| 0 | Run zenscript 0 (opening) | Run the first zenscript at session opening (/usr/local/bin/zenscript0) |
| 1 | Run zenscript 1 (opening) |
Run the second zenscript at session opening (/usr/local/bin/zenscript1) |
| 2 | Run zenscript 2 (opening) | Run the third zenscript at session opening (/usr/local/bin/zenscript2) |
| 3 | Run zenscript 3 (closing) | Run the fouth zenscript at session closing (/usr/local/zenscript3) |
| 4 | Run zenscript 4 closing) | Run the fifth zenscript at session closing (/usr/local/zenscript4) |
| 5 | Run zenscript 5 (closing) | Run the sixth zenscript at session closing (/usr/local/zenscript5) |
the $HOME/.nwclient file:
Historically, ncpfs utilities that require login/password against a server will search for personnal information missing from the command line in a ~/.nwclient file with the following format:
SERVER1/user1 password1 SERVER2/user2 password2 ...More recent ncpfs API also search for Default tree and context in a section [Requester]
EURINSA/bjarno [Requester] Default Tree Name=INSA_ROOT Default Name Context=PCthe $HOME/.nwinfos file:
This file may be created in user's home directory and contains 18 NDS_* values fetched by the PAM module.Its initial purpose was to facilitate the writing of the Zenux Scripts . Contributors have provided us with many examples of usage in "regular shell scripts" used during the session.
Here are the expected values of the 18 variables:
NDS_USER=flardet NDS_GECOS="Florie Anne Lydie Lardet" NDS_SHELL=/bin/bash NDS_HOME=/cipc/eurinsa/2210126 NDS_UID=14694 NDS_GID=100 NDS_QFLAG=2033 NDS_HOME_SERVER=EURINSA NDS_HOME_VOLUME=APPS NDS_HOME_PATH=HOME/03/2210126 NDS_HOME_MNT_PNT=/mnt/ncp/flardet/nwhome NDS_EMAIL=florie.lardet@insa-lyon.fr NDS_EMAIL=florie.lardet@insa-lyon.fr NDS_PREFERRED_SERVER=EURINSA NDS_PREFERRED_TREE=INSA_ROOT NDS_PREFERRED_NAME_CTX=PC NDS_IS_NEW_USER=0 NDS_ZEN_FLAG=0xfc0c7101 NDS_BCAST=0
Zenux Scripts (aka zenscripts):
Zenux scripts are shell scripts that will be automatically executed at session opening and session closing. You may consider them as rough Unix equivalent of Login Scripts for Dos /Windows clients. The major difference is that they are stored on every Linux client; currently they must be named zenscriptx (x=[0..5]) and be in /usr/local/bin.
So a Zenux script should source $1/$2 to get all information read from NDS at the authentication stage. This file is overwritten as every login, so it should contains (almost) up-to-date information.
See this page for examples of zencripts
Requirements:
Recompile the kernel with the option CONFIG_NCPFS_MOUNT_SUBDIR (Allow mounting of volume subdirectories). So it will be possible to mount in ~/nwhome the real path to the Netware users home; some equivalent of the "MAP ROOT" command in Dos/Windows clients. Otherwise, the PAM module will only mount the Netware volume where the home is located (says USERS) and the current user will have to browse to his home (says ~/.nwhome/USERS/home/testuser) .
While you are at it, turn on the CONFIG_NCPFS_NDS_DOMAINS ('NDS interserver authentication support') flag, that allows the private authentication data to be stored in kernel, to be shared by multiple connections to Netware. If needed, activate these flags in /usr/src/linux/fs/ncpfs/Config.in as below, and recompile your kernel.# NCP Filesystem configuration bool ' Packet signatures' CONFIG_NCPFS_PACKET_SIGNING bool ' Proprietary file locking' CONFIG_NCPFS_IOCTL_LOCKING bool ' Clear remove/delete inhibit when needed' CONFIG_NCPFS_STRONG bool ' Use NFS namespace if available' CONFIG_NCPFS_NFS_NS bool ' Use LONG (OS/2) namespace if available' CONFIG_NCPFS_OS2_NS if ["$CONFIG_NCPFS_OS2_NS" = "y" ]; then bool ' Lowercase DOS filenames' CONFIG_NCPFS_SMALLDOS fi bool ' Allow mounting of volume subdirectories' CONFIG_NCPFS_MOUNT_SUBDIR bool ' NDS interserver authentication support' CONFIG_NCPFS_NDS_DOMAINS bool ' Use Native Language Support' CONFIG_NCPFS_NLS bool ' Enable symbolic links and execute flags' CONFIG_NCPFS_EXTRAS
Usage:
Say you want to make services login, kde and samba able to authentify against NDS, you must edit files /etc/pam.d/login, /etc/pam.d/kde and /etc/pam.d/samba.
With some distributions, such as Redhat, all files in /etc/pam.d actually "call" a commun file /etc/pam.d/system-auth, so modifications to this file will make all PAM aware services ncpfs aware too. Nice ;-)
As usual in pam's file the line must have the following format :
| #service name | service level | library called | command line options |
| [auth|password|session](*) | [sufficient|required|optional] | /lib/security/pam_ncp_auth.so | options |
There are quite few possible variations in "stacking" pam modules in these files. We experimented with quite a lot, and here are some guidelines to help you:
You will find here our current /etc/pam.d/system-auth file that stacks up local, LDAP and finally pam_ncp.
Command lines options
The pam_ncp_auth module recognizes three options that specify the authentification methods and (too) many switches that tune up its behavior.
In the event of several users having the same CN in different contexts (either provided in the list of contexts or found by searching NDS), the module will use the password to decide. If the password mismatch, it will keep trying with other possible CN.ctx, if any.
examples:
tree=insa_root anyone in any context that has the typed-in CN may get in with the proper password tree=insa_root/linuxok.pc same but only if member of group linuxok.pc tree=insa_root:PC,GCP.PC search for CN only in contexts PC and GCP.PC tree=insa_root:PC,GCP.PC/linuxok.PC same but only if member of group linuxok.pc
Currently, only one control group is supported
This option can be, (but should not) be repeated.. do you want to login to several trees ?
You should be aware of two issues:
This option may be repeated to "interrogate" in sequence several servers of the network.
Two syntaxes are possible and may be repeated: "server=ServerName" or "server=ServerName/GroupName".
If you are using variant "server=ServerName/GroupName", and server is a NDS server GroupName must be fully distinguished name of Group and ServerName must be a NDS server with bindery emulation activated on every user's context.
If server if a bindery server, GroupName must be a simple bindery group name, that is without any context specification. In any case, only users belonging to the group GroupName will be allow to log-in.Note that currently, the behavior of the module is undefined if you try to mix server=, ndsserver= or tree= options.
As usual, switches are a single letter with a '-'. With switches that accept arguments, do not put any space between the letter and the arguments.
| -a | allow "automagic " creation of accounts that have passed the Netware authentication step, by calling adduser with the appropriate parameters got from NDS. This flag should be on even if local database is in sync with NDS (using our sync script or our nss_ncp switch library (see TODO) |
| -A |
Spawn ncpmount with -A and -S argument, thus allowing
automounting of Netware homes in a pure Netware IP environnment. Automounting must be 'on' (-zA) |
| -b |
Force bindery login against all servers specified in the command line
with option server= . Some Netware properties will be read from server's bindery (Full Name, Group memberShip, Netware Home...) but all NDS Unix properties are unavailable (including zenflags). So in this mode, zenflags must be turned on/off by a -z/-Z switch, and IDS should be prepared in advance in local database to have some consistencies between workstations. Ignored against tree= or ndsserver= |
| -d | turn on debugging output (this will really fill /var/log/secure) |
| -gMIN,MAX,CFLAGS | parameters for group creation (see below). |
| -l | A required flag if user's home are on NFS remote shares and if you want automounting of Netware homes. This issue has been already discussed in several occasions (ncplogin,ncpmap...). See the FAQ |
| -L |
Introduced in ncpfs-2.2.3. Bypass service checking table for remote access (controlled by zenflags FHRSTX) If present, all remote access will be granted if login/password match. |
-mDir_Name |
By default, automounting of the current user Netware home directory
will be done in a local directory named nwhome ($HOME/nwhome or /mnt/ncp/$USER/nwhome depending of -l switch) . If for some reason this does not suit you, you can change the nwhome by any other name using this option. In any case, this directory will be created if absent, with 700 directory rights granted to user being authenticated. example : -mnovell home will be in /home/user/novell or /mnt/ncp/user/novell Feature (that may not last) : with -m with no argument, the user's Netware home will be used as his Linux home . See the FAQ ;-) |
| -n |
Do not autocreate user's home in the local file system. This is required if user's home are on some remote NFS shares. Local workstation should have the home directory path received from NDS permanently mounted in /etc/fstab or accessible via the automount system. See the Tips and tricks for our current implementation. Login will be refused if that home directory cannot be located or has the wrong permissions. Check /var/log/secure in debug mode. |
| -q | quiet mode. deprecated as -v switch. Do not use -d flag instead. |
| -s |
With bindery login (server=) or -b, disallow SUPERVISOR from logging-in With NDS servers, disallow admin from logging |
| -S |
With bindery login (server=) or -b, disallow SUPERVISOR equivalent from logging-in With NDS servers, disallow admin equivalent from logging |
| -uMIN,MAX,CFLAGS,MFLAGS | parameters for user creation (see below). |
| -v | Verbose mode. Deprecated. use -d instead |
| -zXXXX |
Add the XXXX Zenux Flags to any values read from NDS Quite useful in NW 3.X networks |
| -Z |
-Z Turn off all Zenux Flags processing of this station -ZXXX Turn off only specified Zenux Flags processing of this station (example : -ZT no telnet/ssh for NDS users here). |
Users creation and modification:
syntax :-uMIN,MAX,CFLAGS,MFLAGS . Any of the four fields may be empty
Username searched in the local database will be exactly what has been typed as login at the Unix prompt.
For consistency, it should always be the same as the NDS property (CN) or Bindery property (LOGIN) in lowercase .
If not found, this module will try to autocreate the local account
if the -a switch is present or if the CFLAGS field is not empty.
User creation's mode is controled by the content of the CFLAGS that can consist of one or more letters:
| r | (NDS required) When creating user, his uid must be read from UNIX:UID property, or equivalent U:nnnn L string, or LINUX:UID property. If not found or already locally used, login is not allowed and an error message is added to /var/log/secure file. Any value in fields MIN or MAX is ignored. |
| p | (NDS preferred) When creating user, prefer uid from NDS.
If present, the above rule will apply;
otherwise new user unique uid generation method will depend of the next letter: n : (Next) When inventing uid for new user, take one which is one greater than highest used uid in MIN,MAX range. f : (First) When inventing uid for new user, take first unused in MIN,MAX range. This is the default . |
| n or f | (NDS none) If the CFLAGS does not start by 'r' or 'p',
user creation will use the "First" or the "Next" method above depending of the first letter (n or f). feature: Currently if CFLAGS does no start with r ou p, or is empty, all user's NDS data ( IDS, home, groups, zenflags...) will be fetched only if the -a switch is present. |
If you specify both 'r' and 'p', or both 'n' and 'f', behavior is undefined.
By default, that is if no -u switch, new user creation will be as First unused uid rule, between 1000 and 60000 that is as if -u1000,60000,f has been used on the command line; but; please note that NDS will not be searched at subsequent logins So many features of this module will be disabled. In short, with current version you should have at least -u,,p,s on the command line.
At every login, local user's data may be modified to stay in sync with NDS by a non-empty MFLAGS in -u switch.MFLAGS can consist of one or more following letters, in any order:
Note that modification of the user's login name or Unix id is not supported.
Group membership addition is also synchronized with NDS; at user's creation, all its NDS groups will be created locally if absent (see the next section) and user's name added to them in local /etc/group. Internally the pam_ncp module spawns the usermod command with appropriate parameters.
At every login, if the MFLAGS is not empty (any single letter g,c,d,s will suffice), NDS will be read and if user belongs to some new groups they will be added as above.
Group membership removal is not synchronized between NDS and the local database; that is, if a NDS user is removed from a NDS group, he will not be removed at next login from the corresponding line in the local /etc/group file.
Further efforts in this direction does not seem to be worthwhile; these flags and features will disappear if the nss library get finalized.
Some examples:
| -u,,p | Testing settings: IDs may be in NDS, otherwise
use default 'First unused' between 1000 and 60000 |
| -u,,p,gcds | Testing settings: IDs may be in NDS, otherwise
use default 'First unused' between 1000 and 60000 At each login keep everything in sync with NDS. |
| -u,,pn,gcds | Testing settings: IDs may be in NDS, otherwise
use 'Next unused'method between 1000 and 60000 At each login keep everything in sync with NDS. |
| -u20000,,p,gcds | Testing settings: IDs may be in NDS, otherwise
use default 'First unused' between 20000 and 60000 At each login keep everything in sync with NDS. |
| -u20000,50000,p,gcds | Testing settings: IDs may be in NDS, otherwise
use default 'First unused' between 20000 and 50000 At each login keep everything in sync with NDS. |
| -u,,r,gcds | Final production settings: IDs are NDS required to make sure they are unique and in sync with those used in NFS home's servers. |
Groups creation:
syntax :-gMIN,MAX,CFLAGS
Local Unix groups automatic creation can happen under different circumstances and unique group ids are controlled by the -g switch.
When a new user is created in Unix, and if the authenticating server is a NDS server, all the NDS groups he belongs to will be automatically created on the local Unix station.The name of the Unix group will be invented from the NDS group name by removing the context part, spaces are replaced by '_' and by adding a Z if the first character of the group name is a digit. All other characters will be 'constrained' in the A-Z range.
As and example, if user john_doe belongs to NDS groups "everyone.somecontext" and "2 nd class.someothercontext", the two groups "everyone" and "Z_2nd_class" will be created, if missing in the local Unix station.
If this conversion does not suit you, you must specify an Unix group name using the accompanying snapin in the group's PAM ncp authentication page or add a N:UnixName string to its L (Location) strings in the group Identification page.
As an example, if you want that members of NDS group everyone.myOu.myO be registered to Unix group users, with GID 100, you must set under NWAdmin the PAM ncp authentication values of this group to Unix Gid=100 and Unix Name=users; or alternatively set one of the L strings of everyone.myOu.myO to G:100 and another one to N:users.In addition, if the user has one or several some O:group_name strings in his NDS L strings property, these groups will also be created if needed as such on the local Unix station.
example: O:wheel O:bin O:staff #please don't use O:wheel,bin,staff User's will be added to 'standard' Unix group wheel and bin, and to the staff group (probably autocreated).This feature allows you to register users to specific Unix groups without having to create equivalent groups in NDS. In any case, CFLAGS is exactly the same as with users. In 'r' (NDS required) mode, the Unix GID must be read from NDS UNIX:GID (or equivalent property), whereas in 'p' (NDS preferred) mode, an unique GID will be invented (if not found in NDS) from MIN and MAX values and the 'f' (first unused) or 'n' (next unused) flag.
As above, gid minimal and maximal values if not specified in MIN,MAX will default to respectively 1000 and 60000.
In contrast to user creation, automatic group creation is not lethal; that is if group creation fails for any reason, user login will not be prohibited.
Currently there are flags to modify groups, once created.
History:
TODO:
Vous êtes notre eme visiteur