-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Enhancements to SSL for ossec-authd and agent-auth #166
Comments
This is really needed and would solve the issue of agents being vulnerable to MiM attacks. Thank you for your efforts. If you feel adventurous, maybe you take a look at agent-auth on Windows and discover why it doesn't work. :) |
Great, I'll continue on with this and post updates here. Will see what the issue is with agent-auth on Windows as well, cheers. |
So in order to get an agent key the agent would need its own key? Do I undrstand this correctly? |
Yes, but only if that functionality is needed by the organisation using ossec-authd/agent-auth and they have the existing infrastructure in place to support it. All of this proposed functionality is optional to users and they would have to specify additional command line arguments to make use of it. If they're happy using ossec-authd/agent-auth as is and don't require any certificate verification then they will notice absolutely no difference in the way they use these utilities. This proposed enhancement is really intended for organisations that:
In addition to that some organisations may want the ability to verify that clients connecting to ossec-authd also present a valid certificate. Scenario 1: Process: ossec-authd -x /path/to/ossec-authd.crt -k /path/to/ossec-authd.key Scenario 2: Process: ossec-authd -x /path/to/ossec-authd.crt -k /path/to/ossec-authd.key -v /path/to/ca.crt |
The -x and -k options mentioned above for ossec-authd are optional and need not be specified. ossec-authd will continue to load the certificate and key from <ossec_dir>/etc/sslmanager.cert and <ossec_dir>/etc/sslmanager.key by default. I added them as a convenience for users. The goal here is to leave existing users completely unaffected but allow users with stricter security requirements to be able to use ossec-authd. |
On Mon, Mar 31, 2014 at 2:47 AM, mweigel [email protected] wrote:
Understood, but if you have the infrastructure to put the SSL keys on
|
@ddpbsd I think the idea is that this resolves the agent vulnerability of it trusting any system posing as a manager. Without this patch, we have to trust that ARP poisoning won't be happening on the network such that the system will send all logs to a MiM server. It's even worse if the agent has been configured to execute remote commands. Then it becomes a potentially infrastructure-wide compromise since that MiM manager can now execute commands as root on the agent systems. |
Hi all, I've pushed up another commit here: https://github.com/mweigel/ossec-hids/commit/63a061615d48710fe3e9bcde70a1119abaacfda8 This code should only be used for testing purposes currently and if anyone wants to clone it and take a look and do some testing that would be great. I have been testing it today and it seems to be working well for me. I looked at OpenSSL's "X509_check_host" function as a reference while constructing parts of this and some of the code will be similar. Not trying to pass this off as completely original. Using X509_check_host would be the better choice but that would require OpenSSL-1.0.2. This will allow agent-auth to check the subjectAltName extensions present the certificate it receives from the manager for a match with the hostname given on the command line. If no matches are found there it'll check the common names. This differs slightly from rfc6125 but I believe it's pretty standard behaviour. The matching is always case insensitive and certificates containing wild cards are not supported yet. This all really came about because I wanted a more automated way of provisioning OSSEC clients and when I found that ossec-authd did 90% of what I wanted, rather than inventing another solution for my particular environment I thought I would try to contribute in a small way to this project as OSSEC is a really valuable tool for me. |
Closed by mistake. |
Added commit: https://github.com/mweigel/ossec-hids/commit/2f6ce89902cd44f6fc20503278d7084c3425a998 This will allow agent-auth to check the IP address given on the command line with the -m option against the subjectAltName fields in the certificate presented by ossec-authd in the case where DNS is not in use. |
I want to get this in but still worried about windows and unix using different code paths for ssl.... As you have stated you don't feel this is prod ready so let's take some time to review and pick a direction. @ossec should be looking at this and the other windows ssl patch. |
I haven't had a lot of time to work on this over the last couple of weeks but I'll be spending some time on it this weekend. I'm pretty happy with how it's working now and it would definitely be good to get others testing it. I've been fairly careful not to introduce anything that would break Windows compatibility further so it shouldn't be any more difficult than it was to get it building on Windows. I'll try to spend a bit of time taking a look at that as well, cheers. |
Hi guys, Another update:
I'm pretty happy with this code now and don't think I will add any new functionality for the time being. I'll just be testing and possibly tidying up a bit. The Windows version of agent-auth was compiled on Linux (Fedora 20) and tested on Windows 7 Home Premium 64-bit. Let me know what you think, cheers. |
Hey guys, I've been working on this again today and testing as much as I can and I'm really happy with how it's working. I'd love to get it merged if you're happy with the implementation. I'm happy to assist with updated documentation for users as well if that would be of benefit. On the subject of separate clients for Linux and Windows my personal preference would be to keep the existing client compatible with both platforms rather than having two clients. My main reason for this apart from the added code is that if the clients differ in their behaviour it could be confusing for users. This probably wouldn't be a big deal at the moment as the default behaviour for both clients is to perform no verification of the server's certificate. But if in future it was decided to make verification the default with the option to turn it off then having one client doing verification by default and having another client doing no verification by default could leave users with a false sense of security. This may never happen and it's probably not too difficult to add certificate verification to the Windows client but I don't have any experience developing for Windows so I can't really say. I don't believe there will be any issues with either client interacting with the updated ossec-authd. At the moment the client here is building for Windows again and seems to be working well but I'd like to get some input from the guys who are more experienced building OSSEC. Let me know how you'd like to proceed, cheers. |
We released 2.8 and going to get this code into master ASAP so people can test. As you have done so much great work with this. I might ping you about how things are working and if others have problems to see if you can shine some insight. I am not asking you to be a maintainer (unless you want to be). Thank you again. |
Hi there, Cool, sounds good, I'm happy to help with any issues that come up as part On Fri, Jun 6, 2014 at 12:09 AM, Jeremy Rossi [email protected]
|
I am testing ossec in our environment and one of the main issues we are running into is auto auth of clients. We have thousands of devices that will be connecting to ossec. The addition of agent-auth code to Windows clients is exactly what I am looking for! I am a security analyst, and don't have a ton of experience with coding per say. How can I incorporate this code into the ossec client windows binary? Thank You for your help! |
It would be nice to include the ``agent-auth` in the windows agent binary releases. I assume for now to get binaries I'll need to build the windows agent from scratch? |
I have a branch with windows agent auth, but noone has tested it yet. Or atleast they haven't reported back to me. I assume it's out of lack of interest https://github.com/ddpbsd/ossec-hids/tree/winauthd?files=1 |
@ddpbsd I'm looking into setting up a windows build env, is it basically GNUMake and gcc? It's been a while since I compiled C from source on windows platforms. |
@hh You will actually be better off compiling the Windows stuff on a NIX platform. Should be able to use |
@ddpbsd I'm getting close, but using mingw I'm getting an error building
|
Going back to During the link step -lssl is not used though. |
Here is a build via cygwin of https://github.com/ddpbsd/ossec-hids/tree/winauthd for ossec_agent.exe only. I couldn't get the MinGW to work @awiddersheim includes: |
I was able to get the cygwin build of agent-auth.exe to work windows (to at least write out Note: I had to create the directory paths for the PID file, zoneinfo, and etc for it to be able to run.
|
Thanks for these updates. I'm hoping to dig back into it when I find some
|
Hi all,
I'd like to have the ability to verify server and client certificates when using ossec-authd and agent-auth so I've been working on some enhancements to those utilities here:
https://github.com/mweigel/ossec-hids/tree/authd_certificate_verify
This functionality is aimed at organisations that want to run ossec-authd on a more permanent basis and that also have a private CA in place where client certificates are issued as part of the process of provisioning a new machine. With these enhancements users can select between:
Three additional command line options have been added to ossec-authd and agent-auth. If none of these options are specified then ossec-authd and agent-auth will behave exactly as they do currently.
-v
-x
-k
Only basic certificate verification is done at this stage and further enhancements could be made. I'm looking for feedback as to whether this is something that would be useful to others and whether this is something that you would consider integrating into the main project before I proceed any further, thanks.
The text was updated successfully, but these errors were encountered: