Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should check for necessary access #4

Open
flowchartsman opened this issue May 6, 2015 · 18 comments · Fixed by #15
Open

Should check for necessary access #4

flowchartsman opened this issue May 6, 2015 · 18 comments · Fixed by #15

Comments

@flowchartsman
Copy link
Owner

In keeping with the zero-surprises mode of thinking, deadman should detect, at startup, whether or not it is capable of shutting down. On *nix systems, this means checking whether or not it has superuser access. On windows, further research is required.

@flowchartsman flowchartsman changed the title Should check for superuser access Should check for necessary access May 8, 2015
@omern1
Copy link
Contributor

omern1 commented May 8, 2015

on windows, every thing will be resolved by using the win32 api because it has functions for all of the things that are issues here.

@flowchartsman
Copy link
Owner Author

In order to figure out exactly which calls to make, I'll need to not only know which DLLs are involved, but also the permission names/UUIDs and such that are involved. If you can point me in the right direction of finding out if a given user has shutdown privileges, it would be much appreciated. All I know as of now is that the local security policy of a windows box can restrict it. As to how to check... not there yet.

@omern1
Copy link
Contributor

omern1 commented May 8, 2015

A better idea would be to force the application to run only with administrative privileges by embedding a manifest.

@flowchartsman
Copy link
Owner Author

Good idea. Maybe using this: http://github.com/akavel/rsrc

Care to submit one?

Sent from my iPhone

On May 8, 2015, at 5:35 AM, Nabeel Omer [email protected] wrote:

A better idea would be to force the application to run only with administrative privileges by embedding a manifest.


Reply to this email directly or view it on GitHub.

@omern1
Copy link
Contributor

omern1 commented May 9, 2015

Care to submit what? A manifest?

@flowchartsman
Copy link
Owner Author

Yes.

Sent from my iPhone

On May 9, 2015, at 1:26 AM, Nabeel Omer [email protected] wrote:

Care to submit what? A manifest?


Reply to this email directly or view it on GitHub.

@omern1
Copy link
Contributor

omern1 commented May 9, 2015

Sure.

@omern1
Copy link
Contributor

omern1 commented May 9, 2015

<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='requireAdministrator' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

This is a manifest that will force the user to provide administrator credentials and the application will run elevated. Its 100% correct and working (I know that for certain because I copied it from one of my own applications).
PS. I believe, now I am a contributor :)

@flowchartsman
Copy link
Owner Author

I'll test and make sure that the tool I've got embeds the necessary manifest, and that it works. If all goes well, what you can do if you want to get on the contributors list is the following:

  1. Fork the repo.
  2. make a directory assets/windows
  3. place this file there with a suitable filename like require_admin.xml
  4. check it in with a decent commit message
  5. issue a pull request.

Then, my friend, you'll be listed as a contributor.

@omern1
Copy link
Contributor

omern1 commented May 9, 2015

Hahaha, Thanks.

@omern1
Copy link
Contributor

omern1 commented May 11, 2015

What's Up Andy, stopped all development?

@flowchartsman
Copy link
Owner Author

Nope. Working on an event-based branch to remove the need for polling.

@omern1
Copy link
Contributor

omern1 commented May 11, 2015

That is a tough job. Especially in windows. You need a message only window. Anyways, did you try the manifest?

@flowchartsman
Copy link
Owner Author

I actually completed it with a callout to powershell and System.Management.WqlEventQuery and System.Management.ManagementEventWatcher. It's unpolished at the moment, but it works. All Win32_PnPEntitys seem to show up on add and remove. No, I have not yet tried the manifest. I will try and get to it tonight.

@omern1
Copy link
Contributor

omern1 commented May 12, 2015

Have you updated the repository?

@flowchartsman
Copy link
Owner Author

You will receive an alert when I do.

@omern1
Copy link
Contributor

omern1 commented May 12, 2015

Something wrong?

@flowchartsman
Copy link
Owner Author

Unix checks still outstanding. This appears to work for Windows. I also gave it a more meaningful name. You also didn't create an assets directory like I asked, but I think it will be okay in the base directory with the new name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants