|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
|
Role Based Access Control (RBAC) allows to create special accounts (called roles) that cannot be accessed via external login (for example telnet or ssh). It also permits unprivileged users to execute out privileged commands much like sudo.
|
A role is identical to a user account, except you can't log on to the system with a role user account and need to use su. Most applications will never understand the difference. |
While RBAC is conceptually similar to sudo (actually pfexec command is an almost exact replica of sudo functionality) , but is more versatile and starting with Solaris 10 much more powerful. But even in Solaris 8 and 9 it is an attractive solution for several security related problems including, but not limited to:
One of the simple, yet important usage of RBAC is to control "application" accounts like "oracle", "webuser", "apache" etc. The idea is to convert a given account to a role and that automatically blocks all external logins. This idea is far from being new, but still it is surprising how many enterprises do not use it.
You also need explicitly add the right to assume this role to accounts the need to su to it.
This procedure explains how to convert an application account to role on Solaris 8 and 9. This is a better way to do this Solaris 10.
Step 1: Check if you are root. You need to be a superuser. We will use root as an example of conversion as it exists on any machine and most sysadmins can test this procedure directly on their personal Sun workstations. We will assume that the user joe_adm will be the account that is able to su to root. Other users can be added in a similar way.
Step 2: Backup existing authorization databases. There are four files that make up RBAC configuration:
Actually only /etc/user_attr needs to be backed up as this is the only file that is changed in this procedure.
Step 2: Edit the /etc/user_attr file.
Here is a relevant fragment from a typical user_attr file.
root::::type=normal;auths=solaris.*,solaris.grant;profiles=All
joe_adm::::type=normal
Note: if /etc/passwd file was copied from another server there might be some or all the users that are absent from this file. For consistency you might want to add them. Generally it's better to do this with a script that converts "human" accounts into records of the format, shown above.
root::::
type=role;auths=solaris.*,solaris.grant;profiles=Allusermod -R root joe_adm
joe_adm::::type=normal;roles=root
su joe_adm
# roles
|
Switchboard | ||||
Latest | |||||
Past week | |||||
Past month |
[Feb 11, 2005] How To Create Custom Roles Using Based Access Control (RBAC)
#41168 How to set up RBAC to allow non-root user to manage in.named on DNS server
The following are assumed:
- The role is: dnsrole
- The user is: dnsadmin
- The profile is: DNS Admin ( case sensitive )
- Home directory for dnsrole is: /export/home/dnsrole
- Home directory for dnsadmin is: /export/home/dnsadmin
Configuration Steps
1. Create the role and assign it a password:
# roleadd -u 1001 -g 10 -d /export/home/dnsrole -m dnsrole# passwd dnsroleNOTE: Check in /etc/passwd that the shell is /bin/pfsh. This ensures that nobody can log in as the role.
Example line in /etc/passwd:
dnsrole:x:1001:10::/export/home/dnsrole:/bin/pfsh2. Create the profile called "DNS Admin":
Edit /etc/security/prof_attr and insert the following line:
DNS Admin:::BIND Domain Name System administrator:3. Add profile to the role using rolemod(1) or by editing /etc/user_attr:
# rolemod -P "DNS Admin" dnsroleVerify that the changes have been made in /etc/user_attr with profiles(1) or grep(1):
# profiles dnsroleDNS AdminBasic Solaris UserAll# grep dnsrole /etc/user_attrdnsrole::::type=role;profiles=DNS Admin
- Assign the role 'dnsrole' to the user 'dnsadmin':
- If 'dnsadmin' already exists then use usermod(1M) to add the role (user must not be logged in):
# usermod -R dnsrole dnsadmin- Otherwise create new user using useradd(1M) and passwd(1):
# useradd -u 1002 -g 10 -d /export/home/dnsadmin -m \-s /bin/ksh -R dnsrole dnsadmin# passwd dnsadmin- Confirm user has been added to role with roles(1) or grep(1):
# roles dnsadmidnsrole# grep ^dnsadmin: /etc/user_attrdnsadmin::::type=normal;roles=dnsrole5. Assign commands to the profile 'dns':
Add the following entries to /etc/security/exec_attr:
DNS Admin:suser:cmd:BIND 8:BIND 8 DNS:/usr/sbin/in.named:uid=0DNS Admin:suser:cmd:ndc:BIND 8 control program:/usr/sbin/ndc:uid=0If using Solaris 10 you may need to add a rule for BIND 9:
DNS Admin:suser:cmd:BIND 9:BIND 9 DNS:/usr/sfw/sbin/named:uid=0BIND 9 does not use ndc, instead rndc(1M) is used which does not require RBAC.
6. Create or Modify named configuration files.
To further limit the use of root in configuring and maintaining BIND make dnsadmin the owner of /etc/named.conf and the directory it specifies.
# chown dnsadmin /etc/named.conf# grep -i directory /etc/named.confdirectory "/var/named/";# chown dnsadmin /var/named7. Test the configuration:
Login as the user "dnsadmin" and start named:
$ su dnsrole -c '/usr/sbin/in.named -u dnsadmin'To stop named use ndc (for BIND 9 use rndc):
$ su dnsrole -c '/usr/sbin/ndc stop'Summary:
In this example the user 'dnsadmin' has been set up to manage the DNS configuration files and assume the role 'dnsrole' to start the named process.
The role 'dnsrole' is only used to start named and to control it with ndc (for BIND 8).
With this RBAC configuration the DNS process when started by user 'dnsrole' would acquire root privileges and thus have access to its configuration files.
The named options '-u dnsadmin' may be used to specify the user that the server should run as after it initializes. Furthermore 'dnsadmin' is then permitted to send signals to named as described in the named manual page.
References:
ndc(1M), named(1M), rbac(5), profiles(1), rolemod(1M), roles(1),rndc(1M), usermod(1M), useradd(1M)