在 Oracle® Solaris 11.2 中确保用户和进程的安全

退出打印视图

更新时间: 2014 年 7 月
 
 

创建权限配置文件和授权

当提供的权限配置文件不包含所需的权限集合时,您可以创建或更改权限配置文件。您可以为具有有限权限的用户、新应用程序或因为各种其他原因而创建权限配置文件。

Oracle Solaris 提供的权限配置文件是只读的。如果所提供的某个权限配置文件的权限集合不足以满足要求,您可以克隆该配置文件并进行修改。例如,您可能希望将 solaris.admin.edit/ path-to-system-file 授权添加到所提供的某个权限配置文件中。有关背景的信息,请参见有关权限配置文件的更多信息

如果提供的授权不包括在您的特权应用程序中编写的授权,您可以创建一个授权。您无法更改现有的授权。有关背景的信息,请参见有关用户授权的更多信息

如何创建权限配置文件

开始之前

要创建权限配置文件,您必须是指定有 "File Security"(文件安全)权限配置文件的管理员。有关详细信息,请参见使用所指定的管理权限

  1. 创建权限配置文件。
    # profiles -p [-S repository] profile-name

    系统会提示您输入说明。

  2. 向权限配置文件添加内容。

    对具有单个值的配置文件属性使用 set 子命令,如 set desc。对可以具有多个值的属性使用 add 子命令,如 add cmd

    以下命令创建在 Oracle Solaris 11.2 中管理 Kerberos 和其他验证服务 中的如何分配修改后的 PAM 策略中的定制 PAM 权限配置文件。为方便显示,名称进行了缩写。

    # profiles -p -S LDAP "Site PAM LDAP"
    profiles:Site PAM LDAP> set desc="Profile which sets pam_policy=ldap"
    ...LDAP> set pam_policy=ldap
    ...LDAP> commit
    ...LDAP> end
    ...LDAP> exit
示例 5-6  创建 "Sun Ray Users"(Sun Ray 用户)权限配置文件

在此示例中,管理员在 LDAP 系统信息库中为 Sun Ray 用户创建权限配置文件。管理员已创建了 "Basic Solaris User"(基本 Solaris 用户)权限配置文件的 Sun Ray 版本,并从 Sun Ray 服务器上的 policy.conf 文件中删除了所有权限配置文件。

# profiles -p -S LDAP "Sun Ray Users"
profiles:Sun Ray Users> set desc="For all users of Sun Rays"
... Ray Users> add profiles="Sun Ray Basic User"
... Ray Users> set defaultpriv="basic,!proc_info"
... Ray Users> set limitpriv="basic,!proc_info"
... Ray Users> end
... Ray Users> exit

管理员验证内容。

# profiles -p "Sun Ray Users" info
Found profile in LDAP repository.
        name=Sun Ray Users
        desc=For all users of Sun Rays
        defaultpriv=basic,!proc_info,
        limitpriv=basic,!proc_info,
        profiles=Sun Ray Basic User
示例 5-7  创建包含特权命令的权限配置文件

在以下示例中,安全管理员在管理员创建的权限配置文件中添加某应用程序的特权。此应用程序能够识别特权。

# profiles -p SiteApp
profiles:SiteApp> set desc="Site application"
profiles:SiteApp> add cmd="/opt/site-app/bin/site-cmd"
profiles:SiteApp:site-cmd> add privs="proc_fork,proc_taskid"
profiles:SiteApp:site-cmd> end
profiles:SiteApp> exit

要进行验证,管理员可以选择 site-cmd

# profiles -p SiteApp "select cmd=/opt/site-app/bin/site-cmd; info;end"
Found profile in files repository.
  id=/opt/site-app/bin/site-cmd
  privs=proc_fork,proc_taskid

接下来的步骤

将权限配置文件指定给可信用户或角色。有关示例,请参见Example 3–10Example 3–19

另请参见

要对权限指定进行故障排除,请参见如何排除权限指定问题。有关背景的信息,请参见所指定权限的搜索顺序

如何克隆和修改系统权限配置文件

开始之前

要创建或更改权限配置文件,您必须是指定有 "File Security"(文件安全)权限配置文件的管理员。有关详细信息,请参见使用所指定的管理权限

  1. 通过现有的配置文件创建新的权限配置文件。
    # profiles -p [-S repository] existing-profile-name
    • 要向某个现有的权限配置文件添加内容,请创建一个新配置文件。

      将现有权限配置文件作为补充权限配置文件添加到新配置文件,然后添加增强功能。请参见Example 5–8

    • 要删除某个现有权限配置文件中的内容,请克隆该配置文件然后重命名并进行更改。

      请参见Example 5–9

  2. 通过添加或删除补充权限配置文件、授权以及其他权限修改新的权限配置文件。
示例 5-8  克隆并增强 "Network IPsec Management"(网络 IPsec 管理)权限配置文件

