[SERVER-1741] Have mongod/mongos --installService --reinstallService and --removeService invoke a windows UAC prompt Created: 06/Sep/10  Updated: 23/Jul/19  Resolved: 23/Jul/19

Status: Closed
Project: Core Server
Component/s: Usability
Affects Version/s: 1.7.0
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Justin Dearing Assignee: Mark Benvenuto
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows only


Sprint: Security 2019-07-15, Security 2019-07-29
Participants:

 Description   

If you have UAC enabled, you need to be running from an already elevated command prompt for service installation and removal to succeed. Manipulating the Service Control Manager requires elevated privileges.

It seems the preferred method for doing this is ShellExecute() with the runas verb, but that would involve a second process. There is a way to use COM objects to keep it in once process. I think tat is over complicating it. Perhaps a hidden option or an alternative entry function besides main() (and whatever win32 api trickery is needed to call that) combined with ShellExecute is the way to go.

To clarify, UAC is not needed to run mongo as a service, just install or remove it.



 Comments   
Comment by Mark Benvenuto [ 23/Jul/19 ]

In 4.0, we added support for installing MongoDB as a service as part of the MSI installer. This reduces the frequency in which developers will need to install mongodb from the command line.

You analysis is correct and there are several ways we could trigger a UAC prompt if needed. (https://docs.microsoft.com/en-us/windows/win32/secauthz/developing-applications-that-require-administrator-privilege). With the MSI changes, this is just no longer needed.

Generated at Thu Feb 08 02:57:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.