<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>esmblog</title>
	<atom:link href="http://blog.esmnetworks.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.esmnetworks.com</link>
	<description>Ramblings from SBR</description>
	<lastBuildDate>Mon, 19 Mar 2012 17:27:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Force Google Chrome to start in Incognito mode regardless of how it is invoked</title>
		<link>http://blog.esmnetworks.com/planet-cdot/force-google-chrome-to-start-in-incognito-mode-regardless-of-how-it-is-invoked/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/force-google-chrome-to-start-in-incognito-mode-regardless-of-how-it-is-invoked/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 16:46:24 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Planet CDOT]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=432</guid>
		<description><![CDATA[I&#8217;ve recently switched to Google&#8217;s Chrome mainly because of it&#8217;s excellent implementation of Windows 7&#8242;s Integrity Levels. Even when running under an Administrative context, the child processes will run with Low Integrity (IE9 doesn&#8217;t do this and FF never respects WIL regardless of context). This is a good thing, since any exploits that may compromise [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently switched to Google&#8217;s Chrome mainly because of it&#8217;s excellent implementation of Windows 7&#8242;s Integrity Levels. Even when running under an Administrative context, the child processes will run with Low Integrity (IE9 doesn&#8217;t do this and FF never respects WIL regardless of context). This is a good thing, since any exploits that may compromise the browser directly (either through JS JIT or Flash plugins) can&#8217;t really do much damage when running with Low Integrity. More on Integrity Levels here: <a title="Windows Integrity Levels" href="http://msdn.microsoft.com/en-us/library/bb625957.aspx">http://msdn.microsoft.com/en-us/library/bb625957.aspx</a></p>
<p>Add a NoScript-like extension such as ScriptNo by &#8216;Andrew Y&#8217;, and Chrome is a safe and fast browser in an otherwise hostile world wide web.</p>
<p>Much like it&#8217;s competitors, Chrome allows an Incognito mode which will discard any browser data after the session ends. This is great, however there is no way (that I could find) to tell Chrome to always start in this mode. Yes you can change the shortcut on your desktop and add the <strong>-incognito</strong> switch but this is not a fool proof solution. If Chrome is your default browser <strong>Start &gt; Run &gt; http://www.google.com</strong> will not launch it in Incognito Mode. If any applications start the browser without using your shortcut (through protocol or file associations) the browser will start in normal mode.</p>
<p>There is no .conf or .ini or .json file you can edit to tell Chrome to always start in Incognito Mode, which seems like a strange omission from the Chrome dev team. By altering a few default settings, FF and IE can be told to remove all traces of browser data upon exiting. The only thing in Chrome that comes close is under <strong>Privacy</strong>\<strong>Cookies</strong> section. You can remove all cookies and &#8220;other site data&#8221; when exiting the browser but this is not the equivalent of Ctrl + Shift + Del.</p>
<p>What we can do is modify some registry settings and tell Windows to start a batch file instead of the <strong>chrome.exe</strong> main application. When Chrome is made the default browser, among other things, it modifies a few registry keys to tell Windows where to go when associating a protocol with an application (in our case: HTTP and HTTPS).</p>
<p>So let&#8217;s tell it to use <strong>chrome.cmd</strong> instead of <strong>chrome.exe</strong>:</p>
<pre class="brush:bash">Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command]
@="\"C:\\Tools\\start_chrome_incognito.cmd\" -- \"%1\""

[HKEY_CLASSES_ROOT\http\shell\open\command]
@="\"C:\\Tools\\start_chrome_incognito.cmd\" -- \"%1\""

[HKEY_CLASSES_ROOT\https\shell\open\command]
@="\"C:\\Tools\\start_chrome_incognito.cmd\" -- \"%1\""

[HKEY_CLASSES_ROOT\htmlfile\shell\open\command]
@="\"C:\\Tools\\start_chrome_incognito.cmd\""

[HKEY_CLASSES_ROOT\htmlfile\shell\opennew\command]
@="\"C:\\Tools\\start_chrome_incognito.cmd\" %1"</pre>
<p>Save this as <strong>chrome_file_association_fix.reg</strong> and run it. For reasons I have yet to understand, you can&#8217;t use environment variables in the registry path. Likely has to do with the host process not having an environment when it executes the application. But who knows..</p>
<p>You cannot add the switches directly to the registry key. This would be more convenient since it wouldn&#8217;t require a separate batch file to maintain, but this breaks the host process that attempts to start the application.</p>
<p>Create a <strong>start_chrome_incognito.cmd</strong> in your <strong>C:\Tools</strong> folder and put this into it:</p>
<pre class="brush:shell">@echo off
start /D"%LocalAppData%\Google\Chrome\Application\" chrome.exe -incognito --purge-memory-button --memory-model=low %*
:: for XP use the following
:: start /D"%AppData%\Google\Chrome\Application\" chrome.exe -incognito --purge-memory-button --memory-model=low %*</pre>
<p>Add whatever options you want before <strong>%*</strong> and you should be good to go. If you are on Windows XP still, upgrade. If you can&#8217;t upgrade then make sure you use the appropriate path to <strong>chrome.exe</strong> in your batch file.</p>
<p>Now when you start Chrome using something like <strong>Start &gt; Run &gt; http://www.google.com </strong>you will be browsing in Incognito mode.</p>
<p>Hacky but it works.</p>
<p>Google, please add an option to do this natively, thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/force-google-chrome-to-start-in-incognito-mode-regardless-of-how-it-is-invoked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ConfigMgr TS Editor reporting the &#8220;Too many steps in the task sequence object&#8221; error</title>
		<link>http://blog.esmnetworks.com/planet-cdot/configmgr-ts-editor-reporting-the-too-many-steps-in-the-task-sequence-object-error/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/configmgr-ts-editor-reporting-the-too-many-steps-in-the-task-sequence-object-error/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 13:08:23 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Operating System Deployment]]></category>
		<category><![CDATA[Planet CDOT]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=408</guid>
		<description><![CDATA[Earlier today I was playing around with ConfigMgr 2007 and editing a fairly large task sequence (a couple of hundred steps). When I attempted to save, I got the following error: I googled around and saw suggestions to adjust the WMI provider&#8217;s memory allocation, restart the WMI service and even re-integrate MDT with SCCM. I [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today I was playing around with ConfigMgr 2007 and editing a fairly large task sequence (a couple of hundred steps). When I attempted to save, I got the following error:</p>
<div id="attachment_409" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-409" href="http://blog.esmnetworks.com/planet-cdot/configmgr-ts-editor-reporting-the-too-many-steps-in-the-task-sequence-object-error/attachment/untitled/"><img class="size-medium wp-image-409" title="SCCM Task Sequence Editor - Too many steps in task sequence object error" src="http://blog.esmnetworks.com/wp-content/uploads/2011/09/untitled-300x102.png" alt="SCCM Task Sequence Editor - Too many steps in task sequence object error" width="300" height="102" /></a><p class="wp-caption-text">TS Save Error</p></div>
<p>I googled around and saw suggestions to adjust the WMI provider&#8217;s memory allocation, restart the WMI service and even re-integrate MDT with SCCM.</p>
<p>I restarted the WMI services but the error did not go away. SMSAdminUI.log recorded the following messages:</p>
<pre class="brush:php">...
instance of SMS_ExtendedStatus
{
	Description = "Invalid sequence input parameters - task sequence not found.";
	ErrorCode = 1078462229;
	File = "c:\\qfe\\nts_sms_fre\\sms\\siteserver\\sdk_provider\\smsprov\\ssptspackage.cpp";
	Line = 2711;
	Operation = "ExecMethod";
	ParameterInfo = "SMS_TaskSequencePackage";
	ProviderName = "WinMgmt";
	StatusCode = 2147749889;
};
...</pre>
<p>&#8220;task sequence not found&#8221;??</p>
<p>I duplicated the task sequence from the console and was able to make changes, add steps and save the newly created TS. Exporting the troublesome TS also revealed that the task sequence was under the <strong>4MB</strong> limit (only about 200kb).</p>
<p>After editing the duplicate task, I shutdown all instances of MMC, restarted WMI/SMS Agent Host services and was able to edit the task sequence once more.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/configmgr-ts-editor-reporting-the-too-many-steps-in-the-task-sequence-object-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCCM WSUS Configuration Manager Could Not Establish Trust Relationship for the SSL/TLS secure channel</title>
		<link>http://blog.esmnetworks.com/infrastructure/sccm-wsus-configuration-manager-could-not-establish-trust-relationship-for-the-ssltls-secure-channel/</link>
		<comments>http://blog.esmnetworks.com/infrastructure/sccm-wsus-configuration-manager-could-not-establish-trust-relationship-for-the-ssltls-secure-channel/#comments</comments>
		<pubDate>Wed, 04 May 2011 18:16:52 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[configmgr]]></category>
		<category><![CDATA[fqdn]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[management point]]></category>
		<category><![CDATA[native mode]]></category>
		<category><![CDATA[san]]></category>
		<category><![CDATA[sccm]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[software update point]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[subject alternative name]]></category>
		<category><![CDATA[SUP]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[system center configuration manager]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[wsus]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=398</guid>
		<description><![CDATA[I have two SCCM SUP points, one is the top and the other is downstream. The SCCM infrastructure is operating in Native Mode and all WSUS synchronizations and configurations happen over HTTPS. The internal SUP (SKN01) is the site server and has a site system in the DMZ (DMZ01) which it uses as a SUP for [...]]]></description>
			<content:encoded><![CDATA[<p>I have two SCCM SUP points, one is the top and the other is downstream. The SCCM infrastructure is operating in Native Mode and all WSUS synchronizations and configurations happen over HTTPS.</p>
<p>The internal SUP (SKN01) is the site server and has a site system in the DMZ (DMZ01) which it uses as a SUP for external IBCM clients. I had a look at the system status a couple of days ago only to see the SMS_WSUS_CONFIGURATION_MANAGER component had gone critical with this message all over the place:</p>
<pre class="brush:perl">SMS_WSUS_CONFIGURATION_MANAGER Message ID: 6600

WSUS Configuration Manager failed to configure upstream server settings on WSUS Server "Internal".   
Possible cause: WSUS Server version 3.0 SP1 and above is not installed or cannot be contacted. 
Solution: Verify that the WSUS Server version 3.0 SP1 or greater is installed. Verify that the IIS ports configured in SMS are same as those configured on the WSUS IIS website.</pre>
<p>I looked at WCM.log to see exactly which server it is failing to configure. To reproduce the error I started and stopped the <strong>SMS_WSUS_CONFIGURATION_MANAGER</strong> component using the <strong>ConfigMgr Service Manager </strong>tool.</p>
<p><strong>WCM.log</strong> showed the initial connection to the primary SKN01 SUP as successful with a fairly odd .NET exception following:</p>
<pre class="brush:perl">System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---&gt;
System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.~~  
         at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)~~  
         at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)~~  
         at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)~~   at
...</pre>
<p>Basically, this meant that whatever WSUS server the primary was attempting to connect to (it wasn&#8217;t exactly specific&#8230;) was failing to negociate SSL and aborting. FYI, I used <strong>ProcMon.exe</strong> to figure out which WSUS server it was connecting to during the failure. It turns out it was DMZ01</p>
<p>This was odd because WSUS synchronization and configuration had worked for a while and seemingly overnight the certificate became invalid? Not likely. I checked the machine certificates and their trust chain and it all seemed in order on both servers.</p>
<p>I remembered that recently I was troubleshooting an issue with the Management Point and I had removed the <strong>Intranet FQDN</strong> from the site system in the DMZ (the IBCM SUP server, DMZ01).</p>
<p>It turns out all I had to do was enter the <strong>Intranet FQDN</strong> in the DMZ site system&#8217;s properties (DMZ01) and all was well. If you&#8217;re still experiencing issues after entering the FQDN, remove the SUP from the DMZ site and re-add it.</p>
<p>Who knew that removing this FQDN would cause the WSUS configuration to fail. I guess the internal SUP uses the supplied internal FQDN by the DMZ site system to validate the web server certificate supplied by WSUS.</p>
<p>So yeah.. make sure you configure both the Intranet and Internet FQDNs in the DMZ site system&#8217;s properties. Make sure they match the web server certificate&#8217;s SAN (Subject Alternative Name).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/infrastructure/sccm-wsus-configuration-manager-could-not-establish-trust-relationship-for-the-ssltls-secure-channel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BUG: Task Sequence editor fails to find the MDT Toolkit package if parent group is disabled</title>
		<link>http://blog.esmnetworks.com/operating-system-deployment/bug-task-sequence-editor-fails-to-find-the-mdt-toolkit-package-if-parent-group-is-disabled/</link>
		<comments>http://blog.esmnetworks.com/operating-system-deployment/bug-task-sequence-editor-fails-to-find-the-mdt-toolkit-package-if-parent-group-is-disabled/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 13:58:57 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Operating System Deployment]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mdt]]></category>
		<category><![CDATA[mdt 2010]]></category>
		<category><![CDATA[sccm]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[task sequence]]></category>
		<category><![CDATA[toolkit package]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=390</guid>
		<description><![CDATA[I&#8217;ve recently encountered an issue with an MDT integrated System Center Configuration Manager 2007 SP2 R3 installation. In a non-MDT task sequence, if you disable the parent group of the Use Toolkit Package step, the SCCM task sequence editor reports an error in locating the package: You can re-select the package from your list and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently encountered an issue with an MDT integrated System Center Configuration Manager 2007 SP2 R3 installation. In a <strong>non-MDT </strong>task sequence, if you disable the parent group of the <strong>Use Toolkit Package </strong>step, the SCCM task sequence editor reports an error in locating the package:</p>
<div id="attachment_391" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-391" href="http://blog.esmnetworks.com/operating-system-deployment/bug-task-sequence-editor-fails-to-find-the-mdt-toolkit-package-if-parent-group-is-disabled/attachment/sccm_task_sequence_package_error_bug2/"><img class="size-medium wp-image-391" title="SCCM Task Sequence MDT Package Not Found Error (BUG)" src="http://blog.esmnetworks.com/wp-content/uploads/2011/04/sccm_task_sequence_package_error_bug2-300x277.png" alt="SCCM Task Sequence MDT Package Not Found Error (BUG)" width="300" height="277" /></a><p class="wp-caption-text">SCCM Task Sequence MDT Package Not Found Error (BUG)</p></div>
<p>You can re-select the package from your list and the (X) goes away until you click Apply or re-open the TS editor.</p>
<p>Workaround: If you disable the &#8216;Use Toolkit Package&#8217; step itself, the package is found and there is no error reported by the editor:</p>
<div id="attachment_392" class="wp-caption alignnone" style="width: 310px"><a rel="attachment wp-att-392" href="http://blog.esmnetworks.com/operating-system-deployment/bug-task-sequence-editor-fails-to-find-the-mdt-toolkit-package-if-parent-group-is-disabled/attachment/sccm_task_sequence_package_error_working2/"><img class="size-medium wp-image-392" title="SCCM Task Sequence MDT Package Not Found Error (Workaround)" src="http://blog.esmnetworks.com/wp-content/uploads/2011/04/sccm_task_sequence_package_error_working2-300x276.png" alt="SCCM Task Sequence MDT Package Not Found Error (Workaround)" width="300" height="276" /></a><p class="wp-caption-text">SCCM Task Sequence MDT Package Not Found Error (Workaround)</p></div>
<p>This is not exactly a blocker and there is a quick and dirty workaround but may prove tedious on more complex task sequences.</p>
<p>I&#8217;ve experienced this issue on two separate System Center Configuration Manager 2007 SP2 R3 installations, both MDT 2010 Update1 integrated:</p>
<ul>
<li>Windows Server 2008 x86</li>
<li>Windows Server 2008 R2 x64</li>
</ul>
<p>Hope this helps&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/operating-system-deployment/bug-task-sequence-editor-fails-to-find-the-mdt-toolkit-package-if-parent-group-is-disabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly rename a large number of files with PowerShell and Regular Expressions</title>
		<link>http://blog.esmnetworks.com/planet-cdot/quickly-rename-a-large-number-of-files-with-powershell-and-regular-expressions/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/quickly-rename-a-large-number-of-files-with-powershell-and-regular-expressions/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 15:15:32 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Planet CDOT]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[mass rename]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[ps]]></category>
		<category><![CDATA[ps1]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[rename files]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=385</guid>
		<description><![CDATA[There have been a few times in the past where I&#8217;ve had to rename a large number of files for various reasons (ie: remove a common piece of text from the name) and I&#8217;ve always resorted to PowerShell. Piping dir into a where and matching the files I wanted to rename was effective but tedious. [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a few times in the past where I&#8217;ve had to rename a large number of files for various reasons (ie: remove a common piece of text from the name) and I&#8217;ve always resorted to PowerShell.</p>
<p>Piping <strong>dir</strong> into a <strong>where</strong> and matching the files I wanted to rename was effective but tedious. Cue the mass_rename.ps1 script:</p>
<pre class="brush:bash">$ext = $args[0];
$dir = $args[1];

$what = $args[2];
$with = $args[3];

$whatif = $args[4];

$count = 0;

if ($args.length -lt 4) {
    write-host "Invalid parameters" -fore red;
    ""
    write-host "   .\mass_rename.ps1 &lt;ext&gt; &lt;dir&gt; &lt;what&gt; &lt;with&gt; [-whatif]";
    ""
    write-host " Example (don't do any replacing, -whatif):";
    write-host "   .\mass_rename.ps1 .docx c:\Documents 'version 1\.1' 'version 1.2' -whatif";
    ""
    exit 1;
}

ls -recurse -path $dir | ?{ ($_.name.endswith($ext)) -and ($_.name -imatch $what) } | %{
    if ($whatif -eq "-whatif") {
        write-host("whatif: '" + $_.fullname + "' -&gt; '" + ($_.name -ireplace $what,$with) + "'");
    }
    else {
        $from = $_.fullname;
        $to = ($_.name -ireplace $what,$with);
        mv -literalpath $from -destination ($_.directoryname + "\" + $to) -force;
        write-host "Renamed '$from' -&gt; '$to'" -fore yellow;
        $count++;
    }
}

write-host "Done. Processed $count files." -fore green</pre>
<p>The script will accept 4 parameters with an optional <em>-whatif </em>as the 5th. Fairly self explanatory with one mention: the <strong>&lt;what&gt;</strong> parameter is a regular expression. Keep this in mind when, for example, you are trying to match for a period (.) as you would have to escape it (as per the example usage).</p>
<p>The <strong>-whatif</strong> parameter will only output the before and after file names thout modifying the files themselves.</p>
<p>That&#8217;s it, set the execution policy and enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/quickly-rename-a-large-number-of-files-with-powershell-and-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange 2007 SMTP Send Connector on a port other than 25</title>
		<link>http://blog.esmnetworks.com/infrastructure/exchange-2007-smtp-send-connector-on-a-port-other-than-25/</link>
		<comments>http://blog.esmnetworks.com/infrastructure/exchange-2007-smtp-send-connector-on-a-port-other-than-25/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 16:22:40 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[ems]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[exchange 2007 sp1]]></category>
		<category><![CDATA[exchange management shell]]></category>
		<category><![CDATA[port 25]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[send connector]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=378</guid>
		<description><![CDATA[I&#8217;ve setup an Exchange 2007 SP1 server recently to sync with a few remote Exim POP/IMAP accounts, in order to provide push email to my new Windows Phone 7. After battling with certificate issues, I managed to sync the phone to the Exchange server with all of the accounts I wanted. Email was being pushed, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve setup an Exchange 2007 SP1 server recently to sync with a few remote Exim POP/IMAP accounts, in order to provide push email to my new Windows Phone 7. After battling with certificate issues, I managed to sync the phone to the Exchange server with all of the accounts I wanted. Email was being pushed, all was well. The only issue was.. sending email using the ActiveSync accounts on WP7. </p>
<p>By default Exchange 2007 does not relay messages to remote domains (@gmail.com, etc). You have to create a SMTP Send Connector for all domains (*, or specific domains if you wish) on the Hub Transport Role server. This is all well and good, however, my ISP blocks all outgoing connections to port 25. If you&#8217;re using the GUI to create this connector you wont have the option to modify this port number.</p>
<p>Say my connector name was &#8220;All Mail&#8221; I would type this in the Exchange Management Shell:</p>
<pre class="brush:bash">Set-SendConnector -id "All Email" -port 2525</pre>
<p>And that&#8217;s that. Exchange can talk to my Exim server and relay messages to the outside world.</p>
<p>To see the current port assigned to the &#8220;All Email&#8221; connector type in the Exchange Management Shell:</p>
<pre class="brush:bash">(Get-SendConnector -id "All Email").Port</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/infrastructure/exchange-2007-smtp-send-connector-on-a-port-other-than-25/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restoring /usr/bin with yum after accidental deletion</title>
		<link>http://blog.esmnetworks.com/planet-cdot/restoring-usrbin-with-yum-after-accidental-deletion/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/restoring-usrbin-with-yum-after-accidental-deletion/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 15:25:09 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Planet CDOT]]></category>
		<category><![CDATA[/usr/bin]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[makefile]]></category>
		<category><![CDATA[reinstall]]></category>
		<category><![CDATA[rhel6]]></category>
		<category><![CDATA[rm -rf]]></category>
		<category><![CDATA[rpmlint]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=370</guid>
		<description><![CDATA[I was recently writing a Makefile for cramfs, specifically the distclean and install sections. The installation would copy the program binaries to /usr/bin while the cleanup would remove them&#8230; simple enough right? I wrote a for loop to go through $(PROGS) and remove them from $(INSTLOC): INSTLOC = /usr/bin PROGS = mkcramfs cramfsck all: $(PROGS) [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently writing a Makefile for <a href="http://sourceforge.net/projects/cramfs/" target="_blank">cramfs</a>, specifically the <em>distclean </em>and <em>install </em>sections. The installation would copy the program binaries to <strong>/usr/bin</strong> while the cleanup would remove them&#8230; simple enough right?</p>
<p>I wrote a <strong>for </strong>loop to go through $(PROGS) and remove them from $(INSTLOC):</p>
<pre class="brush:bash">INSTLOC = /usr/bin
PROGS = mkcramfs cramfsck

all: $(PROGS)

distclean clean:
    for p in $(PROGS);\
    do\
        rm -rf $$p $(INSTLOC)/$$p;\
    done

install:
    cp $(PROGS) $(INSTLOC)
</pre>
<p>The problem was that I ran this as root (tsk tsk), and since Makefile requires that<strong> for</strong> loop variables be escaped (line 9: $$p not $p), the <strong>rm</strong> command translated to this:</p>
<pre class="brush:bash">rm -rf  /usr/bin/
</pre>
<p>Great! So now I had no binaries in<strong> /usr/bin</strong>, which includes: yum, bash, crontab, python, perl&#8230; (800+ in total on a minimal install).</p>
<p>Since I only deleted the binaries, the programs were still listed as installed in the RPM database. The first thing I had to do was reinstall <strong>yum</strong> and it&#8217;s &#8220;usrbin&#8221; dependency <strong>python</strong>:</p>
<pre class="brush:bash">[root@demon ~]# mount /dev/sr0 /media/cdrom
[root@demon ~]# cd /media/cdrom/Packages
[root@demon ~]# rpm -Uvh --force python-2.6.5-3.el6.i686.rpm
[root@demon ~]# rpm -Uvh --force yum-3.2.27-14.el6.noarch.rpm
</pre>
<p>The next step was to figure out which packages had binaries in <strong>/usr/bin</strong> so I can reinstall them:</p>
<pre class="brush:bash">[root@demon ~]# rpm -qf $(rpm -qla|grep ^/usr/bin)|uniq|sort
</pre>
<p>&#8230; and finally send those to <strong>yum </strong>to do a reinstall and get the binaries back:</p>
<pre class="brush:bash">[root@demon ~]# yum reinstall $(rpm -qf $(rpm -qla|grep ^/usr/bin)|uniq|sort)
[root@demon ~]# ls -la /usr/bin|wc -l
848
[root@demon ~]#
</pre>
<p>&#8230; crisis averted! Snapshot time.</p>
<p>One last note: If you manually installed third party RPMs (not listed in the <strong>/etc/yum.repos.d</strong> repositories), they will not be reinstalled. You can perform reinstall these one by one using the <strong>rpm -Uvh</strong> command above. Keep in mind that if these RPMs have not undergone proper QA they may overwrite your current configuration files</p>
<p>You can run these RPMs through <strong>rpmlint</strong> to see if they produce any warnings or errors that may cause a problem when reinstalling:</p>
<pre class="brush:bash">[root@demon ~]# rpmlint -iv iplog-2.2.1-1_RH7.i386.rpm
...
iplog.i386: W: conffile-without-noreplace-flag /etc/iplog.conf
A configuration file is stored in your package without the noreplace flag. A
way to resolve this is to put the following in your SPEC file:
%config(noreplace) /etc/your_config_file_here
...
[root@demon ~]#
</pre>
<p>Goodluck!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/restoring-usrbin-with-yum-after-accidental-deletion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Identify and block malicious HTTP traffic with IPtables</title>
		<link>http://blog.esmnetworks.com/planet-cdot/block-bad-http-traffic-with-iptables/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/block-bad-http-traffic-with-iptables/#comments</comments>
		<pubDate>Sun, 26 Dec 2010 14:43:34 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Planet CDOT]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[badht]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[redhat enterprise linux]]></category>
		<category><![CDATA[rhel6]]></category>
		<category><![CDATA[w00tw00t.at.blackhats.romanian.anti-sec:]]></category>
		<category><![CDATA[w00tw00t.at.ISC.SANS.DFind:]]></category>
		<category><![CDATA[ZmEu]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=349</guid>
		<description><![CDATA[So I was looking through my webservers&#8217; access_log files and this popped up every couple of days: 93.157.0.142 - - [14/Dec/2010:16:01:19 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13 72.167.164.72 - - [17/Dec/2010:02:02:54 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13 74.55.205.98 - - [18/Dec/2010:03:06:49 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13 150.217.19.5 - - [19/Dec/2010:14:36:52 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" [...]]]></description>
			<content:encoded><![CDATA[<p>So I was looking through my webservers&#8217; access_log files and this popped up every couple of days:</p>
<pre class="brush:perl">93.157.0.142 - - [14/Dec/2010:16:01:19 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13
72.167.164.72 - - [17/Dec/2010:02:02:54 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13
74.55.205.98 - - [18/Dec/2010:03:06:49 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13
150.217.19.5 - - [19/Dec/2010:14:36:52 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13
173.201.39.105 - - [21/Dec/2010:08:16:35 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13
74.55.205.98 - - [24/Dec/2010:14:43:28 -0500] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 13</pre>
<p>This is a truncated list, but each one of these &#8220;romanian blackhats&#8221; would attempt a few other directories as well. These are not really critical intrusion attempts but they do indicate drones that scan the Internet for potential security holes in webservers (read Phil&#8217;s <a href="http://www.philriesch.com/articles/2010/07/getting-a-little-sick-of-zmeu/" target="_blank">Getting A Little Sick of ZmEu</a>). I don&#8217;t want these hosts to access my server in any way since, well, they don&#8217;t really need to. I could&#8217;ve blocked each one of those IPs by hand but I decided to script it and crontab it.</p>
<p>The first thing I needed is a chain that would handle all of these bad IP addresses:</p>
<pre class="brush:bash">[root@demon ~]# iptables -N bad_traffic
[root@demon ~]# iptables -A INPUT -j bad_traffic
[root@demon ~]# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT</pre>
<p>The two rules should be applied in the order specified above. You want to <strong>DROP</strong> bad traffic before you <strong>ACCEPT </strong>any web connection.</p>
<p>This script will add a rule for each IP with the <strong>DROP </strong>target in the <em>bad_traffic</em> chain, if it is not already in the chain:</p>
<pre class="brush:perl">#!/usr/bin/env perl
# badht - Bad HTTP Traffic blocker
#
# Scans an Apache access log file for bad
# requests and blocks the IP responsible
#
# Usage: badht &lt;access_log&gt; [iptables_chain]
#
# ./badht /var/log/httpd/access_log bad_traffic
#
# badht will use the chain 'bad_traffic' unless
# otherwise specified

use strict;
use warnings;
use POSIX qw(strftime);

die("Usage: $0 &lt;/var/log/httpd/access_log&gt; [iptables_chain]") if !$ARGV[0];
my $log = $ARGV[0];

my $chain = ($ARGV[1] ? $ARGV[1] : "bad_traffic");

my @bad = `grep w00tw00t $log|cut -f1 -d" "|sort -u`;
my @ablk = `/sbin/iptables -S $chain|grep DROP|awk '{print \$4}'|cut -d"/" -f1`;

foreach my $ip (@bad) {
    if (!grep $_ eq $ip, @ablk) {
        chomp $ip;
        `/sbin/iptables -A $chain -s $ip -j DROP`;
        print strftime("%b %d %T",localtime(time))." badht: blocked bad HTTP traffic from: $ip\n";
    }
}</pre>
<p>By the way, it&#8217;s a good idea to block ALL incoming traffic (line 29) coming from these IP addresses because chances are they have already attempted to brute-force your SSH service:</p>
<pre class="brush:bash">[root@demon admin]# grep -E "sshd.*Failed password for.*from ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)" /var/log/secure|wc -l
103
[root@demon admin]#</pre>
<p>&#8230; within just 7 days of bringing demon.* online! These packets are just wasted CPU cycles from compromised hosts and they should be dropped before they get to any of my services.</p>
<p>Anyway&#8230; when I execute <strong>badht </strong>I get this output:</p>
<pre class="brush:bash">[root@demon admin]# ./badht /var/log/httpd/access_log bad_traffic
Dec 25 15:56:44 badht: blocked bad HTTP traffic from: 150.217.19.5
Dec 25 15:56:44 badht: blocked bad HTTP traffic from: 173.201.39.105
Dec 25 15:56:44 badht: blocked bad HTTP traffic from: 72.167.164.72
Dec 25 15:56:44 badht: blocked bad HTTP traffic from: 74.55.205.98
Dec 25 15:56:44 badht: blocked bad HTTP traffic from: 93.157.0.142
[root@demon admin]# ./badht /var/log/httpd/access_log bad_traffic
[root@demon admin]# iptables -L bad_traffic -n
Chain bad_traffic (1 references)
target     prot opt source               destination
DROP       all  --  150.217.19.5         0.0.0.0/0
DROP       all  --  173.201.39.105       0.0.0.0/0
DROP       all  --  72.167.164.72        0.0.0.0/0
DROP       all  --  74.55.205.98         0.0.0.0/0
DROP       all  --  93.157.0.142         0.0.0.0/0
[root@demon admin]#</pre>
<p>As you can see the second time I ran the script it skipped the already-blocked IPs and said nothing.</p>
<p>I don&#8217;t want to run this manually, so I&#8217;ll let crontab handle it:</p>
<pre class="brush:bash">[root@demon ~]# crontab -lu root
*/30 * * * * ~/admin/badht /var/log/httpd/access_log bad_traffic &gt;&gt; /var/log/bad_traffic 2&gt;&amp;1
[root@demon ~]#</pre>
<p>&#8230; this will run twice an hour and send all output to <strong>/var/log/bad_traffic</strong>. You can increase the frequency but you should keep in mind that this may needlessly slow the system down on large access_log files.</p>
<p><strong>Note:</strong> The rules created by <strong>badht </strong>are temporary and will be lost on system reboot or when the iptables &#8216;service&#8217; is restarted. Remember to periodically save the iptables rules, or at least the &#8216;bad_traffic&#8217; chain. Since the crontab is persistant, <strong>badht </strong>will recreate all the rules the next time it runs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/block-bad-http-traffic-with-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SETroubleshoot mail notification on SELinux denial</title>
		<link>http://blog.esmnetworks.com/planet-cdot/setroubleshoot-mail-notification-on-selinux-denial/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/setroubleshoot-mail-notification-on-selinux-denial/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 21:13:40 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Planet CDOT]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[email alert]]></category>
		<category><![CDATA[redhat enterprise linux]]></category>
		<category><![CDATA[rhel6]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[setroubleshoot]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=336</guid>
		<description><![CDATA[I&#8217;ve recently installed setroubleshoot-server on my RHEL6 server to help diagnose various SELinux denials as I attempt to secure the box. SETroubleshoot also has an email notification system that is really easy to implement. There are a couple of things that you should consider before going forward. Add the recipient email addresses to /var/lib/setroubleshoot/email_alert_recipients: admin@example.com       [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently <a title="Installing SETroubleshoot on RHEL6" href="http://blog.esmnetworks.com/planet-cdot/selinuxs-setroubleshoot-install-on-a-rhel6-server/" target="_self">installed setroubleshoot-server</a> on my RHEL6 server to help diagnose various SELinux denials as I attempt to secure the box.</p>
<p>SETroubleshoot also has an email notification system that is really easy to implement. There are a couple of things that you should consider before going forward.</p>
<p>Add the recipient email addresses to <em>/var/lib/setroubleshoot/email_alert_recipients</em>:</p>
<pre class="brush: plain">admin@example.com       filter_type=after_first
</pre>
<p><strong>Note:</strong> the &#8216;after_first&#8217; filter will prevent setroubleshoot from flooding your inbox with the same alert. There are other filter types, see the man page.</p>
<p>&#8230;and finally modify the <strong>[email]</strong> section in <em>/etc/setroubleshoot/setroubleshoot.cfg</em>:</p>
<pre class="brush: bash">[email]
# recipients_filepath: Path name of file with email recipients. One address
# per line, optionally followed by enable flag. Comment character is #.
recipients_filepath = /var/lib/setroubleshoot/email_alert_recipients

# smtp_port: The SMTP server port
smtp_port = 2525

# smtp_host: The SMTP server address
smtp_host = mail.example.com

# from_address: The From: email header
from_address = security@demon.local
</pre>
<p>In my case, my MTA is listening on port 2525 as well as port 25, due to most ISPs blocking 25. The RHEL6 server is behind such an ISP and I had to use this as the mail port.</p>
<p>By default, SELinux allows only a short list of ports to be used by the SMTP protocol, and when setroubleshoot tried to send the alert, I saw this in<em> /var/log/messages</em>:</p>
<pre class="brush:plain">Dec 14 16:41:58 demon setroubleshoot: [avc.ERROR] Plugin Exception httpd_bad_labels #012Traceback (most recent call last):#012  File "/usr/lib/python2.6/site-packages/setroubleshoot/analyze.py", line 156, in analyze_avc#012    report_receiver.report_problem(report)#012  File "/usr/lib/python2.6/site-packages/setroubleshoot/server.py", line 195, in report_problem#012    email_alert(siginfo, to_addrs)#012  File "/usr/lib/python2.6/site-packages/setroubleshoot/email_alert.py", line 77, in email_alert#012    smtp = smtplib.SMTP(smtp_host, smtp_port)#012  File "/usr/lib/python2.6/smtplib.py", line 239, in __init__#012    (code, msg) = self.connect(host, port)#012  File "/usr/lib/python2.6/smtplib.py", line 295, in connect#012    self.sock = self._get_socket(host, port, self.timeout)#012  File "/usr/lib/python2.6/smtplib.py", line 273, in _get_socket#012    return socket.create_connection((port, host), timeout)#012  File "/usr/lib/python2.6/socket.py", line 514, in create_connection#012    raise error, msg#012error: [Errno 13] Permission denied</pre>
<p>&#8230;which basically means that the <strong>email_alert.py</strong> setroubleshoot script could not create an SMTP connection to my mail server on the port specified.</p>
<p>On RHEL6, these are the allowed SMTP ports:</p>
<pre class="brush:bash">[root@demon ~]# semanage port -l|grep smtp
smtp_port_t                    tcp      25, 465, 587
</pre>
<p>In order to allow demon.* to send mail to the remote MTA, I had to:</p>
<pre class="brush:bash">[root@demon ~]# semanage port -a -t smtp_port_t -p tcp 2525
[root@demon ~]# semanage port -l|grep smtp
smtp_port_t                    tcp      2525, 25, 465, 587
</pre>
<p>And that&#8217;s it! You can quickly test by <a href="http://blog.esmnetworks.com/planet-cdot/selinuxs-setroubleshoot-install-on-a-rhel6-server/#generate_denial" target="_blank">generating an SELinux denial</a>, and see if you get an email.</p>
<p>In my case, the remote MTA (running Exim) was dropping the messages and setroubleshoot would throw this in <em>/var/log/messages</em>:</p>
<pre class="brush: bash">Dec 17 09:53:19 demon setroubleshoot: [email.ERROR] email failed: {'admin@example.com': (550, 'Verification failed for &lt;security@demon.local&gt;\nThe mail server could not deliver mail to security@demon.local.  The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.\nSender verify failed')}</pre>
<p>This was due to Exim+SpamAssassin performing callbacks or callouts to ensure that the From: email address is valid on the mail server it comes from.</p>
<p>I got around this by adding the RHEL6 server&#8217;s IP block as a trusted &#8216;mail provider&#8217;. In <em>/etc/mailproviders/ </em>on the Exim server, I created the following tree:</p>
<pre class="brush: bash">root@exim [/etc/mailproviders]# tree
|-- rim
|   `-- ips
`-- demon
    `-- ips

2 directories, 2 files
root@exim [/etc/mailproviders]# cat demon/ips
172.16.1.0/24
root@exim [/etc/mailproviders]#
</pre>
<p>The <em>ips </em>files contain a list of IP blocks for Exim to trust as &#8216;mail providers&#8217; and add to the whitelist. This is probably not the safest solution but it is the quickest.</p>
<p><strong>Warning:</strong> if you don&#8217;t trust the entire IP block you can open your MTA to unchallenged spam. Use this method with caution.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/setroubleshoot-mail-notification-on-selinux-denial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux’s setroubleshoot install on a RHEL6 server</title>
		<link>http://blog.esmnetworks.com/planet-cdot/selinuxs-setroubleshoot-install-on-a-rhel6-server/</link>
		<comments>http://blog.esmnetworks.com/planet-cdot/selinuxs-setroubleshoot-install-on-a-rhel6-server/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 18:56:38 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Planet CDOT]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[audisp]]></category>
		<category><![CDATA[audit]]></category>
		<category><![CDATA[redhat enterprise linux]]></category>
		<category><![CDATA[rhel6]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[setroubleshoot]]></category>

		<guid isPermaLink="false">http://blog.esmnetworks.com/?p=324</guid>
		<description><![CDATA[I am planning on using RHEL6 as a web server, primarily for my Mercurial/GIT repositories. This was to replace my current Fedora13 instance. After the initial minimal install, there were a couple of things I&#8217;ve wanted but were not setup. Mainly setroubleshoot and mail notification on AVC denial. During my F13 repository setup, I had [...]]]></description>
			<content:encoded><![CDATA[<p>I am planning on using RHEL6 as a web server, primarily for my Mercurial/GIT repositories. This was to replace my current Fedora13 instance. After the initial <em>minimal</em> install, there were a couple of things I&#8217;ve wanted but were not setup. Mainly setroubleshoot and mail notification on AVC denial.</p>
<p>During my F13 repository setup, I had to turn on a few SELinux booleans in order for HG to successfully serve my repositories. Apache was spitting out forbidden errors, and I suspected SELinux as the culprit. This was to be expected, however, unlike the F13 box there were no setroubleshoot messages in <em>/var/log/messages</em>. You know.. the ones with the friendly &#8216;sealert -l [hash]&#8216; and whatnot.</p>
<p>Everything was going to<em> /var/log/audit/audit.log</em> and written in a slightly less readable format. After going through <a href="http://danwalsh.livejournal.com" target="_blank">Dan Walsh</a>&#8216;s blog, I&#8217;ve noticed I was missing the setroubleshoot-* packages. In a server environment (that is, no desktop) I only need to install <strong>setroubleshoot-server</strong> (and its deps) in order to get the cool descriptive SELinux audit messages.</p>
<p>Sample /var/log/audit/audit.log AVC denials:</p>
<pre class="brush:bash">[root@demon ~]# grep AVC /var/log/audit/audit.log
...
/var/log/audit/audit.log:type=AVC msg=audit(1292588343.092:3941): avc:  denied  { getattr } for  pid=2295 comm="httpd" path="/home/hg" dev=dm-3 ino=130823 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir
/var/log/audit/audit.log:type=AVC msg=audit(1292588361.410:3942): avc:  denied  { search } for  pid=4945 comm="httpd" name="hg" dev=dm-3 ino=130823 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir
/var/log/audit/audit.log:type=AVC msg=audit(1292588361.410:3943): avc:  denied  { getattr } for  pid=4945 comm="httpd" path="/home/hg" dev=dm-3 ino=130823 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir
...
</pre>
<p>So I went ahead and installed the setroubleshoot-server RPMs, but I was still not getting anything friendly in <em>/var/log/messages</em>.<br />
<a name="generate_denial"></a><br />
By the way, if you want to generate some SELinux denials you can try this command:</p>
<pre class="brush:bash">[root@demon ~]# sandbox /usr/bin/perl -e '`cat /dev/urandom`'
cat: /dev/urandom: Permission denied
</pre>
<p>The <strong>sandbox </strong>tool will run a binary in a paranoid domain, restricting it from accessing most objects in the system. Sandboxing is very cool and you should <a href="http://people.fedoraproject.org/~dwalsh/SELinux/Presentations/sandbox.pdf" target="_blank">read up on it</a>, especially if you&#8217;re running a web applications (<strong>hgweb </strong>in my case).</p>
<p>Starting with the Fedora 11 release date, Dan Walsh made a few changes to setroubleshoot to make it less of a memory hog. This meant that <strong>setroubleshootd </strong>was obsolete and replaced by <strong>sedispatch</strong>. This new binary was to be called by <strong>/sbin/audispd,<strong> </strong></strong>which is called by <strong>auditd </strong>as the dispatcher for AVC messages. SEDispatch would only start setroubleshootd if it was needed. In fact, if you try to run setroubleshootd manually, it will start, wait for about 10 seconds and exit with code 0.</p>
<p>To make sure <strong>sedispatch</strong> is functional, you can do something like this:</p>
<pre class="brush:bash">[root@demon ~]# grep AVC /var/log/audit/audit.log | sedispatch
...
Got Reply: AVC
Got Reply: AVC
...
[root@demon ~]#
</pre>
<p>You should now see the setroubleshoot messages in <em>/var/log/messages</em>.</p>
<p>It turns out all I had to do to get setroubleshoot to work was to restart the <strong>auditd</strong> service to make sure it picked up the newly installed <em>/etc/audisp/plugins.d/sedispatch.conf</em> plugin.</p>
<p>Besides the newbie-friendly sealert database, setroubleshoot can also <a href="http://blog.esmnetworks.com/planet-cdot/setroubleshoot-mail-notification-on-selinux-denial/" target="_blank">send email notifications</a> when denials happen. This is a fairly straightforward process, however I did run into a couple of issues. <a href="http://danwalsh.livejournal.com/" target="_blank">Dan Walsh</a> and the guys in <a href="irc://irc.freenode.org/selinux" target="_blank">#selinux@freenode</a> were nice enough to help me get it working.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.esmnetworks.com/planet-cdot/selinuxs-setroubleshoot-install-on-a-rhel6-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