在此示例中,管理员将 solaris.admin.edit 授权添加到站点的 "IPsec Management"(IPsec 管理)权限配置文件,这样就不再需要 root 角色。此权限配置文件只指定给可以修改 /etc/hosts 文件的可信用户。

  1. 管理员验证是否无法修改该 "Network IPsec Management"(网络 IPsec 管理)权限配置文件。

    # profiles -p "Network IPsec Management"
    profiles:Network IPsec Management> add auths="solaris.admin.edit/etc/hosts"
    Cannot add. Profile cannot be modified
  2. 管理员创建包含该 "Network IPsec Management"(网络 IPsec 管理)配置文件的权限配置文件。

    # profiles -p "Total IPsec Mgt"
    ... IPsec Mgt> set desc="Network IPsec Mgt plus /etc/hosts"
    ... IPsec Mgt> add profiles="Network IPsec Management"
    ... IPsec Mgt> add auths="solaris.admin.edit/etc/hosts"
    ... IPsec Mgt> end
    ... IPsec Mgt> exit
  3. 管理员验证内容。

    # profiles -p "Total IPsec Mgt" info
            name=Total IPsec Mgt
            desc=Network IPsec Mgt plus /etc/hosts
            auths=solaris.admin.edit/etc/hosts
            profiles=Network IPsec Management
示例 5-9  从权限配置文件中克隆和删除所选权限

在此示例中,管理员将管理 VSCAN 服务的属性这一功能与启用和禁用该服务的功能相分离。

首先,管理员列出 Oracle Solaris 提供的权限配置文件的内容。

# profiles -p "VSCAN Management" info
        name=VSCAN Management
        desc=Manage the VSCAN service
        auths=solaris.smf.manage.vscan,solaris.smf.value.vscan,
              solaris.smf.modify.application
        help=RtVscanMngmnt.html

然后,管理员创建可以启用和禁用该服务的权限配置文件。

# profiles -p "VSCAN Management"
profiles:VSCAN Management> set name="VSCAN Control"
profiles:VSCAN Control> set desc="Start and stop the VSCAN service"
... VSCAN Control> remove auths="solaris.smf.value.vscan"
... VSCAN Control> remove auths="solaris.smf.modify.application"
... VSCAN Control> end
... VSCAN Control> exit

然后,管理员创建可更改该服务的属性的权限配置文件。

# profiles -p "VSCAN Management"
profiles:VSCAN Management> set name="VSCAN Properties"
profiles:VSCAN Properties> set desc="Modify VSCAN service properties"
... VSCAN Properties> remove auths="solaris.smf.manage.vscan"
... VSCAN Properties> end
... VSCAN Properties> exit

管理员验证新权限配置文件的内容。

# profiles -p "VSCAN Control" info
        name=VSCAN Control
        desc=Start and stop the VSCAN service
        auths=solaris.smf.manage.vscan
# profiles -p "VSCAN Properties" info
        name=VSCAN Properties
        desc=Modify VSCAN service properties
        auths=solaris.smf.value.vscan,solaris.smf.modify.application

接下来的步骤

将权限配置文件指定给可信用户或角色。有关示例,请参见Example 3–10Example 3–19

另请参见

要对权限指定进行故障排除,请参见如何排除权限指定问题。有关背景的信息,请参见所指定权限的搜索顺序

如何创建授权

开始之前

开发者在您要安装的应用程序中定义和使用了授权。有关说明,请参见 面向开发者的 Oracle Solaris 11 安全性指南 面向开发者的 Oracle Solaris 11 安全性指南 中的关于授权

  1. (u53ef选) 为您的新授权创建帮助文件。

    例如,为使用户能够修改应用程序中数据的授权创建帮助文件。

    # pfedit /docs/helps/NewcoSiteAppModData.html
    <HTML>
    -- Copyright 2013 Newco.  All rights reserved.
    -- NewcoSiteAppModData.html 
    -->
    <HEAD>
         <TITLE>NewCo Modify SiteApp Data Authorization</TITLE>
    </HEAD>
    <BODY>
    The com.newco.siteapp.data.modify authorization authorizes you 
    to modify existing data in the application.
    <p>
    Only authorized accounts are permitted to modify data. 
    Use this authorization with care.
    <p>
    </BODY>
    </HTML>
  2. 通过使用 auths add 命令创建授权。

    例如,以下命令在本地系统上创建 com.newco.siteapp.data.modify 授权。

    # auths add -t "SiteApp Data Modify Authorized" \
    -h /docs/helps/NewcoSiteAppModData.html com.newco.siteapp.data.modify

    现在,您可以测试授权,然后将该授权添加到权限配置文件中,并将该配置文件指定给角色或用户。

示例 5-10  测试新授权

在此示例中,管理员使用Example 5–7 的 SiteApp 权限配置文件测试 com.newco.siteapp.data.modify 授权。

# usermod -A com.newco.siteapp.data.modify -P SiteApp tester1

如果测试成功,管理员删除该授权。

# rolemod -A-=com.newco.siteapp.data.modify siteapptester

为简化维护工作,管理员将该授权添加到Example 5–11 中的 SiteApp 权限配置文件。

示例 5-11  向权限配置文件中添加授权

测试授权可以正常使用后,安全管理员将 com.newco.siteapp.data.modify 授权添加到现有权限配置文件。Example 5–7 显示了管理员创建配置文件的方法。

# profiles -p "SiteApp"
profiles:SiteApp> add auths="com.newco.siteapp.data.modify"
profiles:SiteApp> end
profiles:SiteApp> exit

为进行验证,管理员列出了该配置文件的内容。

# profiles -p SiteApp
Found profile in files repository.
  id=/opt/site-app/bin/site-cmd
  auths=com.newco.siteapp.data.modify

接下来的步骤

将权限配置文件指定给可信用户或角色。有关示例,请参见Example 3–10Example 3–19

另请参见

要对权限指定进行故障排除,请参见如何排除权限指定问题。有关背景的信息,请参见所指定权限的搜索顺序