|
| 1 | + |
| 2 | + |
| 3 | +# Restricting User Access via SLURM |
| 4 | + |
| 5 | +Files to edit: |
| 6 | + |
| 7 | +Edit $CHROOT/etc/pam.d/password-auth: |
| 8 | +``` |
| 9 | +account required pam_unix.so |
| 10 | +account required pam_slurm.so # Add this line, below pam_unix.so, but above everything else |
| 11 | +account sufficient pam_localuser.so |
| 12 | +account sufficient pam_succeed_if.so uid < 500 quiet |
| 13 | +account required pam_permit.so |
| 14 | +``` |
| 15 | + |
| 16 | +Edit $CHROOT/etc/security/access.conf: |
| 17 | +``` |
| 18 | +# All other users should be denied to get access from all sources. |
| 19 | ++ : root : ALL <======== uncomment this line |
| 20 | +- : ALL : ALL <======== uncomment this line |
| 21 | +``` |
| 22 | + |
| 23 | +Now rebuild and apply your vnfs to the nodes. (Not covered here.) |
| 24 | + |
| 25 | +Test it out: |
| 26 | +``` |
| 27 | +[sr@sms ~]$ ssh compute-1 |
| 28 | +Access denied: user sr (uid=1) has no active jobs on this node. |
| 29 | +Connection closed by 192.168.x.x |
| 30 | +[sr@sms ~]$ salloc -n 1 |
| 31 | +salloc: Granted job allocation 71 |
| 32 | +[sr@sms ~]$ squeue |
| 33 | + JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) |
| 34 | + 71 shared bash sr R 0:04 1 compute-1 |
| 35 | +[sr@sms ~]$ ssh compute-1 |
| 36 | +[sr@compute-1 ~]$ # Note we can log in now! |
| 37 | +[sr@compute-1 ~]$ exit |
| 38 | +logout |
| 39 | +Connection to knl-36 closed. |
| 40 | +[sr@sms ~]$ scancel 71 |
| 41 | +salloc: Job allocation 71 has been revoked. |
| 42 | +``` |
| 43 | + |
| 44 | +## References: |
| 45 | + |
| 46 | +How to set resource limits with ins slurm: https://slurm.schedmd.com/faq.html#pam |
| 47 | + |
| 48 | +Using PAM to secure userspace: https://groups.google.com/forum/#!topic/slurm-devel/sVkZ1FFVq5s |
0 commit comments