ossec/ossec-hids — pull request #100 by awiddersheim (2014-03-03 21:39:10+00:00)
Title: Fix permissions and privilege detection

When using the win32ui to change the server IP or import the
authentication key the permissions on ossec.conf and client.keys
were not set correctly resulting in any system user being able to
read the contents of these files.

This brought on some additional problems where the win32ui was unable
to properly detect if it was running with Administrative privileges.
The previous logic would attempt to read/write a .test file in the
OSSEC directory but thanks to a mixture of UAC redirection, an
unsigned binary and not requiring Administrative privileges these
tests would always pass. That means the win32ui would be able to run
without Administrative privileges.

This solution still isn't the best. It would be better if proper
win32 APIs were used to set permissions and determine if the win32ui
was started with the proper privileges. This is just an iterim
solution to get something out the door.