{"id":111,"date":"2015-06-08T00:35:36","date_gmt":"2015-06-07T22:35:36","guid":{"rendered":"https:\/\/blog.unetresgrossebite.com\/?p=111"},"modified":"2015-07-25T02:02:22","modified_gmt":"2015-07-25T00:02:22","slug":"ossec","status":"publish","type":"post","link":"https:\/\/blog.unetresgrossebite.com\/?p=111","title":{"rendered":"OSSEC"},"content":{"rendered":"<p>Looking for jobs on Elance and UpWork, I stumbled upon this proposal, quoting <a href=\"http:\/\/blog.bluemalkin.net\/pci-compliance-tips-for-sys-admins\/\">a blog post<\/a> about hardening security on a small network, according to PCI standards.<br \/>\nHaving already heard of Snort, Auditd, mod_security and Splunk, I was quite curious about OSSEC.<\/p>\n<p>OSSEC purpose is to keep an eye on your systems integrity, and raise alerts upon suspicious changes.<br \/>\nArguably, it could be compared to Filetraq,\u00a0though\u00a0it&#8217;s intelligent enough to qualify as an IDS.<\/p>\n<p>Installation process is pretty straight-forward. The main difficulty is to properly create a certificate \u00a0for ossec-authd, the register all your nodes, and don&#8217;t forget to shut ossec-authd down, once you&#8217;re done deploying agents.<br \/>\nUsing <a href=\"http:\/\/ossec.wazuh.com\/\">Wazuh<\/a> packages (debian and ubuntu only), almost everything is pre-configured. They&#8217;re not perfect, if you happend to install both <em>ossec-hids<\/em> and <em>ossec-hids-agent<\/em>, a few files would be defined twice, upon installing the second packages the first one would be partially removed, you&#8217;ll lose files such as <em>\/etc\/init.d\/ossec<\/em>, preventing the last package to install properly, &#8230; You&#8217;ll have to purge both packages, purge\u00a0<em>\/var\/ossec<\/em> from your filesystem and reinstall either <em>ossec-hids<\/em> or <em>ossec-hids-agent<\/em>.<\/p>\n<p>Setting it up on my kibana server, I ended up writing <a href=\"https:\/\/gitlab.unetresgrossebite.com\/DevOps\/puppet\/tree\/master\/modules\/ossec\/\">a module dealing with both agent and master server setup<\/a>, as well as installing ossec-webui from github.<br \/>\nNote: the module does not deal with installing the initial key to your main ossec instance. As explained in the module README, you would need to install it on <em>\/var\/ossec\/etc<\/em> prior to starting ossec service.<br \/>\nPassed that step, puppet would deal with everything else, including agent registration to your main instance.<br \/>\nAlso note ossec-webui is not the only web frontend to OSSEC. There&#8217;s also <a href=\"http:\/\/linuxdrops.com\/install-the-coolest-of-all-analogi-ossec-web-user-interface-on-centos-rhel-debian-ubuntu\/\">Analogi<\/a> I haven&#8217;t tried yet. Mainly because I don&#8217;t want to install yet another MySQL.<\/p>\n<p>During my first tests, I noticed a small bug, cutting communications from an agent to its master.<br \/>\nMore details about this\u00a0<a href=\"https:\/\/groups.google.com\/forum\/#!topic\/ossec-list\/HH3UqbA8BFY\">over here<\/a>. Checking <em>\/var\/ossec\/logs\/ossec.log<\/em>, you would find the ID corresponding to your faulty node. Stopping OSSEC, removing <em>\/var\/ossec\/queue\/rids\/$your_id<\/em> and starting OSSEC back should be enough.<\/p>\n<p>An other problem that could occur, is nodes showing up inactive on the web manager, while the agent seems\u00a0properly running. Your manager logs would contain something like:<\/p>\n<p><code>ossec-agentd(pid): ERROR: Duplicated counter for 'fqdn'.<br \/>\nossec-agentd(pid): WARN: Problem receiving message from 10.42.X.X<\/code><\/p>\n<p>When you would have identified something like this, you may then run <em>\/var\/ossec\/bin\/manage_agents<\/em> on your manager, and drop the existing key for incriminated agents. Then connect to your agents, drop <em>\/var\/ossec\/queues\/rids\/<\/em> content, stop <em>ossec<\/em> service, create a new key with <em>\/var\/ossec\/bin\/agent-auth<\/em> and restart <em>ossec<\/em>.<\/p>\n<div id=\"attachment_142\" style=\"width: 1017px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2015\/06\/ossec-logs1.png\"><img aria-describedby=\"caption-attachment-142\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-142 size-full\" src=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2015\/06\/ossec-logs1.png\" alt=\"OSSEC\" width=\"1007\" height=\"768\" \/><\/a><p id=\"caption-attachment-142\" class=\"wp-caption-text\">OSSEC Logs view<\/p><\/div>\n<p>Stay tuned for my next commits, as I would be adding FreeBSD support, as soon as I would have build the corresponding package on my RPI.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Looking for jobs on Elance and UpWork, I stumbled upon this proposal, quoting a blog post about hardening security on a small network, according to PCI standards. Having already heard of Snort, Auditd, mod_security and Splunk, I was quite curious about OSSEC. OSSEC purpose is to keep an eye on your systems integrity, and raise [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":143,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,7,6,2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/111"}],"collection":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111"}],"version-history":[{"count":9,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions\/144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/media\/143"}],"wp:attachment":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}