This document provides a guide to security for xCAT on z/VM and Linux on System z. For technical support, please post your question(s) on the mailing-list.
This section provides details on how to add users to xCAT and limit the scope of their usage.
In order to add a user to xCAT, you must modify two xCAT tables: policy and passwd. Below are the instructions on how to modify these tables.
# chtab priority=6.1 policy.name=joe policy.rule=allow
The policy table controls which commands a user can run and which nodes the user can access. There is a unique priority number for each user. You must verify that the priority number you have chosen is not in use by viewing the existing policies in the policy table (tabdump policy). In the example above, a user named joe is added with a priority number of 6.1.
# chtab priority=6.1 policy.commands="rpower,mkvm,rmvm,lsvm,chvm,mkdef,lsdef,rscan,rinv,nodeadd"
Multiple commands can be specified. Each command has to be separated by a comma. Be sure to use the correct priority number when setting the commands. Otherwise, you might be overriding the policy of another user.
# perl -e "print crypt('rootpw', rand(12345678))"
48aVyK0x4vqCc
The password being encrypted is rootpw. It uses the Perl crypt routine with a random number between 0 and 12345678 as a seed.
# chtab username=joe passwd.key=xcat passwd.password=48aVyK0x4vqCc
More information can be found on granting xCAT user privileges by going to this link.
This section provides details on how to setup a non-root login for xCAT and virtual machines provisioned by xCAT.
In some environments, system administrators cannot use root to access and manage their systems. The following setup provides an alternative way (via a sudoer) to access and manage systems.
Create a non-root user (xcat) on the xCAT MN.
# /usr/sbin/userdel xcat
# /usr/sbin/useradd -p rootpw -m xCAT
Add the user to the sudoers list.
# echo "xcat ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
The sudoer can be customized to run only a small set of commands. In this example,
* xcat - User name
* ALL= - From any Host/IP
* (ALL) - Can run as any user
* NOPASSWD: - No password required
* ALL - All commands accepted
If you are running RHEL, an extra line must be added in the sudoers file.
# echo "Defaults:xcat !requiretty" >> /etc/sudoers
# chtab priority=1.3 policy.name=xcat policy.rule=allow policy.comments="privilege:root;"
# perl -e "print crypt('rootpw', rand(12345678))"
48aVyK0x4vqCc
# chtab username=xcat passwd.key=xcat passwd.password=48aVyK0x4vqCc
In order for the sudoer (xcat) to access the xCAT UI, you must add "privilege:root;" into the policy.comments.
updatenode zhcp -P sudoer
In order for updatenode to run the postscript, the public SSH key (id_rsa.pub) must already be setup on the target virtual machine. The postscript create a sudoer with a user name of xcat and a password of rootpw. The username and password contained in the sudoer script can be modified to suit your needs.
# chtab node=all postscripts.postscripts+=sudoer
In the example above, the sudoer postscript will be run for any node in the group all.
chtab username=xcat passwd.key=sudoer
If as entry is found in the passwd table (where key = sudoer), then xCAT will use the username when accessing any virtual machine.
# tabdump policy
#priority,name,host,commands,noderange,parameters,time,rule,comments,disable
"1","root",,,,,,"allow",,
"1.2","ihost1",,,,,,"trusted",,
"1.3","xcat",,,,,,"allow",,
# tabdump passwd
#key,username,password,cryptmethod,comments,disable
"xcat","root","12JtAcMN8jn8k",,,
"xcat","xcat","12JtAcMN8jn8k",,,
"sudoer","xcat",,,,
# tabdump postscripts
#node,postscripts,postbootscripts,comments,disable
"xcatdefaults","syslog,remoteshell,syncfiles,sudoer","setuprepo,otherpkgs",,
"all","setuprepo,otherpkgs,sudoer",,,