<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cygnetix on Medium]]></title>
        <description><![CDATA[Stories by Cygnetix on Medium]]></description>
        <link>https://medium.com/@cygnetix?source=rss-66fb8ee32508------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZWdfboYOXjkshZ1_pxjyhg.png</url>
            <title>Stories by Cygnetix on Medium</title>
            <link>https://medium.com/@cygnetix?source=rss-66fb8ee32508------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:19:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cygnetix/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Quick wins with SELinux]]></title>
            <link>https://medium.com/@cygnetix/quick-wins-with-selinux-42d0d14a15be?source=rss-66fb8ee32508------2</link>
            <guid isPermaLink="false">https://medium.com/p/42d0d14a15be</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[selinux]]></category>
            <dc:creator><![CDATA[Cygnetix]]></dc:creator>
            <pubDate>Wed, 10 Aug 2016 10:09:52 GMT</pubDate>
            <atom:updated>2016-08-10T10:17:19.760Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re reading this in the hope that all your SELinux woes will be magically resolved, I have some bad news for you. If you want to understand how to manage SELinux properly then you’re going to have to learn how to write a policy, and sooner or later I really hope that you will. In the mean time this post will provide you with a list of commands that should get you by 80% of the time, even if you don’t yet understand them.</p><h4>Confirming a problem is being caused by SELinux</h4><blockquote>ausearch -m avc -ts recent</blockquote><p>You probably have a suspicion. It could take a few hours before the thought comes to you, but sooner or later you’ll wonder “could it be SELinux causing this issue?”. When the thought comes, the above command will show you actions that were recently blocked by SELinux.</p><h4>Identifying the cause of the problem</h4><blockquote>ausearch -m avc -ts recent | audit2why</blockquote><p>So what now? You know that SELinux is the issue, you also know that simply running <em>setenforce 0 </em>isn’t the right way to address it. The audit2why utility will take an SELinux event (AVC) and attempt to identify the underlying cause of the problem.</p><h4>Checking SELinux booleans</h4><blockquote>setsebool -P {{name}} on</blockquote><p>Services can be configured quite differently and so SELinux policies have been created to also work differently. The way this is implemented is using booleans. You can think of SELinux booleans as a way of turning on or off a set of rules within the policy. A classic example of this is the <em>httpd_allow_can_db_connect</em>. This boolean is disabled by default, but if you have a webserver running Apache that needs to connect to a database then you need to set this boolean to <em>on </em>before your webserver will be able to connect.</p><p>Checkout the full list of possible booleans by running <em>getsebool -a</em>.</p><h4>Check your file labels</h4><blockquote>ls -lZ /path/to/files</blockquote><p>Another classic problem that admins will run in to is file labelling. Historically, if you decided that you’d prefer for your website to located under <em>/srv/mysite</em> rather than the default of <em>/var/www/html</em> you wouldn’t have had a problem. With SELinux, every file and folder in the file system has a label. If a process tries to perform an action (read or write) on a file with a label and there’s no rule within the policy to allow it then it will be denied.</p><p>If you find that your process is being blocked and suspect the files have been mislabelled first try running the <em>restorecon -R</em> command. This will set the file labels to the defaults defined in the SELinux policy. If the labels are still wrong, use something along the lines of <em>semanage fcontext -a -t httpd_sys_content_rw_t ‘/srv/mysite(/.*)?’ </em>to change the labels of that location.</p><h4>Disabling an individual policy</h4><blockquote>semodule -r httpd</blockquote><p>If trying to resolve your particular SELinux problem just isn’t happening for you, you may be tempted just run <em>setenforce 0</em> and update your <em>/etc/selinux/config</em> file to disable SELinux outright. I would recommend instead using the above command to disable just the individual policy that is causing the problems.</p><h4>Final Thoughts</h4><p>I wouldn’t say SELinux is easy to learn, but I would certainly say that it is worthwhile learning. Once you’ve got a handle on the basics you’ll start to see that disabling SELinux because it’s stopping Apache from connecting to your database server is a bit like disabling iptables because it was preventing incoming connections on port 80. It’s irresponsible to turn it off just because you’re too lazy to learn how to use it.</p><p><a href="http://stopdisablingselinux.com/">http://stopdisablingselinux.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42d0d14a15be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to live with, and love, SELinux]]></title>
            <link>https://medium.com/@cygnetix/learning-to-live-with-and-love-selinux-626708de4381?source=rss-66fb8ee32508------2</link>
            <guid isPermaLink="false">https://medium.com/p/626708de4381</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[selinux]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Cygnetix]]></dc:creator>
            <pubDate>Mon, 08 Aug 2016 05:14:56 GMT</pubDate>
            <atom:updated>2016-08-08T05:26:04.367Z</atom:updated>
            <content:encoded><![CDATA[<p>SELinux isn’t everyone’s favourite operating system feature but, love it or hate it, it’s now been an integral part of the <a href="https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux">RedHat Enterprise Linux</a> OS for some time and isn’t going anywhere any time soon.</p><p>Usually the bad experiences admins have with SELinux are much the same; they’ve moved some files, or possibly trying to serve up files from a non-default directory, and things just mysteriously don’t work. Hours of consulting documentation and trawling through Google finally points them in the direction of the <em>/var/log/audit/audit.log</em> file where a trail of incomprehensible events seem to indicate that SELinux has been quietly preventing things from working.</p><p>This was my thoughts of SELinux, maybe 5 years ago. Since then I’ve taken the time to learn how SELinux works, at least to the point where I can resolve most of the trivial problems encountered.</p><p>The first thing that really helped to understand the purpose of SELinux was hearing Dan Walsh repeatedly say “SELinux is a labelling system”. It makes sense right? SELinux’s sole purpose is to label your files, processes and ports and to then define policies that dictate the interactions between those labels.</p><p>As an example, the Apache web service is labelled with<em> httpd_t</em> and in its policy specifies that it’s allowed to read files with the label <em>httpd_sys_content_t. </em>If Apache attempts to read a file that has a label other than what its policy allows, <em>passwd_file_t</em> for example, then SELinux will step in to block the read operation and an event will be recorded in the <em>audit.log</em> file.</p><p>So, what’s the beef with SELinux? Why are sysadmins still opting to <em>setenforce 0? </em>Here’s my list of SELinux gripes which I think make learning to live with SELinux difficult:</p><ul><li><strong>Too many tools and no naming consistency:</strong> There’s a whole swag of SELinux commands: getenforce, semanage, getsebool, sestatus, restorecon and I find that trying to remember which one to use for each occasion isn’t always obvious. Some even duplicate functionality but present the information in slightly different ways.</li><li><strong>Audit logs give you labels but not file paths: </strong>When reviewing an SELinux error, it’s useful to know the source context and target context provided in the audit.log file, but it would also be handy to know the actual process name and/or file name that is being blocked. Usually you can make some safe assumptions to figure this information out, but it takes time.</li><li><strong>A shortage of good, concise, documentation: </strong>There’s some good resources available but when it comes to policy writing it really feels like the documentation hasn’t kept up with the development of SELinux and there’s a lot of SELinux concepts and terminology to understand before getting up to speed with how to resolve SELinux related issues.</li></ul><p>Even with those shortcomings, SELinux provides a very effective security control which is well worth taking the time to learn and understand. Even in <em>permissive</em> mode, I would argue that there is value in having it act as an IPS by raise events for abnormal activity (policy violations) even if you’re not ready to start blocking them.</p><p>In the coming posts I’m hoping to provide some of my own guidance and share how I learnt to manage SELinux and avoid the temptation to simply disable it altogether.</p><p>If there’s one take home message from this article it would be to at least run SELinux in permissive mode and ensure you’re forwarding your <em>audit.log</em> file to a centralised log management system like <a href="https://www.elastic.co/">Elastic Stack</a> or <a href="http://www.splunk.com/">Splunk</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=626708de4381" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking Powershell Remoting]]></title>
            <link>https://medium.com/@cygnetix/breaking-powershell-remoting-37eba4e995a4?source=rss-66fb8ee32508------2</link>
            <guid isPermaLink="false">https://medium.com/p/37eba4e995a4</guid>
            <category><![CDATA[break-fix]]></category>
            <category><![CDATA[powershell]]></category>
            <dc:creator><![CDATA[Cygnetix]]></dc:creator>
            <pubDate>Tue, 20 Oct 2015 08:01:53 GMT</pubDate>
            <atom:updated>2015-10-20T08:01:53.376Z</atom:updated>
            <content:encoded><![CDATA[<p>Just a quick post to cover a problem that I’d manage to introduce for myself today.</p><h4><strong>Symptoms:</strong></h4><p>At some point today I notice that I was no longer to run Enter-PSSession to remote in to servers. At first it was just the one server I tried, so I gave it a reboot but, after it was still not working I tried others and found them to have the same issue.</p><p>I asked a colleague if they had access and they confirmed they did so I started to suspect it was likely just my machine.</p><p>The error I received is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7PrhnjZ1Fih1kYnCF7a2HQ.png" /><figcaption>Error when attempting to connect via WinRM</figcaption></figure><h4>Solution:</h4><p>As it turns out, at some point in the day I had made changes to my machine’s proxy settings using the netsh command. This change resulted in all WinRM traffic being sent via the proxy, which makes sense given that it’s a web service.</p><p>The problematic settings can be seen below as well as the command to remove the setting and resolve the issue:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*bwFzhzaX2VD0VEy187TpJA.png" /><figcaption>Reviewing proxy settings and removing the proxy configuration</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37eba4e995a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First Post]]></title>
            <link>https://medium.com/@cygnetix/first-post-46f9b3acd6fa?source=rss-66fb8ee32508------2</link>
            <guid isPermaLink="false">https://medium.com/p/46f9b3acd6fa</guid>
            <category><![CDATA[test]]></category>
            <dc:creator><![CDATA[Cygnetix]]></dc:creator>
            <pubDate>Mon, 27 Jul 2015 03:20:19 GMT</pubDate>
            <atom:updated>2015-07-27T03:20:19.382Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7gjY03ESP-UPn3BfU4ledA.jpeg" /></figure><p>Testing 1, 2.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46f9b3acd6fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>