We have a suite of Windows Services running on our servers which perform a bunch of automated tasks independently of one another, with the exception of one service which looks after the other services.
In the event that one of the services should fail to respond or hang, this service attempts to restart the service and, if an exception is thrown during the attempt, emails the support team instead, so that they can restart the service themselves.
Having done a little research, I've come across a few 'solutions' which range from the workaround mentioned in KB907460 to giving the account under which the service is running administrator rights.
I'm not comfortable with either of these methods - I don't understand the consequences of the first method as outlined in Microsoft's knowledge base article, but I definitely don't want to give administrator access to the account under which the service is running.
I've taken a quick look through the Local Security Policy and other than the policy which defines whether or not an account can log on as a service, I can't see anything else which looks like it refers to services.
We're running this on Server 2003 and Server 2008, so any ideas or pointers would be graciously received!
Clarification: I don't want to grant the ability to start/stop/restart ALL services to a given user or group - I want to be able to grant the permission to do so on specific services only, to a given user or group.
Further Clarification: The servers I need to grant these permissions on do not belong to a domain - they are two internet-facing servers which receive files, process them and send them on to third parties, as well as serving a couple of websites, so Active Directory Group Policy isn't possible. Sorry that I didn't make this clearer.
-
You're looking for Computer Configuration - Policies - Windows Settings - Security Settings - System Services
There you can not only define the service start type, but you can configure the security ACLs for each service as well. By default, the interface will only list the services that are installed on the machine you're running the GP Editor on.
To add services that only exist on another machine:
- export the service's reg key from the other machine
- import on the gpedit machine
- apply the policy
- delete the imported key
abitgone : I trust you mean to do this through `gpedit.msc`, as the "Manage Server" window doesn't list a policies node. If so, I can't see an item underneath the Security Settings node which references "System Services" as you suggest above, on either Server 2008 or Server 2003.Ryan Bolger : Ah yes. I assumed you were planning on making these changes via group policy.abitgone : Indeed - these are not member servers. Is there a way of targeting this using local policy, or some other method?From Ryan Bolger -
you might also take a look at this article from ms, which also points to GP modifications:
http://support.microsoft.com/kb/256345
abitgone : Thanks tespen, but these particular servers don't belong to a domain, so I'd be unable to use Active Directory in this case.From tespen -
There doesn't appear to be a GUI-based way of doing this unless you're joined to a domain - at least not one I could find anywhere - so I did a bit more digging and I've found an answer that works for our sitaution.
I didn't understand what the string representation meant in the knowledge base article, but doing a bit of digging led me to discover that it's SDDL syntax. Further digging led me to this article by Alun Jones which explains how to get the security descriptor for a service and what each bit means.
To append to the service's existing security descriptor, use
sc sdshow "Service Name"to get the existing descriptor. If this is a plain old .NET Windows Service - as is the case with ours - the security descriptor should look something like this:D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOC RRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)S:(AU;FA ;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)We needed to grant permissions
RP(to start the service),WP(to stop the service),DT(to pause/continue the service) andLO(to query te service's current status). This could be done by adding our service account to the Power Users group, but I only want to grant individual access to the account under which the maintenance service runs.Using
runasto open a command prompt under the service account, I ranwhoami /allwhich gave me the SID of the service account, and then constructed the additional SDDL below:(A;;RPWPDTLO;;;S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx)This then gets added to the D: section of the SDDL string above:
D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOC RRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)(A;;RPWP DTLO;;;S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx)S:(AU;FA;CCDCLCSWRPWPDTLOC RSDRCWDWO;;;WD)This is then applied to the service using the
sc sdsetcommand:sc sdset D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;; CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU )(A;;RPWPDTLO;;;S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxx)S:(AU;FA;CCDCLCSW RPWPDTLOCRSDRCWDWO;;;WD)If all goes according to plan, the service can then be started, stopped, paused and have it's status queried by the user defined by the SID above.
abitgone : PS: Not sure you're supposed to answer your own questions - is this an acceptable way of doing things on ServerFault?Ryan Bolger : Answering your own question is very much allowed and encouraged (particularly with a well researched answer such as yours). You can mark yourself as the answer as well.From abitgone
0 comments:
Post a Comment