Allowing Normal Users to Manage SMF Services: Part 2 Comments Off on Allowing Normal Users to Manage SMF Services: Part 2
In Part 1, I covered setting up RBAC with a custom role that would allow us to manage an SMF service as a non-privileged user. Now I’ll cover the steps required to setup the SMF part.
Note that, in the previous post, for management of the Sun MC Agent, we didn’t add a specific command – we added an authorisation to the Profile.
Although this will configure RBAC to support this nicely, it actually won’t do anything – we need to specifically configure SMF on each host to support this extra authorisation.
Basically SMF has an all or nothing approach – applying the authorisation solaris.smf.manage will allow you to manage any SMF service – very much not what we want.
Instead we want to configure a specific SMF service – in this case, sunmcagent – to allow an authorisation string that lets us specifically manage this service – and just this service.
We do this by using the svcprop command on the specific host to directly edit the properties of the service.
First of all let’s list the service’s properties:
root@madlarry # svcprop -p general sunmcagent general/enabled boolean true general/entity_stability astring Evolving general/single_instance boolean true
All fairly straightforward – the above tells us:
- the service is enabled
- it’s an evolving service, so the stability of it’s properties isn’t guaranteed
- there can only be a single discreet instance of this service
We want to add an additional property, our authorisation string.
We use the svccfg command to do this:
root@madlarry # svccfg -s sunmcagent setprop general/action_authorization=astring: 'solaris.smf.manage.sunmcagent'
Having done this, it won’t take effect until we refresh the service.
Check for yourself:
root@madlarry # svcprop -p general sunmcagent general/enabled boolean true general/entity_stability astring Evolving general/single_instance boolean true
Then we refresh the service:
root@madlarry # svcadm refresh sunmcagent
And then check again:
root@madlarry # svcprop -p general sunmcagent general/enabled boolean true general/entity_stability astring Evolving general/single_instance boolean true general/action_authorization astring solaris.smf.manage.sunmcagent
Behold our authorisation string! Now SMF will recognise this string when passed from RBAC, realise we only want to manage this specific service, and the magic happens.
However – we still can’t disable this service.
That’s because the ‘disable’ action modifies the SMF service (by changing the value of the general/enabled property) – the other actions are all temporary, but disable is persistent across reboots.
To get round this we need to add another property, value/authorization, will gives us authority to modify the values for properties for that specific service when managing it.
Similar sort of options to svcprop to affect this change:
root@madlarry # svccfg -s sunmcagent setprop general/value_authorization=astring: 'solaris.smf.manage.sunmcagent'
Then we can refresh and review the change:
root@madlarry # svcadm refresh sunmcagent root@madlarry # svcprop -p general sunmcagent general/enabled boolean true general/entity_stability astring Evolving general/single_instance boolean true general/action_authorization astring solaris.smf.manage.sunmcagent general/value_authorization astring solaris.smf.manage.sunmcagent
So now the authorisation ‘solaris.smf.manage.sunmcagent’ is allowed to perform temporary actions and permanently modify the values of the sunmcagent service.
There’s a good BigAdmin article on configuring custom RBAC roles in Solaris here – highly recommended reading.