我在 Joyent 的 Base64 1.8.1 SmartOS 映像上的 SMF(服务器管理工具)下运行服务器进程。
对于那些不熟悉 SmartOS 的人,它是 IllumOS 和 KVM 的基于云的发行版。但本质上它就像 Solaris 并且继承自 OpenSolaris。因此,即使您没有使用过 SmartOS,我也希望能在 ServerFault 上利用一些 Solaris 知识。
我的问题是我希望允许非特权用户重新启动他们拥有的服务。我已经通过使用 RBAC 以及向/etc/security/auth_attr我的用户添加授权并将该授权与我的用户相关联来确定如何做到这一点。
然后,我将以下内容添加到服务的 SMF 清单中:
<property_group name='general' type='framework'>
<!-- Allow to be restarted-->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.my-server-process' />
<!-- Allow to be started and stopped -->
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.my-server-process' />
</property_group>
Run Code Online (Sandbox Code Playgroud)
这在导入时效果很好。我的非特权用户可以重新启动、启动和停止自己的服务器进程(这是用于自动代码部署)。
但是,如果我导出 SMF 清单,此配置数据就会消失……我在该部分中看到的只是:
<property_group name='general' type='framework'>
<property name='action_authorization' type='astring'/>
<property name='value_authorization' type='astring'/>
</property_group>
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会这样?是我的语法错误,还是我只是错误地使用了 SMF?