<?xml version="1.0"?>
<rdf:RDF
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:foaf="http://xmlns.com/foaf/0.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="http://planet.fedoraproject.org/security/">
	<title>Fedora security Planet</title>
    <link>http://planet.fedoraproject.org/security/</link>
        <description>Fedora People: http://planet.fedoraproject.org/security</description>
	<items>
		<rdf:Seq>
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2135" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2151" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2118" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2119" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/56179.html" />
			<rdf:li rdf:resource="http://mgrepl.wordpress.com/?p=204" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55837.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2092" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1990" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1905" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2036" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1975" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55588.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=2000" />
			<rdf:li rdf:resource="http://mgrepl.wordpress.com/?p=164" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55324.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1976" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55229.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54803.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1972" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54707.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1872" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1910" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54343.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54092.html" />
			<rdf:li rdf:resource="http://mgrepl.wordpress.com/?p=142" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53878.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53603.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53378.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1922" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53182.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1895" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1907" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1896" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52958.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1878" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52550.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52281.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52156.html" />
			<rdf:li rdf:resource="http://www.bress.net/blog/archives/203-guid.html" />
			<rdf:li rdf:resource="http://www.bress.net/blog/archives/204-guid.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/51942.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/51459.html" />
			<rdf:li rdf:resource="http://www.awe.com/mark/blog/20120221.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/51435.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1779" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1841" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1811" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/50980.html" />
			<rdf:li rdf:resource="http://adam.younglogic.com/?p=1753" />
		</rdf:Seq>
	</items>
</channel>

<item rdf:about="http://adam.younglogic.com/?p=2135">
	<title>Adam Young: Signed Authentication and Authorization</title>
    <link>http://adam.younglogic.com/2012/05/signed-authz-authn/</link>
	<content:encoded>&lt;p&gt;Openstack Keystone currently operates on-line validation for Tokens.  Once a token is issued out,  each of the systems presented with the token has to check the validity of the token with the Keystone server.  This makes Keystone the highest traffic service in an Openstack deployment.  Using Cryptographic Message Syntax (CMS) we can generated a token that can be verified using public key cryptography instead of making a network call.  Here’s a proof-of-concept example using the command line tools.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-2135&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For authorization, we need a user name.  For authentication, we need a tenancy and a set of roles that the user has in the tenancy.&lt;br /&gt;
Authorization cannot be for ever, so we need an expiration date/time.  Here is a simple JSON representation of that data.&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;{&quot;user&quot;: &quot;ayoung&quot;,
&quot;tenant&quot;: &quot;coop-city&quot;,
&quot;role&quot;: [&quot;hallmonitor, groundskeeper&quot;],
&quot;expiry&quot;:&quot;18JUL2012&quot;
}
&lt;/pre&gt;
&lt;p&gt;Note that it has the Roles listed in it.  By cryptographically verifying this document,  not only does it remove the need to validate the token with Keystone,  but it removes the need to go back to keystone to fetch the roles.  Thus, authentication and authorization information are linked in one document.&lt;/p&gt;
&lt;p&gt;The following assumes you have a signing certificate.  &lt;a href=&quot;http://adam.younglogic.com/2012/05/signing-certutil/&quot;&gt;See the steps here to generate one if you need it.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To Sign auth_token.json run:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cmsutil -S -d alias -N ayoung -i auth_token.json -o auth_token.p7s
&lt;/pre&gt;
&lt;p&gt;The signed message is put into auth_token.p7s,  a file extension that alludes to the PKCS 7 standard.&lt;/p&gt;
&lt;p&gt;This includes all of the certificates.  Use a tool to view the contents in human readable form:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; /usr/lib64/nss/unsupported-tools/derdump -i auth_token.p7s
&lt;/pre&gt;
&lt;p&gt;The output is big.  To simply read the message back, use:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cmsutil  -D -i auth_token.p7s  -d alias/ -h1
&lt;/pre&gt;
&lt;p&gt;This gives back the additional file, along with the validated signer:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;SMIME: 	level=1.2; type=signedData; nsigners=1;
		signer0.id=&quot;Adam Young&quot;; signer0.status=GoodSignature;
	level=1.1; type=data;
{&quot;user&quot;: &quot;ayoung&quot;,
&quot;tenant&quot;: &quot;coop-city&quot;,
&quot;role&quot;: [&quot;hallmonitor, groundskeeper&quot;],
&quot;expiry&quot;:&quot;18JUL2012&quot;
}
&lt;/pre&gt;
&lt;p&gt;To simply check if the document is valid,  drop the h1 argument.  If to test it against an NSS database that does not have the CA cert in it, you get:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;# cmsutil  -D -i auth_token.p7s  -d altdb

signer 0 status = SigningCertNotTrusted
cmsutil: problem decoding: Peer's Certificate issuer is not recognized.
&lt;/pre&gt;
&lt;p&gt;To make this usable as a replacement for the current token scheme,  we could use something like Base64 encoding:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[ayoung@ayoung cmstest]$ base64 auth_token.p7s
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAaCAJIAEbXsidXNl
ciI6ICJheW91bmciLCAgCiJ0ZW5hbnQiOiAiY29vcC1jaXR5IiwgIAoicm9sZSI6IFsiaGFsbG1v
bml0b3IsIGdyb3VuZHNrZWVwZXIiXSwKImV4cGlyeSI6IjE4SlVMMjAxMiIKfQoAAAAAAACgggIG
MIICAjCCAWugAwIBAgICCSkwDQYJKoZIhvcNAQEFBQAwFDESMBAGA1UEAxMJTXkgSXNzdWVyMB4X
DTEyMDUxNTIwNDcxNFoXDTEyMDgxNTIwNDcxNFowUzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAk1B
MREwDwYDVQQHEwhXZXN0Zm9yZDEPMA0GA1UEChMGUmVkSGF0MRMwEQYDVQQDEwpBZGFtIFlvdW5n
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7lNCEwdZMHIClZJ9f84R1tfgEjtZV2H+Nx1OR
eqeK+WYvVXSVJ61g/Vl3ponv8L/qRiqbuyP7Nfr7ogfM2OJuDOiWsyfHJSIS29NVOb5f6+oPw39Q
+fN7NSssTEr6UFz4d1mXl85iJXK+K7x5TGFQowA6po102YCj6tjesGPODQIDAQABoyQwIjAgBgNV
HSUBAf8EFjAUBggrBgEFBQcDBAYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEAt105m7XYBugD
y+PXYq7R2XaAdyJGCBl4yq3Xz3qmfYmpP8wVTNy5j2dacuopq+W4DB0CeGo5+sYGAiRSgF8vNx6/
wMt3+EExdJO+IJl9QMRB6ooRzSMJAIH3b3jXOWln9TV6AHLHER8NWoNZq3moSYp4fO8tUVgerDKJ
7TdBP/IxggFaMIIBVgIBATAaMBQxEjAQBgNVBAMTCU15IElzc3VlcgICCSkwCQYFKw4DAhoFAKCB
lzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMCMGCSqGSIb3DQEJBDEWBBRBECaXMyVVMoW2yonU
kWwriSqs5TApBgkrBgEEAYI3EAQxHDAaMBQxEjAQBgNVBAMTCU15IElzc3VlcgICCSkwKwYLKoZI
hvcNAQkQAgsxHKAaMBQxEjAQBgNVBAMTCU15IElzc3VlcgICCSkwDQYJKoZIhvcNAQEBBQAEgYAV
UCVEsgfo3SK5p5ZF98uWgoIjmyCksS7mULJMT/ZJZJqIyTVY6AmXWCgxzKOHqrzWCansSilYAYQr
aeEgCYjX9GvSxHFmCQQzYM2buzJr5GjoPZJ0osOulUzWX8Nzq5Y51DAcWtU8c+06Ezbu5q5YjBno
2fTEWwYcemr9m/SA7AAAAAAAAA==
&lt;/pre&gt;
&lt;p&gt;The break is due to how it is displayed in the browser,  but that is really one long stream of characters.  The value can be sent just like the current tokens, in the -X-Auth-Token header.  Now a remote service can validate the token by reversing the Base64 ENCODING AND using cmsutil or the corresponding APIs.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cat auth_token.p7s.base64  | base64 -d |  cmsutil  -D -i auth_token.p7s -d alias/
&lt;/pre&gt;
&lt;p&gt;There are still  a few wrinkles to iron out.  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The token is a little longer than it needs to be, due to the certificate being embedded.  For Keystone,  remote systems would be better off fetching the certificate once from the Keystone server,  and just matching the serial number in the CMS token.  &lt;/li&gt;
&lt;li&gt;The current scheme of using the token in the URL would probably not work very well with the long Base64 encoding above,  but that system has other known issues, and is likely to be replaced shortly with a scheme that will instead put the token into the body of the document.  However, even that step will be unnecessary with certificate based verification.&lt;/li&gt;
&lt;li&gt;Signing documents from Python currently requires calling out to additional processes. &lt;a href=&quot;https://bugzilla.redhat.com/show_bug.cgi?id=821971&quot; target=&quot;_blank&quot; title=&quot;Bug 821971 - Add support for document signing like cmsutil&quot;&gt;The Python-NSS maintainer is aware of the issue&lt;/a&gt;, and is looking into making a Python-appropriate set of bindings for the CMS calls in Python-NSS.&lt;/li&gt;
&lt;li&gt;Since there is no revocation of the tokens,  their lifespan should be kept short.  10-30 minutes is probably appropriate.  The default value will require some consensus&lt;/li&gt;
&lt;li&gt;Adding roles for a user will require getting an additional token.  The old token will still be valid,but will not allow the user to do any actions that require the new role.&lt;/li&gt;
&lt;li&gt;The code that checks roles does not currently know about the token.  It will require  a small amount of code changes to make sure that the token is available to this code.&lt;/li&gt;
&lt;li&gt;While this scheme is backwards compatible with the current auth scheme, the reverse is not true.  Short of checking the length of the token,  there is no way to confirm that a token is a cryptographically signed document as opposed to the alpha-numeric cookie in current usage.  One approach for transition may be to test reading the document, and, upon failure,  fall back to the online protocol.&lt;/li&gt;
&lt;/ul&gt;</content:encoded>
	<dc:date>2012-05-16T14:31:05+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=2151">
	<title>Adam Young: Generating a Signing Cert using certutil</title>
    <link>http://adam.younglogic.com/2012/05/signing-certutil/</link>
	<content:encoded>&lt;p&gt;Imagine a locked room with a big window.  If I am the only person with a key to room, and I tape a poster up inside the window,  everyone can read it,  and everyone can state with a pretty high degree of certainty that I was the person that I put up the poster.  This is analogy to how you can use  PKI to sign a document.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-2151&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In order for the message signature to be verifiable,  we generate a pair of keys, one that is kept private, and one that is made public.  Data encrypted with the private key can then be decrypted with only the corresponding public key.  So, to sign a message, it is encrypted with the private key.  &lt;/p&gt;
&lt;p&gt;There are ways to make this more efficient, such as signing a hash of the message,  but the principal is the same.&lt;/p&gt;
&lt;p&gt;I am going to use the same set of cryptographic tools that Mozilla provides for securing web traffic.  These tools fall under then name &lt;strong&gt;Network Security Services&lt;/strong&gt;  or NSS for short.&lt;/p&gt;
&lt;p&gt;The first step is to provide a Certificate Authority (CA) Certificate.  This is a certificate used to sign other certificates.  This is actually supposed to be part of a chain.  In the browser, there are a list of CA certs that are accepted by default.  For our purposes here,  I am going to self sign one.  Figuring out how to set this up for your organization has been left as an exercise to the reader.&lt;/p&gt;
&lt;p&gt;We need a place to put the certificate.  For NSS,  this is called an NSS database.  I am going to create one in a directory I call &lt;em&gt;alias&lt;/em&gt;, because that is the name of the NSS database used in Apache HTTPD. To generate:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;mkdir alias
certutil -N -d ./alias/
&lt;/pre&gt;
&lt;p&gt;Now create a self-signed CA certificate. Type the command:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;certutil -S -s &quot;CN=My Issuer&quot; -n myissuer -x -t &quot;C,C,C&quot; -1 -2 -5 -m 1234 -d alias/
&lt;/pre&gt;
&lt;p&gt;You will be prompted to type.  This is used to generate entropy, or randomness, for the underlying cryptography.&lt;/p&gt;
&lt;p&gt;Then you will be prompted to select aspects of the certificate.  A menu of options like this:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;		0 - Digital Signature
		1 - Non-repudiation
		2 - Key encipherment
		3 - Data encipherment
		4 - Key agreement
		5 - Cert signing key
		6 - CRL signing key
		Other to finish
&lt;/pre&gt;
&lt;p&gt;Type each number in order. 0 1 2 3 4 5 6. The menu will reappear after each.&lt;/p&gt;
&lt;p&gt;Yes, it is annoying.  I didn’t write the tool.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;then type any number to finish&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So the number 9 works.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; 9
Is this a critical extension [y/N]?
y
Is this a CA certificate [y/N]?
y
Enter the path length constraint, enter to skip [&amp;lt;0 for unlimited path]: &amp;gt;
Is this a critical extension [y/N]?
y
&lt;/pre&gt;
&lt;p&gt;Not done yet:  Next menu.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;		0 - SSL Client
		1 - SSL Server
		2 - S/MIME
		3 - Object Signing
		4 - Reserved for future use
		5 - SSL CA
		6 - S/MIME CA
		7 - Object Signing CA
		Other to finish
&lt;/pre&gt;
&lt;p&gt;For this we want 5 6 7  then again pick 9 to exit.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; &amp;gt; 9
Is this a critical extension [y/N]?
y
&lt;/pre&gt;
&lt;p&gt;The security conscious folks out there are squirming in their seats reading this,  because a self-signed CA cert is BAD under most circumstances.  However, this is proof-of-concept type stuff.  You always need to get a certificate signed by a CA…this is just the simple way to do it for development.&lt;/p&gt;
&lt;p&gt;Now that we have a CA cert,  we need to generate a Key. With NSS, you can generate the Key and the certificate signing request in one step:&lt;/p&gt;
&lt;pre class=&quot;bursh:bash&quot;&gt; certutil -R -s &quot;CN=Adam Young, O=RedHat , L=Westford, ST=MA, C=US&quot; -p &quot;617-555-1212&quot; -o mycert.req -d alias
&lt;/pre&gt;
&lt;p&gt;You see the same entropy generation prompt as before.&lt;/p&gt;
&lt;p&gt;You can list the keys using:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;certutil -K -d ./alias/
&lt;/pre&gt;
&lt;p&gt;Which produces output along the lines of:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;certutil: Checking token &quot;NSS Certificate DB&quot; in slot &quot;NSS User Private Key and Certificate Services&quot;
&amp;lt; 0&amp;gt; rsa      99f6d153a007f8fb2d79312d454749eb92e4db99   NSS Certificate DB:myissuer
&amp;lt; 1&amp;gt; rsa      b8472a65af1c2da900fb0eb953d9c278d615a580   NSS Certificate DB:ayoung
&lt;/pre&gt;
&lt;p&gt;Note that there is one in there for the CA certificate we produced before.&lt;/p&gt;
&lt;p&gt;To sign the key  run the following:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; certutil -C -m 2345 -i mycert.req -o mycert.crt -c myissuer -d ./alias/ -6
&lt;/pre&gt;
&lt;p&gt;Here is the menu you are presented:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;		0 - Server Auth
		1 - Client Auth
		2 - Code Signing
		3 - Email Protection
		4 - Timestamp
		5 - OCSP Responder
		6 - Step-up
		Other to finish
&lt;/pre&gt;
&lt;p&gt;The import options are 1 and 3, as we are going to use the same mechanism as we would use to sign email.  The private and public keys are held in the NSS database.  OK,  we finally have a useful certificate and key pair that we can use to sign a document.  To Sign auth_token.json run:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cmsutil -S -d alias -N ayoung -i signme.txt -o signed.p7s
&lt;/pre&gt;
&lt;p&gt;The signed message is put into signed.p7s.  The file extension alludes to the PKCS 7 standard that CMS grew out of.&lt;/p&gt;</content:encoded>
	<dc:date>2012-05-16T13:53:45+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=2118">
	<title>Adam Young: The Path to Kerberos over Port 443</title>
    <link>http://adam.younglogic.com/2012/05/path-to-kerberos-443/</link>
	<content:encoded>&lt;p&gt;While Kerberos’ reputation as a Single Sign On solution is quite strong, its adoption outside the corporate VPN has been limited. One reason is that many host providers block port 88 traffic in the firewalls. What would it take to make Kerberos a viable solution in a web-only constrained situation?&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-2118&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kerberos communicates over port 88 in order to secure tickets that will be used for authentication and (to a limited degree) authorization on other servers.  This communication is done using the Kerberos wire protocols.  First the user requests a ticket granting ticket (TGT).  Later, the user will use that TGT to get a ticket specific to the service they are trying to talk to.&lt;/p&gt;
&lt;p&gt;The connection to get the TGT is a two way street.  There are multiple messages and back and forth as both sides performs steps necessary to prove to the other that they are indeed,  who they claim to be.  This cannot be done over straight HTTP without serious reworking,  but it can be done using a techonology called &lt;a href=&quot;http://en.wikipedia.org/wiki/Websockets&quot; target=&quot;_blank&quot; title=&quot;Websockets&quot;&gt;websockets&lt;/a&gt;.  With websockets,  the connection between client and server remains open, and HTTP becomes a tunneling protocol for TCP.&lt;/p&gt;
&lt;p&gt;Thus, the two things we need to do to get a TGT are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt; Place the Key Distribution Center (KDC)  behind a &lt;a href=&quot;http://en.wikipedia.org/wiki/Websockets&quot; target=&quot;_blank&quot; title=&quot;Websockets&quot;&gt;websockets&lt;/a&gt; Proxy.&lt;/li&gt;
&lt;li&gt;Create a modified version of the kinit program that can talk websockets,  or build a client side proxy.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There are other approaches, of course.  FreeIPA can request a TGT on the server on behalf of the user.  The user could download this TGT, and a Browser plugin could even stick it into the Kerberos Credentials Cache.  But this bypasses the Kerberos ideal of the users password never crossing the wire.&lt;/p&gt;
&lt;p&gt;We could write the kinit code into the browser itself, using either a native extension or Javascript,  but it is a complicated enough of a protocol that forking from the C code would be a hefty maintenance effort.&lt;/p&gt;
&lt;p&gt;The second step is trickier:  getting the service ticket.  This action is performed for the user automatically when visiting a web site that is protected by, for example, mod_auth_krb.  The web server responds to a request with a 401 and enough information that the browser knows to try Kerberos…by way of two wrapper libraries called SASL and GSSAPI in turn.  Unfortunately,  this is a pipeline that is pretty much welded shut:  without modifying  either the browser or the Kerberos libraries,  there is no way to automatically request and inject a service ticket on behalf of the user.&lt;/p&gt;
&lt;p&gt;It would be possible for the user to do it explicitly, though.  That might be an OK stop-gap measure.  Again, a custom client of some sort could fetch the service ticket and push it into the Kerberos credential cache.&lt;/p&gt;
&lt;p&gt;I think the most straight forward path would be to :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Extend the Kerberos libraries to be able to talk Web Sockets as a tunnel for the Kerberos wire protocol.&lt;/li&gt;
&lt;li&gt;Allow a krb5.conf option that will specify that the KDC is reachable via websockets.  This would be something along the lines of an krb5.conf line&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;&lt;p&gt;kdc = wss://kerberos.younglogic.com/kdc&lt;/p&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;This value should also be available as a SRV record out of DNS:&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;&lt;p&gt;NAME: _kerberos._wss&lt;/p&gt;
&lt;p&gt;TYPE: SRV:&lt;/p&gt;
&lt;p&gt;VALUE:wss://kerberos.younglogic.com/kdc&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;As a simple proof of concept,  a websocket proxy can run on the client, listening on localhost:88 and talking via Websockets to the KDC.  Then the krb5.conf file can point to the local proxy instead of the KDC Websocket proxy.&lt;/p&gt;
&lt;p&gt;Websockets is a simple enough protocol that writing it into the Kerberos code base should not be prohibitive.  If desired,  it could be done as a separate shared object for the general consumption of the system.&lt;/p&gt;
&lt;p&gt;It is not necessary to run the TGT fetching code over wss,  the SSL version of web sockets, as the handshake already sets up encryption.  But there is no drawback to running the whole thing over SSL and it will mask any KDC traffice that is not encrypted.&lt;/p&gt;
&lt;p&gt;An additional advantage is that now kpasswd can be run on the same port as the rest of the KDC based services, just on a different URL.&lt;/p&gt;
&lt;p&gt;Since Websockets is supported by all the major browsers,  making browser plugins to communicate with the KDC is viable.&lt;/p&gt;
&lt;p&gt;There might well be other issues of scale:  protecting against DOS attacks and the like, but there is a path forward to a secure WebSSO.&lt;/p&gt;</content:encoded>
	<dc:date>2012-05-12T01:14:27+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=2119">
	<title>Adam Young: My Openstack Tasks</title>
    <link>http://adam.younglogic.com/2012/05/my-openstack-tasks/</link>
	<content:encoded>&lt;p&gt;Now that Folsom development has started in earnest,  I figured I’d follow &lt;a href=&quot;http://russellbryantnet.wordpress.com/2012/04/24/openstack-design-summit-and-an-eye-on-folsom/&quot; target=&quot;_blank&quot;&gt;Russell&lt;/a&gt;‘s example and write down a bit of my plan for work in the next couple of months.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-2119&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To date,  my involvement with Openstack has focused primarily on Keystone.  Using that as a starting point,  I want to continue it in two directions: deeper work on the identity management side, and expending HTTPD support beyond Keystone.&lt;/p&gt;
&lt;p&gt;First is working on the &lt;a href=&quot;https://blueprints.launchpad.net/keystone/+spec/pki&quot; title=&quot;PKI Blueprint&quot;&gt;Public Key Infrastructure (PKI) alternative to the Keystone Token architecture. &lt;/a&gt;In addition to implementing that blueprint,  I have agreed to work with &lt;a href=&quot;https://launchpad.net/~guang-yee&quot;&gt;gyee&lt;/a&gt; and &lt;a href=&quot;https://launchpad.net/~liemmn&quot;&gt;liemmn&lt;/a&gt; on making sure that the PKI work and the&lt;a href=&quot;https://blueprints.launchpad.net/keystone/+spec/access-key-authentication&quot;&gt; Key based authentication&lt;/a&gt; they are working on fit into an understandable narrative about the options available in Openstack.&lt;/p&gt;
&lt;p&gt;Of course,  my PKI work assumes web server support for PKI,  which, shortest path, is &lt;a href=&quot;http://adam.younglogic.com/2012/04/keystone-httpd/&quot;&gt;using HTTPD&lt;/a&gt;.  There is  code from that example that I need to review and commit.  In order for it to be usable,  I need to set up and run a proof of concept system where Glance, Nova and Horizon all use Keystone  from HTTPD.&lt;/p&gt;
&lt;p&gt;Once I’ve made that work,  I need to add support to &lt;a href=&quot;http://devstack.org/&quot; target=&quot;_blank&quot;&gt;devstack&lt;/a&gt; for it.&lt;/p&gt;
&lt;p&gt;A follow on set of tasks will involve HTTPD-ifying  Nova and Glance.  To prep to site for this work,  we are trying to establish a n &lt;a href=&quot;http://wiki.openstack.org/URLs&quot; target=&quot;_blank&quot;&gt;URL naming scheme for Openstack&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While testing the EPEL packages of Openstack, I noticed that we lacked support for the VNC viewer &lt;a href=&quot;https://github.com/kanaka/noVNC&quot; target=&quot;_blank&quot;&gt;noVNC&lt;/a&gt;.  I am working with &lt;a href=&quot;https://launchpad.net/~sleepsonthefloor&quot; target=&quot;_blank&quot;&gt;Anthony Young&lt;/a&gt; (no relation to me) to come up with a supportable packing format that will be accepted by the Debian and Fedora packaging standards.&lt;/p&gt;
&lt;p&gt;Longer term,  I want to be able to serve the noVNC javascript from Apache HTTPD, and talk back to HTTPD as well.  There are two alternatives here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use an &lt;a href=&quot;https://github.com/disconnect/apache-websocket&quot; target=&quot;_blank&quot; title=&quot;Apache Websockets&quot;&gt;Apache Websockets&lt;/a&gt; module and do it all in native code&lt;/li&gt;
&lt;li&gt;Add Websockets support to mod_wsgi.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;a href=&quot;http://code.google.com/p/pywebsocket/&quot; target=&quot;_blank&quot;&gt;Google code approach uses mod_python&lt;/a&gt;. However, mod_python is not actively maintained, so I think this code is not going to work long haul. Making it work in &lt;a href=&quot;http://www.mailinglistarchive.com/html/modwsgi@googlegroups.com/2010-04/msg00173.html&quot; target=&quot;_blank&quot;&gt;mod_wsgi has hurdles to overcome&lt;/a&gt;.  This leads me to favor the native approach as of now.  I have the Apache websocket module built as an RPM, and will continue toward integrating the VNC proxy in C as an additional module.&lt;/p&gt;</content:encoded>
	<dc:date>2012-05-03T02:15:22+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/56179.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part X - Firewalld</title>
    <link>http://danwalsh.livejournal.com/56179.html</link>
	<content:encoded>&lt;p&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/FirewallD&quot; rel=&quot;nofollow&quot;&gt;FirewallD is a service daemon with a D-BUS interface that provides a dynamic managed firewall.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It will be the default firewall in Fedora 18, but will be available to run in Fedora 17.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NOTE:  I was informed that this feature was supposed to be default in Fedora 17, but has been decided to wait until Fedora 18.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The problem with the previous firewall model was that it was static, you would need to basically reload the firewall rules any time you made a change, and this would break established connections.  This is a real problem for virtualization (libvirt), since you might be changing your firewall often bringing up and down virtual machines.  FirewallD provides a daemon that applications can talk to over DBUS, to request modifications to firewall rules. &lt;br /&gt;&lt;br /&gt;Another nice feature would be to allow a user to have rules that control firewall rules depending on the wireless network to which they connect.  For example NetworkManager could come up with a question of whether this is the Home Network, Work Network or Public Network.   Firewall rules might allow Avahi to connect if you are on a Home or Work network but not a Public Network.&lt;br /&gt;&lt;br /&gt;In the future I would like to add make FirewallD a SELinux Userpace Manager.  This would allow a policy writer could to control which applications are able to manipulate firewall rules pertaining to which ports.  Something like&lt;br /&gt;&lt;br /&gt;allow cupsd_t cups_port_t:tcp_firewall { open close };&lt;/p&gt;</content:encoded>
	<dc:date>2012-04-25T12:37:48+00:00</dc:date>
</item>
<item rdf:about="http://mgrepl.wordpress.com/?p=204">
	<title>Miroslav Grepl: How do we do selinux-policy updates?</title>
    <link>http://mgrepl.wordpress.com/2012/04/24/how-do-we-do-selinux-policy-updates/</link>
	<content:encoded>&lt;p&gt;Sometimes I get questions how we do selinux-policy updates. How does the process go?&lt;/p&gt;
&lt;p&gt;We go through all new bugs &lt;strong&gt;every day&lt;/strong&gt; in the morning. So there are two periods per day because Dan is from USA and I am from Czech Republic.&lt;/p&gt;
&lt;p&gt;We add appropriate fixes to the selinux-policy repo on &lt;a href=&quot;http://git.fedorahosted.org/git/?p=selinux-policy.git&quot;&gt;fedorahosted.org&lt;/a&gt; first and then we commit changes also to the selinux-policy git repo on &lt;a href=&quot;http://pkgs.fedoraproject.org/gitweb/?p=selinux-policy.git&quot;&gt;fedoraproject.org&lt;/a&gt;. But this does not mean we do a new build immediately. The main reason is we want to cover as much bugs by a build as possible. So we do a new build either at the end of the day or the next day. Of course if a build is required we do it when is needed.&lt;/p&gt;
&lt;p&gt;Also we are not able to do a new update with an each build. In this case, you can easily download new builds from &lt;a href=&quot;http://koji.fedoraproject.org/koji/packageinfo?packageID=32&quot;&gt;koji&lt;/a&gt; and install them. So if you see&lt;/p&gt;
&lt;p&gt;&lt;em&gt;“Fixed in selinux-policy-&amp;lt;version&amp;gt;”&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;as a comment in a bug, you get a new build very soon. If not, then I have overslept and just ping me. I would like to thank all for testing/using a new builds from koji.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/comments/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/delicious/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/facebook/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/twitter/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/stumble/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/digg/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/mgrepl.wordpress.com/204/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/reddit/mgrepl.wordpress.com/204/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;img src=&quot;http://stats.wordpress.com/b.gif?host=mgrepl.wordpress.com&amp;amp;blog=26699041&amp;amp;post=204&amp;amp;subd=mgrepl&amp;amp;ref=&amp;amp;feed=1&quot; alt=&quot;&quot; height=&quot;1&quot; border=&quot;0&quot; width=&quot;1&quot; /&gt;</content:encoded>
	<dc:date>2012-04-24T22:52:31+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55837.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part IX - File Name Transitions</title>
    <link>http://danwalsh.livejournal.com/55837.html</link>
	<content:encoded>&lt;a href=&quot;http://danwalsh.livejournal.com/46018.html&quot;&gt;File Name Transitions were introduced to the kernel in Fedora 16 by Eric Paris.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Eric actually expected policy writers to only add a few dozen file name transition rules, well in Fedora 17 we now have nearly 100,000 rules:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;sesearch -T /etc/selinux/targeted/policy/policy.27 | grep \&quot; | wc -l&lt;br /&gt;94736&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Most of these rules are to make devices created in /dev and files/directories created by the unconfined/admin processes be labelled correctly.  A common problem users of SELinux have seen was when an unconfined_t user creating /root/.ssh or $HOME/.ssh.  Then they would place authorization content in the directory.  When they tried to use the content to gain access to the system via sshd, sshd would be blocked from the directory by SELinux because the directory and its contents had the wrong label.  The user needs to run &lt;span style=&quot;color: #0000ff;&quot;&gt;restorecon -R -v /root/.ssh&lt;/span&gt; to fix the labels.&lt;br /&gt;&lt;br /&gt;Before File Name Transitions the directory would be created with the label based on the label of /root, admin_home_t.   But as of Fedora 16 Policy Writers write rules that say:  &quot;If the &lt;span style=&quot;color: #0000ff;&quot;&gt;unconfined_t&lt;/span&gt; user creates a &lt;span style=&quot;color: #0000ff;&quot;&gt;directory&lt;/span&gt; named &lt;span style=&quot;color: #0000ff;&quot;&gt;.ssh&lt;/span&gt; in a directory labelled &lt;span style=&quot;color: #0000ff;&quot;&gt;admin_home_&lt;/span&gt;t, it will get created as &lt;span style=&quot;color: #0000ff;&quot;&gt;ssh_home_t&lt;/span&gt;.&quot;&lt;br /&gt;&lt;br /&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;type_transition unconfined_t admin_home_t : dir ssh_home_t &quot;.ssh&quot;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How is this a security feature?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/43170.html&quot;&gt;I explained in a previous blog, there are three ways content gets labeled within a directory.&lt;/a&gt;  The File Transition rule is a mechanism the policy writer has used since SELinux was first developed to create content within a directory with a different label then the directories label.  Policy writers wrote rules that said if a process running as &lt;span style=&quot;color: #0000ff;&quot;&gt;NetworkManager_t&lt;/span&gt; created a &lt;span style=&quot;color: #0000ff;&quot;&gt;file&lt;/span&gt; in a directory labeled &lt;span style=&quot;color: #0000ff;&quot;&gt;etc_t&lt;/span&gt; it would be labeled &lt;span style=&quot;color: #0000ff;&quot;&gt;net_conf_t.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;type_transition NetworkManager_t etc_t : file net_conf_t; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Or if a process running as &lt;span style=&quot;color: #0000ff;&quot;&gt;mozilla_t &lt;/span&gt;created a &lt;span style=&quot;color: #0000ff;&quot;&gt;directory&lt;/span&gt; in a directory labeled &lt;span style=&quot;color: #0000ff;&quot;&gt;user_home_dir_t&lt;/span&gt;, it would get created as &lt;span style=&quot;color: #0000ff;&quot;&gt;mozilla_home_t&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;  type_transition mozilla_t user_home_dir_t : dir mozilla_home_t;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But this is not very fine grained control.  A hacked NetworkManager could create any file in a any directory labeled etc_t, if it did not exist.  If /etc/passwd did not exist for some reason SELinux would not block a confined NetworkManager from creating its own /etc/passwd.  A hacked firefox running as mozilla_t would not be blocked from creating a missing $HOME/.ssh directory.&lt;br /&gt;&lt;br /&gt;With File Name Transition rules, policy writers can now specify the file name.  Meaning we can writer finer grained control.  We can say NetworkManager can only create the &quot;resolv.conf&quot; file in a directory labeled etc_t or a   confined firefox can only create the .mozilla directory in a users home directory&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/54092.html&quot;&gt;As an example of this the Thumbnail confinement added in Fedora 17 has:&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;type_transition thumb_t user_home_dir_t : file thumb_home_t &quot;missfont.log&quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir thumb_home_t &quot;.thumbnails&quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &quot;.gstreamer-12&quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &quot;.gstreamer-10&quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &quot;.gstreamer-0.10&quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &quot;.gstreamer-0.12&quot;; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Which means thumbnailers running as thumb_t can only create a file labelled missfont.log or directories labeled .thumbnails or .gstreamer-* in the home directory.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: larger;&quot;&gt;Nice job Eric, you increased the Security of SELinux and made it easier to use at the same time!&lt;/span&gt;</content:encoded>
	<dc:date>2012-04-24T14:12:18+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=2092">
	<title>Adam Young: Array of Parameter Names in Java</title>
    <link>http://adam.younglogic.com/2012/04/array-param-names/</link>
	<content:encoded>&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/2012/04/parameter-names-in-java/&quot;&gt; My last post suggested an extension to the Java language&lt;/a&gt; that I think will be quite helpful.  Until such a feature exists,  we can fake it by using annotations.&lt;br /&gt;
&lt;span id=&quot;more-2092&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I created an annotation with a processor that creates a new class, one the contains a single static instance of an array of the parameter names from the constructor.&lt;/p&gt;
&lt;p&gt;All code on this page released under the same license as the OpenJDK Libraries: GPL with the classpath exception.&lt;/p&gt;
&lt;p&gt;First, the annotation itself.&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;package com.younglogic.annote;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.CONSTRUCTOR)
@Retention(RetentionPolicy.RUNTIME)
public @interface NamedParameters {

}
&lt;/pre&gt;
&lt;p&gt;Next the annotation processor.  This uses the javac API,  which really should become part of the Base Java platform.  In order to compile I added &lt;em&gt;/usr/lib/jvm/java-1.7.0/lib/tools.jar&lt;/em&gt;  to the classpath.&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;package com.younglogic.annote;

import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.tools.JavaFileObject;

import com.sun.tools.javac.code.Symbol.ClassSymbol;
import com.sun.tools.javac.code.Symbol.MethodSymbol;
import com.sun.tools.javac.code.Symbol.VarSymbol;

@SupportedAnnotationTypes(value = { &quot;com.younglogic.annote.NamedParameters&quot; })
@SupportedSourceVersion(SourceVersion.RELEASE_7)
public class NamedParametersAnnotationProcessor extends AbstractProcessor {

	@Override
	public boolean process(Set annotations,
			RoundEnvironment roundEnv) {
		for (TypeElement element : annotations) {
			for (Element constructor : roundEnv
					.getElementsAnnotatedWith(element)) {

				ClassSymbol classSymbol = (ClassSymbol) constructor
						.getEnclosingElement();
				PackageElement packageElement = (PackageElement) classSymbol
						.getEnclosingElement();

				JavaFileObject jfo;
				try {
					jfo = processingEnv.getFiler().createSourceFile(
							classSymbol.getQualifiedName() + &quot;ParameterNames&quot;);
					BufferedWriter bw = new BufferedWriter(jfo.openWriter());
					bw.append(&quot;package &quot;);
					bw.append(packageElement.getQualifiedName());
					bw.append(&quot;;&quot;);
					bw.newLine();
					bw.newLine();
					bw.append(&quot;public class &quot; + classSymbol.getSimpleName()
							+ &quot;ParameterNames {&quot;);
					bw.newLine();
					bw.append(&quot;    static String[] instance = {&quot;);
					MethodSymbol symbol = (MethodSymbol) constructor;
					int i = 0;
					for (VarSymbol param : symbol.getParameters()) {
						if (i++ &amp;gt; 0) {
							bw.append(&quot;,&quot;);
						}
						bw.newLine();
						bw.append(&quot;            \&quot;&quot; + param.name + &quot;\&quot;&quot;);
					}
					bw.newLine();
					bw.append(&quot;        };&quot;);
					bw.newLine();
					bw.append(&quot;    }&quot;);
					bw.newLine();
					bw.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			}

		}
		return true;
	}
}
&lt;/pre&gt;
&lt;p&gt;A sample class that uses this annotation.  Note that this class is immutable.&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;package com.younglogic.annotetest;

import com.younglogic.annote.NamedParameters;

public class SampleClass {

	final String s1;
	final String s2;
	final Integer i1;

	@NamedParameters
	public SampleClass(String s1, String s2, Integer i1) {
		super();
		this.s1 = s1;
		this.s2 = s2;
		this.i1 = i1;
	}

	@Override
	public String toString() {

		return &quot;SampleClass values are: s1=&quot; + s1 + &quot;, s2=&quot; + s2 + &quot;, i1=&quot; + i1.toString();
	}
}
&lt;/pre&gt;
&lt;p&gt;Now add some parameters to the compiler.&lt;/p&gt;
&lt;p&gt;-processor is the processor we want to explicitly call&lt;br /&gt;
-processorpath  tells it where to find the new annotation.&lt;br /&gt;
-s tells it  where to put the generated code&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; javac -cp ../NamedParameters/bin/  -processorpath ../NamedParameters/bin/ -s /tmp/generated/ -processor com.younglogic.annote.NamedParametersAnnotationProcessor   src/com/younglogic/annotetest/SampleClass.java
&lt;/pre&gt;
&lt;p&gt;This will generate the source file: /tmp/generated/com/younglogic/annotetest/SampleClassParameterNames.java&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;package com.younglogic.annotetest;

public class SampleClassParameterNames {
    public static String[] instance = {
            &quot;s1&quot;,
            &quot;s2&quot;,
            &quot;i1&quot;,
            &quot;i2&quot;
        };
    }
&lt;/pre&gt;
&lt;p&gt;And compile it to /tmp/generated/com/younglogic/annotetest/SampleClassParameterNames.class&lt;/p&gt;
&lt;p&gt;We can use that information to create new instances.  I have a file SampleClass.properties  with the values I want to use to create a new instance.&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;i1=5
i2=10
s1=&quot;first&quot;
s2=&quot;next&quot;
&lt;/pre&gt;
&lt;p&gt;Read it in and populate a new instance dynamically:&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;package com.younglogic.annotetest;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;

public class UseParamNames {

	public static void main(String[] args) throws IOException,
			InstantiationException, IllegalAccessException,
			IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
		Properties properties = new Properties();

		InputStream instream = UseParamNames.class
				.getResourceAsStream(&quot;SampleClass.properties&quot;);
		properties.load(instream);

		Constructor c = getConstructor();

		Object[] initargs = new Object[SampleClassParameterNames.instance.length];
		int i = 0;
		for (String name : SampleClassParameterNames.instance) {
			Class[] argTypes = { String.class };

			String strvalue = properties.getProperty(name);
			String[] paramArgs = new String[1];
			paramArgs[0] = strvalue;

			initargs[i] = c.getParameterTypes()[i].getConstructor(argTypes)
					.newInstance(paramArgs);
			i++;

		}

		Object newInstance = c.newInstance(initargs);

		System.out.println(newInstance.toString());
	}

	private static Constructor getConstructor() {
		for (Constructor c : SampleClass.class.getConstructors()) {
			if (c.getAnnotations().length &amp;gt; 0) {
				return c;
			}

		}
		return null;
	}
}
&lt;/pre&gt;
&lt;p&gt;Which, when run, produces the output:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;SampleClass values are: s1=&quot;first&quot;, s2=&quot;next&quot;, i1=5
&lt;/pre&gt;</content:encoded>
	<dc:date>2012-04-09T01:44:13+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1990">
	<title>Adam Young: Parameter Names in Java</title>
    <link>http://adam.younglogic.com/2012/04/parameter-names-in-java/</link>
	<content:encoded>&lt;p&gt;There is a very small feature that could be added to Java in order to improve it significantly: Add names to the Parameter object in the Reflection API.&lt;br /&gt;
&lt;span id=&quot;more-1990&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When creating a new Object in Java,  the parameter list for the constructor or factory provides the contract.  Unfortunately,  a key element of this contract is missing at run rime when it is needed most.  If a constructor takes multiple values of the same type,  the only way to distinguish between them are the names of the parameters.  For example,  the JDBC API to create a new connection takes three parameters: the username and password to use for the connection authentication and authorization, and the URL of the Datasource.  &lt;a href=&quot;http://adam.younglogic.com/feed/docs.oracle.com/javase/6/docs/api/java/sql/DriverManager.html#getConnection(java.lang.String, java.lang.String,java.lang.String)&quot; title=&quot;DriverManager.getConnection(java.lang.String, java.lang.String,java.lang.String)&quot;&gt;However, all three values are strings.&lt;/a&gt; In order to distinguish between them,  the user needs to know the order of the parameters:  is it URL first or UserID first?  &lt;/p&gt;
&lt;p&gt;Building a new object from a persisted dictionary is common enough that there is a different API as well that takes a&lt;a href=&quot;http://docs.oracle.com/javase/6/docs/api/java/sql/DriverManager.html#getConnection%28java.lang.String,%20java.util.Properties%29&quot; title=&quot;DriverManager.getConnection(java.lang.String,java.util.Properties)&quot;&gt; Properties object&lt;/a&gt;.  This variation loses all documentation about what is required to authenticate a connection: username and password.  Since the format of the URL is also Driver specific,  the user is thus relegated to digging through the documentation to figure out how to correctly create a Connection.  However, reading the documentation is not an option for an automated tool.&lt;/p&gt;
&lt;p&gt;What Java lacks is a standardized and automated way to map a key-value pair collection to a function.  The mechanism should look like this.&lt;/p&gt;
&lt;pre class=&quot;brush:java&quot;&gt;private static Object createInstanceFromProperties(Method method, Properties properties)
throws InstantiationException, IllegalAccessException,
       InvocationTargetException, NoSuchMethodException {
    //This is the new call.
    String[] paramNames = method.getParameterNames();
    //Spacing is due to limitation of web display for angle bracketed expressions.
    Class &amp;lt; ? &amp;gt; [] argsTypes = method.getParameterTypes();

    Object arguments[] = new Object[argsTypes.length];
    for (int i = 0; i &amp;lt; paramNames.length; i += 1) {
        String val = properties.getProperty(paramNames[i]);
        if (argsTypes[i] == java.lang.String.class) {
	    arguments[i] = val;
        }else{
            arguments[i] = argsTypes[i].getConstructor(java.lang.String.class).newInstance(val);
	}
    }
    return method.invoke(null, arguments);
}
&lt;/pre&gt;
&lt;p&gt;A simple variation can work with a Constructor object instead of a Method object.  One assumption from the above code that should be explicit is that the framework using this call has enough information to determine which variation of the Method or Constructor to find.  &lt;/p&gt;
&lt;p&gt;I wouldn't ordinarily implement an API like this as Parallel arrays,  but in this case,  it is the least impact on the existing API.  There is no &quot;Parameter&quot; object in the existing API.  &lt;/p&gt;
&lt;p&gt;Since existing compiled classes would not have provided the array of names, one version of Java should be provided as a transitory step which will allow the JDK to return a Null if the class does not provide the appropriate strings.&lt;/p&gt;</content:encoded>
	<dc:date>2012-04-05T17:13:32+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1905">
	<title>Adam Young: Openstack Keystone in HTTPD</title>
    <link>http://adam.younglogic.com/2012/04/keystone-httpd/</link>
	<content:encoded>&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/2012/03/keystone-shoul…o-apache-httpd/&quot;&gt;After calling for Keystone to migrate to HTTPD,&lt;/a&gt;  several people asked me if I would show how this can be done.  Here are the steps.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1905&quot;&gt;&lt;/span&gt;&lt;br /&gt;
Update:  in testing keystone,  you need to change the username from &lt;em&gt;demo&lt;/em&gt; to &lt;em&gt;admin&lt;/em&gt; as per the export lines near the bottom of this page.&lt;/p&gt;
&lt;p&gt;A prerequisite is to set up &lt;a href=&quot;http://adam.younglogic.com/2012/03/ssl-nss-easy/&quot; target=&quot;_blank&quot; title=&quot;NSS SSL is Easy&quot;&gt;NSS HTTPD SSL&lt;/a&gt; support. We can use it in conjunction with Keystone to provide encrypted access for authentication and authorization.&lt;/p&gt;
&lt;p&gt;I created a file to enable  wsgi:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;/var/www/cgi-bin/keystone/keystone.py&lt;/em&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;import os
from keystone import config
from paste import deploy
from keystone.common import logging
from keystone.common import utils
from keystone.common import wsgi

LOG = logging.getLogger(__name__)
CONF = config.CONF
config_files = ['/opt/stack/keystone/etc/keystone.conf']
CONF(config_files=config_files)

conf = CONF.config_file[0]
#name = 'admin'
name = os.path.basename(__file__)

if CONF.debug:
    CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

options = deploy.appconfig('config:%s' % CONF.config_file[0])

application = deploy.loadapp('config:%s' % conf, name=name)
&lt;/pre&gt;
&lt;p&gt;And I hardlinked it:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cd /var/www/cgi-bin/keystone/
ln  keystone.py admin
ln  keystone.py main
&lt;/pre&gt;
&lt;p&gt;This is based on a Fedora devstack deployment,  which checks out the code in /opt/stack/keystone.  I ran against master from git,  which as of this writing should be the same as the next Essex RC.  I ran python setup.py install  with this,  which gave me the installed egg in&lt;/p&gt;
&lt;p&gt;&lt;em&gt;/usr/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Since eggs deployed this way are part of the default Python path, it is usable by WSGI applications in Apache.&lt;/p&gt;
&lt;p&gt;To run against the Fedora RPMs,  the difference would be to read in the config file  &lt;em&gt;/etc/keystone/keystone.conf&lt;/em&gt; instead.  &lt;/p&gt;
&lt;p&gt;I’ve changed /etc/httpd/conf.d/keystone.conf to&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;WSGIScriptAlias /main /var/www/cgi-bin/keystone/main
WSGIScriptAlias /admin /var/www/cgi-bin/keystone/admin

&amp;lt;location&amp;gt;
   NSSRequireSSL
&amp;lt;/location&amp;gt;

&amp;lt;location&amp;gt;
   NSSRequireSSL
&amp;lt;/location&amp;gt;
&lt;/pre&gt;
&lt;p&gt;and restarted httpd.  To test:&lt;br /&gt;
&lt;a href=&quot;http://adam.younglogic.com/wp-content/uploads/2012/04/keystone-ssl.png&quot;&gt;&lt;img src=&quot;http://adam.younglogic.com/wp-content/uploads/2012/04/keystone-ssl.png&quot; title=&quot;keystone-ssl&quot; height=&quot;797&quot; width=&quot;879&quot; alt=&quot;&quot; class=&quot;alignleft size-full wp-image-2066&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The most straightforward way to test Keystone is via the command line interface (CLI).  When running via devstack,  the normal approach is to source the environment file:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;. openrc&lt;/pre&gt;
&lt;p&gt;which pulls in the localrc.  This sets many values, including the URL to be used when the Keystone CLI talks to the server: OS_AUTH_URL.  Typically this is set as some variation on the local hostname and the port 5000.  It also sets the username to &lt;em&gt;demo&lt;/em&gt;  To test HTTPD,   change this to:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;export OS_AUTH_URL=https://$HOSTNAME/admin/v2.0
export OS_USERNAME=admin
&lt;/pre&gt;
&lt;p&gt;However, running the command line client gave an error:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[ayoung@ayoungstack devstack]$ keystone user-list
No handlers could be found for logger &quot;keystoneclient.client&quot;
Invalid OpenStack Identity credentials
&lt;/pre&gt;
&lt;p&gt;Looking in the access log,  I saw the token request was succeeding (returned 200) but the second request failed with unauthorized (401).&lt;/p&gt;
&lt;p&gt;One difference between Eventlet and the Fedora build of HTTPD is that each request in HTTPD is handled by a separate process.  This is called prefork,  and you can test a given install by running&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[ayoung@ayoung keystone]$ httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
&lt;/pre&gt;
&lt;p&gt;To see the built in modules.  The default way that Keystone stores Tokens is by using a key value pair storage.  You see this in the keystone.conf file.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[token]
driver = keystone.token.backends.kvs.Token
&lt;/pre&gt;
&lt;p&gt;By changing this to the SQL store,  the tokens are now accessable by other processes,  including the ones that will handle follow on requests to Keystone.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[token]
driver = keystone.token.backends.sql.Token
&lt;/pre&gt;
&lt;p&gt;And now the keystone CLI works:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[ayoung@ayoungstack devstack]$ keystone user-list
+----------------------------------+---------+--------------------+--------+
|                id                | enabled |       email        |  name  |
+----------------------------------+---------+--------------------+--------+
| 6d42897928974d469a4223302e6bae4a | True    | admin@example.com  | admin  |
| 72f2941c7e3e40b292d50bd8b1662899 | True    | demo@example.com   | demo   |
| 92556c2d36de4f46a0a9916d96d2e793 | True    | glance@example.com | glance |
| e452d5f649ed489c8b84b8192e781263 | True    | nova@example.com   | nova   |
+----------------------------------+---------+--------------------+--------+
&lt;/pre&gt;</content:encoded>
	<dc:date>2012-04-04T16:31:02+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=2036">
	<title>Adam Young: Client Certificates with mod_nss</title>
    <link>http://adam.younglogic.com/2012/03/client-certs-nss/</link>
	<content:encoded>&lt;p&gt;Once server side certificates have been set up,  setting up client side certificates requires some additional configuration, especially if you want to use them as the source of identity in your applications.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-2036&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;First,  the application needs the additional  directive in its /etc/httpd/conf.d specific file.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;   NSSVerifyClient require
&lt;/pre&gt;
&lt;p&gt;Did that work for you?  NO…me neither…&lt;/p&gt;
&lt;p&gt;OK, so  actually, it was slightly more involved.  First, I had to figure out how to turn on NSS debugging. That is done by editing the file&lt;/p&gt;
&lt;p&gt;/etc/httpd/conf.d/nss.conf &lt;/p&gt;
&lt;p&gt;and setting the value for &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;LogLevel debug
&lt;/pre&gt;
&lt;p&gt;Once that worked,  I saw messages in /var/log/httpd/error_log that looked like:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[Fri Mar 30 11:43:54 2012] [debug] nss_engine_kernel.c(309): Changed client verification type will force renegotiation
[Fri Mar 30 11:43:54 2012] [info] Requesting connection re-negotiation
[Fri Mar 30 11:43:54 2012] [debug] nss_engine_kernel.c(404): Performing full renegotiation: complete handshake protocol
[Fri Mar 30 11:43:54 2012] [debug] nss_engine_kernel.c(418): Re-negotation request failed: returned error -12176
&lt;/pre&gt;
&lt;p&gt;So I enabled renegotiation.  Again, editing /etc/httpd/conf.d/nss.conf &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;NSSRenegotiation on
NSSRequireSafeNegotiation on
&lt;/pre&gt;
&lt;p&gt;And then client side certs worked for me.  They probably won’t work for you, though.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I cheated.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In between,  I set up a&lt;a href=&quot;http://pki.fedoraproject.org/wiki/PKI_Main_Page&quot; title=&quot;Dogtag PKI&quot;&gt; Dogtag PKI &lt;/a&gt;instance,  generated a new server side certificate,  a client side certificate for my browser,  and installed the CA and Server side certificate in my web server. &lt;/p&gt;
&lt;p&gt;I don’t think all of that was necessary.  &lt;/p&gt;
&lt;p&gt;A variation would have been to generate a client side certificate and sign it with the self-sign CA key that my web server was already using.  The bottom line is that the browser and the server need to &lt;em&gt;both trust the CAs used&lt;/em&gt; for the client and server certs.&lt;/p&gt;
&lt;p&gt;Ok,  so we’ve established a secure channel.  This doesn’t mean much if we don’t know who the user is at the application level.  The NSS layer follows the SSL approach of using the option: &lt;strong&gt;FakeBasicAuth&lt;/strong&gt; to pass information from the Certificate through to the application.  I uncommented the line: &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;NSSOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire
&lt;/pre&gt;
&lt;p&gt;You also need to tell NSS which value from the certificate should be passed as the user.  In my case,  it is the Subject:uid value,  so I configured mine as:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;NSSUserName SSL_CLIENT_S_DN_UID
&lt;/pre&gt;
&lt;p&gt;The overall difference in the nss.conf file is:&lt;/p&gt;
&lt;pre class=&quot;brush:diff&quot;&gt;--- /etc/httpd/conf.d/nss.conf.orig	2012-03-29 12:59:06.319470425 -0400
+++ /etc/httpd/conf.d/nss.conf	2012-03-30 16:21:24.836124822 -0400
@@ -17,7 +17,7 @@
 # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
 #       Listen directives: &quot;Listen [::]:8443&quot; and &quot;Listen 0.0.0.0:443&quot;
 #
-Listen 8443
+Listen 443

 ##
 ##  SSL Global Context
@@ -71,17 +71,17 @@
 #
 # Only renegotiate if the peer's hello bears the TLS renegotiation_info
 # extension. Default off.
-NSSRenegotiation off
+NSSRenegotiation on

 # Peer must send Signaling Cipher Suite Value (SCSV) or
 # Renegotiation Info (RI) extension in ALL handshakes.  Default: off
-NSSRequireSafeNegotiation off
+NSSRequireSafeNegotiation on

 ##
 ## SSL Virtual Host Context
 ##

-&amp;lt;virtualhost _default_:8443=&quot;_default_:8443&quot;&amp;gt;
+&amp;lt;virtualhost _default_:443=&quot;_default_:443&quot;&amp;gt;

 #   General setup for the virtual host
 #DocumentRoot &quot;/etc/httpd/htdocs&quot;
@@ -92,7 +92,7 @@
 # LogLevel is not inherited from httpd.conf.
 ErrorLog /etc/httpd/logs/error_log
 TransferLog /etc/httpd/logs/access_log
-LogLevel warn
+LogLevel debug

 #   SSL Engine Switch:
 #   Enable/Disable SSL for this virtual host.
@@ -198,7 +198,8 @@
 #   o OptRenegotiate:
 #     This enables optimized SSL connection renegotiation handling when SSL
 #     directives are used in per-directory context.
-#NSSOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire
+NSSOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire
+NSSUserName SSL_CLIENT_S_DN_UID
 &amp;lt;files&amp;gt;
     NSSOptions +StdEnvVars
 &amp;lt;/files&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Now a little bit of Python/WSGI specifics&lt;br /&gt;
For my WSGI application,  I add in a value that says “pass on the authentication info to the application”&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;WSGIPassAuthorization On
&lt;/pre&gt;
&lt;p&gt;Then the WSGI app can access the value  via: &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;class Application(BaseApplication):
    @webob.dec.wsgify
    def __call__(self, req):
    context['remote_user'] = req.environ.get('REMOTE_USER')
&lt;/pre&gt;
&lt;p&gt;Here is what my file /etc/httpd/conf.d/keystone.conf  looks like to protect the suburl “main”:&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;WSGIScriptAlias /main /var/www/wsgi/httpdmain.py
WSGIScriptAlias /admin /var/www/wsgi/httpdadmin.py

&amp;lt; Location &quot;/main&quot; &amp;gt;
   NSSRequireSSL
   NSSVerifyClient require
   WSGIPassAuthorization On
&amp;lt; / Location &amp;gt;
&lt;/pre&gt;</content:encoded>
	<dc:date>2012-03-30T21:22:23+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1975">
	<title>Adam Young: Setting up SSL with NSS is easier than you think</title>
    <link>http://adam.younglogic.com/2012/03/ssl-nss-easy/</link>
	<content:encoded>&lt;p&gt;At least, it is on Fedora 16&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;sudo yum install mod_nss
&lt;/pre&gt;
&lt;p&gt;/etc/httpd/alias/ is populated already with ca and server cert self signed&lt;br /&gt;
/etc/httpd/conf.d/nss.conf  already exists&lt;br /&gt;
change 8443 to 443 in two places &lt;/p&gt;
&lt;pre class=&quot;brush:diff&quot;&gt;--- /etc/httpd/conf.d/nss.conf.orig	2012-03-29 12:59:06.319470425 -0400
+++ /etc/httpd/conf.d/nss.conf	2012-03-29 12:19:38.862721465 -0400
@@ -17,7 +17,7 @@
 # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
 #       Listen directives: &quot;Listen [::]:8443&quot; and &quot;Listen 0.0.0.0:443&quot;
 #
-Listen 8443
+Listen 443

 ##
 ##  SSL Global Context
@@ -81,7 +81,7 @@
 ## SSL Virtual Host Context
 ##

-&amp;lt;virtualhost _default_:8443=&quot;_default_:8443&quot;&amp;gt;
+&amp;lt;virtualhost _default_:443=&quot;_default_:443&quot;&amp;gt;

 #   General setup for the virtual host
 #DocumentRoot &quot;/etc/httpd/htdocs&quot;
&lt;/pre&gt;
&lt;p&gt;Make sure your firewall is open on the HTTPS port.  Add the following line in /etc/sysconfig/iptables&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
&lt;/pre&gt;
&lt;p&gt;before the statement&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;-A INPUT -j REJECT --reject-with icmp-host-prohibited
&lt;/pre&gt;
&lt;p&gt;and restart the services&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;sudo systemctl restart iptables.service
sudo systemctl restart httpd.service
&lt;/pre&gt;
&lt;p&gt;The &lt;a href=&quot;http://directory.fedoraproject.org/wiki/Mod_nss#Documentation&quot;&gt; documentation &lt;/a&gt; provides a lot more detail.  Almost all of these steps are performed by the RPM install on F16 and later.&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-30T17:50:30+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55588.html">
	<title>Dan Walsh: runuser versus su</title>
    <link>http://danwalsh.livejournal.com/55588.html</link>
	<content:encoded>&lt;p&gt;Many years ago, we noticed SELinux having problems with the su command.  Many confined domains were using su to switch user from root to some non privileged user.  But this would generate lots of bogus SELinux errors such as:&lt;br /&gt;&lt;br /&gt;Domain X_t wants to getattr on the fingerprint device or look at the pid file of the Smart Card reader. &lt;br /&gt;&lt;br /&gt;su using the pam_stack was the cause of these errors.  Depending on which pam_modules you had in the /etc/pam.d/su configuration, certain access would be checked.  Services using su do not want/need these side effects of using the pam stack.  SELinux policy writers do not want to allow the access or add dontaudit rules all over the place.&lt;br /&gt;&lt;br /&gt;In order to fix this, we built a new application called runuser.  runuser is actually built from the su.c source code.  You just define the RUNUSER constant when compiling su.c.  Basically runuser is just the su command with the pam stack removed as well as verifying the command is running as root, not setuid.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Whenever an service is running as root and wants to change UID using the shell it should use &lt;span style=&quot;font-size: larger;&quot;&gt;runuser&lt;/span&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;When you are logged in to a shell as a user and want to become root, you should use su.  (Or better yet sudo)&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-28T12:40:09+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=2000">
	<title>Adam Young: Shared Nothing Diskless Boot</title>
    <link>http://adam.younglogic.com/2012/03/shared-nothing-diskless-boot/</link>
	<content:encoded>&lt;p&gt;It is possible to run a computer with no persistent storage for its root file system other than a single image downloaded an held in RAM. The computer does not needs a local disk. The computer also does not need a SAN or NAS device for the Root File system.&lt;/p&gt;
&lt;p&gt;There are numerous uses for this style of booting.  A short list:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Debugging the installation processes of software packages&lt;/li&gt;
&lt;li&gt;Running computationally intensive tasks on a large array of nodes&lt;/li&gt;
&lt;li&gt;Inventorying the hardware no new servers&lt;/li&gt;
&lt;li&gt;Deploying a light management framework for virtualization hypervisors&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here is a brief overview of the pieces needed to set this up for testing purposes on a workstation running KVM.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-2000&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configure a local network for PXE traffic&lt;/li&gt;
&lt;li&gt;Install a machine to server as the PXE server&lt;/li&gt;
&lt;li&gt;Install and Configure DHCPD&lt;/li&gt;
&lt;li&gt;Install and Configure TFTP&lt;/li&gt;
&lt;li&gt;create a rootfs&lt;/li&gt;
&lt;li&gt;Install HTTPD&lt;/li&gt;
&lt;li&gt;get a boot image&lt;/li&gt;
&lt;li&gt;PXE Boot a Blank VM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The first piece is done on the workstation itself, and is just overhead for doing this ins a completely virtualized environment.  This is the analogue of using a private secured backbone for administrative backbone when using physical machines.  Configuring the network used to take editing the Network XML file, but now you can deselect the DHCP checkbox in virt-manager when creating a new network.  Here is what mine generated in /var/lib/libvirt/network/nodhcp.xml.&lt;/p&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;network&amp;gt;
  &amp;lt;name&amp;gt;nodhcp&amp;lt;/name&amp;gt;
  &amp;lt;uuid&amp;gt;ec819c42-b4b0-1577-363e-1c5918a3ee29&amp;lt;/uuid&amp;gt;
  &amp;lt;bridge delay=&quot;0&quot; name=&quot;virbr2&quot; stp=&quot;on&quot;&amp;gt;
  &amp;lt;mac address=&quot;52:54:00:FC:2F:62&quot;&amp;gt;
  &amp;lt;ip address=&quot;172.33.22.1&quot; netmask=&quot;255.255.255.0&quot;&amp;gt;
  &amp;lt;/ip&amp;gt;
&amp;lt;/network&amp;gt;
&lt;/pre&gt;
&lt;p&gt;You could save that in /root and do &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; sudo virsh network-create /root/nodhcp.xml&lt;/pre&gt;
&lt;p&gt;This one has a bridge defined, which is probably not what you would want for your server, as this network should not see the outside world.  Still the device is useful if you want to run wireshark on it to debug booting issues.&lt;/p&gt;
&lt;p&gt;Create the server as a VM, and provide it Network interface on both a publicly accessible as well as the Private network defined above.  Install Fedora (I used F17 Alpha) as per normal.&lt;/p&gt;
&lt;p&gt;Install the Server pieces&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;yum install syslinux tftp-server  dhcp  dracut-network  httpd httpd-tools apr apr-util apr-util-lda
&lt;/pre&gt;
&lt;p&gt;Configure DHCPD by editing /etc/dhcp/dhcpd.conf &lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;allow booting;
allow bootp;

subnet 172.22.33.0 netmask 255.255.255.0 {
        option routers                  172.22.33.1;
        option subnet-mask              255.255.255.0;
        option domain-search              &quot;younglogic.com&quot;;
        option domain-name-servers       172.22.33.1;
        option time-offset              -18000;     # Eastern Standard Time
        range 172.22.33.100 172.22.33.140;
}

class &quot;pxeclients&quot; {
   match if substring(option vendor-class-identifier, 0, 9) = &quot;PXEClient&quot;;
   next-server server-ip;
   filename &quot;pxelinux.0&quot;;
&lt;/pre&gt;
&lt;p&gt;Set up TFTP.&lt;/p&gt;
&lt;p&gt;edit /etc/xinetd.d/tftp and set&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;	disable			= no
&lt;/pre&gt;
&lt;p&gt;Copy over the Kernel&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cp /boot/vmlinuz-3.3.0-0.rc6.git0.2.fc17.x86_64 /var/lib/tftpboot/vmlinuz-3.3.0-0.rc6.git0.2.fc17.x86_64
&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://dracut.wiki.kernel.org/&quot;&gt;Dracut&lt;/a&gt; is a great tool for people that need to control the boot procedure of their machines.  It has a module called &lt;strong&gt;Livenet&lt;/strong&gt; that we use to specifying that the root file system should be downloaded an unpacked in a directory.  In order for that to work, we need the dracut-network package specified on the yum line above.  THen,  we need to generate a new initial ramdisk (initrd) with the livenet module enabled.  &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;dracut -v  --force --add &quot;livenet&quot;  /var/lib/tftpboot/initramfs-kernel-3.3.0-0.rc6.git0.2.fc17.x86_64.img 3.3.0-0.rc6.git0.2.fc17.x86_64
&lt;/pre&gt;
&lt;p&gt;Syslinux is our boot loader.  Syslinux is more than a tool to run an installer (although it does that quite well).  Here, it is a program that is configured much as for a kickstart,  but it will instead switch to running the kernel instead of Anaconda.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;cp  /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg/
&lt;/pre&gt;
&lt;p&gt;The configuration for syslinux is in /var/lib/tftpboot/pxelinux.cfg/default and looks like this&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;default f17

serial --unit=0 --speed=9600
terminal --timeout=5 serial console

label f17
  kernel vmlinuz-3.3.0-0.rc6.git0.2.fc17.x86_64
  append initrd=initramfs-kernel-3.3.0-0.rc6.git0.2.fc17.x86_64.img console=tty0  rd.shell rd.debug root=live:http://172.22.33.2/squashfs.img   rw
&lt;/pre&gt;
&lt;p&gt;The most interesting value here is &lt;strong&gt;root=live:http://172.22.33.2/squashfs.img&lt;/strong&gt; which is what activates the Dracut module in the initrd to download the rootfs via http and expand it into the new root directory.&lt;/p&gt;
&lt;p&gt;I know that a couple of these values are incorrect, and I will update when I have them straight, but this will work.&lt;/p&gt;
&lt;p&gt;Once everything is in place, you need to make sure SELinux is happy.  Otherwise, the Kernel will deny the tftp network service access to the files it needs to serve.  Of course, you could always disable SELinux,  but &lt;a href=&quot;http://wiki.centos.org/HowTos/SELinux&quot;&gt; lets try to do things right&lt;/a&gt; To see what the SELinux context for the newly copied file is: &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;ls -Z /var/lib/tftpboot/vmlinuz-3.3.0-0.rc6.git0.2.fc17.x86_64
rwxr-xr-x. root root unconfined_u:object_r:tftpdir_rw_t:s0 /var/lib/tftpboot/vmlinuz-3.3.0-0.rc6.git0.2.fc17.x86_64
&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;http://userspace.selinuxproject.org/trac/wiki/SelinuxTools&quot;&gt;To see what it should be:&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f17stack ~]# matchpathcon /var/lib/tftpboot/
/var/lib/tftpboot	system_u:object_r:tftpdir_rw_t:s0
&lt;/pre&gt;
&lt;p&gt;To set the whole directory to the correct context&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; chcon -Rv --type=tftpdir_rw_t  --user=system_u  /var/lib/tftpboot/
&lt;/pre&gt;
&lt;p&gt;There is probably a more correct way to do this,  something along the lines of &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;restorecon -R -v /var/lib/tftpboot/
&lt;/pre&gt;
&lt;p&gt;But that doesn’t seem to set the user.&lt;/p&gt;
&lt;p&gt;At this point you can restart both services.  Make sure that dhcpd runs at machine reboot as well.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;/bin/systemctl enable  dhcpd.service
/bin/systemctl restart xinetd.service
/bin/systemctl restart dhcpd.service
&lt;/pre&gt;
&lt;p&gt;To test that things are running correctly: &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f17stack tmp]# cd /tmp
[root@f17stack tmp]# getenforce
Enforcing
[root@f17stack tmp]# tftp localhost -c get initramfs-kernel-3.3.0-0.rc6.git0.2.fc17.x86_64.img
[root@f17stack tmp]# ls initramfs-kernel-3.3.0-0.rc6.git0.2.fc17.x86_64.img
initramfs-kernel-3.3.0-0.rc6.git0.2.fc17.x86_64.img
&lt;/pre&gt;
&lt;p&gt;Make sure Apache is running and will run on boot:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f17stack tmp]# systemctl enable  httpd.service
[root@f17stack tmp]# systemctl start httpd.service
&lt;/pre&gt;
&lt;p&gt;The final step is to setup a bootable image.  In this case,  we use the same thing that the live CD uses, which is packaged inside of a &lt;a href=&quot;http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html&quot;&gt;squashfs&lt;/a&gt; image.&lt;/p&gt;
&lt;p&gt;I did this on my desktop to keep from having to have too big a file on my Server VM.  As it is, this is still  close to a 588MB image.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;sudo mount -o loop  ~/Downloads/Fedora-16-x86_64-Live-Desktop.iso /mnt
scp /mnt/LiveOS/squashfs.img root@f17stack.ayoung.boston.devel.redhat.com:/var/www/html
&lt;/pre&gt;
&lt;p&gt;And again, on the server, lets check SELinux&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f17stack tmp]# ls -Z /var/www/html/
f16/          index.html    squashfs.img
[root@f17stack tmp]# ls -Z /var/www/html/squashfs.img
-r--r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/squashfs.img
&lt;/pre&gt;
&lt;p&gt;And make SELinux Happy:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;chcon -Rv --type=httpd_sys_content_t  --user=system_u  /var/www/html/
&lt;/pre&gt;
&lt;p&gt;I have to admit,  I had already gotten the system to relable the file by the time I tested this,  I suspect upon a reboot, so this last step might not be necessary.&lt;/p&gt;
&lt;p&gt;Now,  open the firewall to let dhcp, tftp, and http  traffic through.  This can be done via the following rules added to /etc/sysconfig/iptables&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;-A INPUT -m state --state NEW -m tcp -p tcp --dport 68 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 68 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 69 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
&lt;/pre&gt;
&lt;p&gt;And restarting iptables:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;systemctl start iptables.service
&lt;/pre&gt;
&lt;p&gt;Now Boot the second VM.  If all goes well, it will Get its IP address:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-27-170123.png&quot;&gt;&lt;img src=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-27-170123-300x217.png&quot; title=&quot;Screenshot at 2012-03-27 17:01:23&quot; height=&quot;217&quot; width=&quot;300&quot; alt=&quot;&quot; class=&quot;alignleft size-medium wp-image-2013&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There will likely be a delay as it downloads the 588 install image:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-27-170138.png&quot;&gt;&lt;img src=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-27-170138-300x217.png&quot; title=&quot;Screenshot at 2012-03-27 17:01:38&quot; height=&quot;217&quot; width=&quot;300&quot; alt=&quot;&quot; class=&quot;alignleft size-medium wp-image-2014&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And when it is done,  you are at Firstboot:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-27-170452.png&quot;&gt;&lt;img src=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-27-170452-300x217.png&quot; title=&quot;Screenshot at 2012-03-27 17:04:52&quot; height=&quot;217&quot; width=&quot;300&quot; alt=&quot;&quot; class=&quot;alignleft size-medium wp-image-2017&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks to Will Woods for cluing me in about squashfs and livenet, Harald Hoyer for general Dracut help, and  Ray Strode for help with debugging why my console wouldn’t echo.&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-28T01:07:15+00:00</dc:date>
</item>
<item rdf:about="http://mgrepl.wordpress.com/?p=164">
	<title>Miroslav Grepl: When should you use the “optional_policy” block statement?</title>
    <link>http://mgrepl.wordpress.com/2012/03/23/when-should-you-use-the-optional_policy-block-statement/</link>
	<content:encoded>&lt;p&gt;After writing the blog on &lt;a href=&quot;http://mgrepl.wordpress.com/2011/12/04/troubles-with-policy-development-part-1/&quot;&gt;optional policy&lt;/a&gt;, I received the following question:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;“Ho do I know whether I need to use the optional_policy block or not?”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When we write policy we can choose to have the policy either shipped within the base policy or as as module.&lt;/p&gt;
&lt;p&gt;We use the modules config files to specify whether a policy is in the base or module.&lt;/p&gt;
&lt;p&gt;We have a different modules config file for each policy type that we ship&lt;/p&gt;
&lt;p&gt;&lt;em&gt;modules-targeted.conf&lt;br /&gt;
modules-mls.conf&lt;br /&gt;
modules-minimum.conf&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;which contain statements like&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: blue;&quot;&gt;# Layer: kernel&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# Module: domain&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# Required in base&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# Core policy for domains.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;domain = base&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: blue;&quot;&gt;# Layer: system&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# Module: init&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# System initialization programs (init and init scripts).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;init = module&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;What does either “base” or “module” mean? The note says&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: blue;&quot;&gt;# For modular policies, modules set to “base” will be&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# included in the base module. “module” will be compiled&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;# as individual loadable modules.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The base.pp policy module contains core policy modules which are needed for the basic confinement of your system focused on the core operating system. The base.pp module can not be removed from your policy.&lt;/p&gt;
&lt;p&gt;But what about “module”. This is different. Theoretically these modules are all optional. Meaning you should be able to remove them from the policy if you wanted to.&lt;/p&gt;
&lt;p&gt;You can list the modules using:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: blue;&quot;&gt;$ semodule -l&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;There are some exceptions for modules like miscfiles, authlogin, init,&lt;br /&gt;
systemd, sysnetwork. We define them as “module” in the &lt;em&gt;modules-*.conf&lt;/em&gt;&lt;br /&gt;
file but they can not be removed.&lt;/p&gt;
&lt;p&gt;Another way of looking at this would be to examine the directories in&lt;br /&gt;
which we ship the interfaces. We ship interface files in &lt;em&gt;/usr/share/selinux/devel/include/&lt;/em&gt; subdirs&lt;/p&gt;
&lt;p&gt;&lt;em&gt;system kernel roles services admin apps&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Interfaces in &lt;em&gt;system&lt;/em&gt; and&lt;em&gt; kernel&lt;/em&gt; are core to the system, while interfaces in the other directories as optional.&lt;/p&gt;
&lt;p&gt;Let’s say you write a policy and you need to use a rpm interface because your application execute &lt;em&gt;rpm -qi&lt;/em&gt;. First, we need to examine that the rpm module is not a part of the base.pp policy module&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: blue;&quot;&gt;$ semodule -l | grep rpm&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;rpm 1.12.0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Ok, I see it is not. So I will call a rpm interface with the &lt;em&gt;optional_policy&lt;/em&gt; block.&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: blue;&quot;&gt;optional_policy(`&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;rpm_exec(mydomain_t)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;‘)&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/comments/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/delicious/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/facebook/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/twitter/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/stumble/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/digg/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/mgrepl.wordpress.com/164/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/reddit/mgrepl.wordpress.com/164/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;img src=&quot;http://stats.wordpress.com/b.gif?host=mgrepl.wordpress.com&amp;amp;blog=26699041&amp;amp;post=164&amp;amp;subd=mgrepl&amp;amp;ref=&amp;amp;feed=1&quot; alt=&quot;&quot; height=&quot;1&quot; border=&quot;0&quot; width=&quot;1&quot; /&gt;</content:encoded>
	<dc:date>2012-03-23T07:28:43+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55324.html">
	<title>Dan Walsh: Eating my own dogfood.</title>
    <link>http://danwalsh.livejournal.com/55324.html</link>
	<content:encoded>I am going on a trip tomorrow, I went to the Jet Blue web site to print my boarding pass.  The Jet Blue site has what I believe is a java application  running in the browser that displays your boarding pass.  I pressed the &quot;Print&quot; button on the screen and a print dialog came up, without any printers, and the &quot;Print&quot; button grayed out.   I did not notice the, setroubleshoot warning in gnome 3.  Figuring the print application was just broken, I decided to select print from the browser.  Sadly the browser printed a blank page.  I then bad mouthed Firefox/Linux printing.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Mia Culpa&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I noticed that I had AVC's that looked like mozilla_plugin_t was trying to getattr on lpr_exec_t.    I put mozilla_plugin_t into permissive mode, to find out all the access required.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# semanage permissive -a mozilla_plugin_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I went back to Jet Blue and tried to print the boarding pass again.  This time the printers showed up and I was able to print my boarding pass.&lt;br /&gt;&lt;br /&gt;Now I had AVC's that indicated  mozilla_plugin_t was executing lpr_exec_t.  Also lpr was connecting to the cups and gnome-keyring daemon. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Should I transition or add allow rules for mozilla_plugin_t?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;As a policy writer I had to choice whether to allow mozilla_plugin_t all of these accesses or have mozilla_plugin_t transition to the lpr_t domain when it executes  /usr/bin/lpr.   These decisions are key to writing good security policy.  My rule of thumb is if the domain i would transition to is very powerful, I hesitate to transition.   Especially if the parent application requires limited access when executing the child. For example a user can run rpm in their current domain (staff_T) to list all rpm packages, while if I allowed them to transition to the rpm_t domain, they would be allowed install rpm packages.  In the mozilla_plugin_t case the advantage of transitioning to lpr_t allows me to continue to prevent mozilla plugins from talking directly to the cups server and  the gnome-keyring and lpr_t is a very limited domain, so I chose to transition.&lt;br /&gt;&lt;br /&gt;My initial policy looked like this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;policy_module(mypol, 1.0)&lt;br /&gt;&lt;br /&gt;require {&lt;br /&gt;    type mozilla_plugin_t;&lt;br /&gt;}&lt;br /&gt;lpd_domtrans_lpr(mozilla_plugin_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now I tried to print the boarding pass again, and now I had AVC's that stated lpr_t was trying to connect to keyring. &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;audit2allow -R&lt;/span&gt; indicated that I should use:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;gnome_stream_connect_gkeyringd(lpr_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;audit2allow also showed that I was failing on Roles Based Access Control (RBAC).   Users seldom see these types of errors. They show up in the log file as SELINUX_ERR rather then AVC.&lt;br /&gt;&lt;br /&gt;type=&lt;b&gt;SELINUX_ERR&lt;/b&gt; msg=audit(1332420617.119:909): security_compute_sid:  invalid context &lt;span style=&quot;color: #0000ff;&quot;&gt;staff_u:staff_r:lpr_t:s0-s0:c0.c1023&lt;/span&gt; for scontext=staff_u:staff_r:lpr_t:s0-s0:c0.c1023 tcontext=staff_u:staff_r:lpr_t:s0-s0:c0.c1023 tclass=unix_stream_socket&lt;br /&gt;&lt;br /&gt;This AVC is basically saying the &lt;span style=&quot;color: #0000ff;&quot;&gt;staff_u:staff_r:lpr_t:&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;s0-s0:c0.c1023&lt;/span&gt; is an invalid label.&lt;br /&gt;&lt;br /&gt;Hard to tell from this error what is wrong, but luckily audit2allow translates this into:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;role staff_r types lpr_t;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since I run with the staff_r role, I had to add an RBAC rule that would allow staff_r role to reach the lpr_t type.&lt;br /&gt;&lt;br /&gt;My final policy looks like:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;policy_module(mypol, 1.0)&lt;br /&gt;require {&lt;br /&gt;    type mozilla_plugin_t;&lt;br /&gt;    type lpr_t;&lt;br /&gt;    role staff_r;&lt;br /&gt;}&lt;br /&gt;lpd_domtrans_lpr(mozilla_plugin_t)&lt;br /&gt;role staff_r types lpr_t;&lt;br /&gt;gnome_stream_connect_gkeyringd(lpr_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Notice how I am transitioning from mozilla_plugin_t to lpr_t.  This does not mean staff_t will transition to lpr_t when running /usr/bin/lpr.  &lt;br /&gt;In fact, staff_t executes lpr in the staff_t domain, since the staff_t domain has the ability to connect to the cups and gnome-keyring daemons. &lt;br /&gt;&lt;br /&gt;But when staff_t executes a firefox plugin, the plugin will transition to a locked down domain mozilla_plugin_t.  When the mozilla_plugin_t plugin executes /usr/bin/lpr, the lpr command will transition to the lpr_t domain.&lt;br /&gt;&lt;br /&gt;Printing now works well.  Now I can remove the permissive flag from mozilla_plugin_t.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# semanage permissive -d mozilla_plugin_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have added all these rules into Fedora 17 policy, it should show up in the next policy update.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;This is why I live in Rawhide, I want to find problems before users do.&lt;/b&gt;</content:encoded>
	<dc:date>2012-03-22T14:19:45+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1976">
	<title>Adam Young: Fedora 16 Devstack</title>
    <link>http://adam.younglogic.com/2012/03/fedora-16-devstack/</link>
	<content:encoded>&lt;p&gt;Devstack is a developer tool for dealing with the wide array of projects that make up openstack.  The original devstack is Ubuntu specific.  Russell B has been working on getting Fedora its own Devstack.  Today, I’m a test subject.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1976&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Yesterday I got a Box from Spot that I gave a fresh  Fedora 16 install  including the yum group for Virtualization.  Downloaded and installed aF16 and a F17 VM,  so I know it can do the basics.&lt;/p&gt;
&lt;p&gt;Today’s notes:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;yum install git

git clone https://github.com/russellb/devstack.git

git branch --track fedora-support  remotes/origin/fedora-support

git checkout fedora-support
&lt;/pre&gt;
&lt;p&gt;edit localrc (inside the git repo, it has been .gitignored) and add the line:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;MESSAGING_SYSTEM=qpid
&lt;/pre&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;./stack.sh
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Output is :&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;which: no lsb_release in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/ayoung/.local/bin:/home/ayoung/bin)
./stack.sh: line 180: -q: command not found

The first warning is spurious.  The second Russell Fixed that by quoting
&lt;pre class=&quot;brush:bash&quot;&gt;CHECK_SUDO_CMD=&quot;rpm -q sudo&quot;
&lt;/pre&gt;
&lt;p&gt;And pushed to git.  fetc, rebase and now we are at:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;./stack.sh


which: no lsb_release in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/ayoung/.local/bin:/home/ayoung/bin)
sudo-1.8.3p1-2.fc16.x86_64
[sudo] password for ayoung:
eth0: error fetching interface information: Device not found

Could not determine host ip address.
Either localrc specified dhcp on eth0 or defaulted to eth0
&lt;/pre&gt;
&lt;p&gt;This host doesn't have eth0,  it has em1. So to fix that set add a line to localrc &lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;HOST_IP_IFACE=em1
&lt;/pre&gt;
&lt;p&gt;Ran ./stack again and:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;DEBUG:openstack_dashboard.settings:Running in debug mode without debug_toolbar.
Traceback (most recent call last):
#lines removed for brevity
File &quot;/opt/stack/horizon/horizon/decorators.py&quot;, line 29, in module
from horizon.exceptions import NotAuthorized, NotFound
File &quot;/opt/stack/horizon/horizon/exceptions.py&quot;, line 137, in module
swiftclient.Error,
&lt;/pre&gt;
&lt;p&gt;To disable that,  edit localrc and add the line (note: without horizon on it)&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-vol,n-sch,n-novnc,n-xvnc,n-cauth,mysql,rabbit
&lt;/pre&gt;
&lt;p&gt;And the install succeeded.  All processes are running in screens.  You'll probably want &lt;a href=&quot;http://www.gnu.org/software/screen/manual/screen.html&quot;&gt; The fine manual.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;screen -x takes me to a nova command (which I accidentally kill and then rerun, as it was the last thing in bash histroy..)&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; cd /opt/stack/nova &amp;amp;&amp;amp; /opt/stack/nova/bin/nova-objectstore
&lt;/pre&gt;
&lt;p&gt;Running Ctrl A &quot;  gives the following list of screens.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;0 stack
1 g-reg
2 g-api
3 key  
4 n-api
5 n-cpu
6 n-crt
7 n-vol
8 n-net
9 n-sch
10 n-novnc
11 n-xvnc
12 n-cauth
13 n-obj
&lt;/pre&gt;
&lt;p&gt;The g-  screens are glance processes and the n- screens are nova processes.  key is keystone.&lt;/p&gt;
&lt;p&gt;Kill all the screens with Ctrl-a /  and then rerun stack.sh to see any changes.&lt;/p&gt;&lt;/pre&gt;</content:encoded>
	<dc:date>2012-03-21T17:06:01+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55229.html">
	<title>Dan Walsh: Solution to /myapache labeling problem from yesterday...</title>
    <link>http://danwalsh.livejournal.com/55229.html</link>
	<content:encoded>Twitter's @Plaimclock  tweeted me @&lt;a href=&quot;https://twitter.com/#!/rhatdan&quot; rel=&quot;nofollow&quot;&gt;rhatdan&lt;/a&gt; yester. &lt;br /&gt;He pointed out that  &lt;a href=&quot;http://danwalsh.livejournal.com/54803.html&quot;&gt;yesterdays blog&lt;/a&gt; on SELinux Labeling did not provide a solution to the /myapache problem.&lt;br /&gt;&lt;br /&gt;The solution is to label /myapache and all its children with a label httpd can read. &lt;br /&gt;&lt;br /&gt;You can figure this out by using:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;man httpd_selinux&lt;/span&gt;&lt;br /&gt;...&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;      httpd_sys_content_t&lt;br /&gt;&lt;br /&gt;       - Set files with the httpd_sys_content_t type, if you want to treat the&lt;br /&gt;       files as httpd sys content.&lt;br /&gt;&lt;br /&gt;       Paths:&lt;br /&gt;            /usr/share/icecast(/.*)?,                  /usr/share/htdig(/.*)?,&lt;br /&gt;            /etc/htdig(/.*)?,                         /var/www/svn/conf(/.*)?,&lt;br /&gt;            /usr/share/doc/ghc/html(/.*)?,       /usr/share/mythtv/data(/.*)?,&lt;br /&gt;            /var/lib/htdig(/.*)?,                         /srv/gallery2(/.*)?,&lt;br /&gt;            /srv/([^/]*/)?www(/.*)?,               /usr/share/ntop/html(/.*)?,&lt;br /&gt;            /usr/share/mythweb(/.*)?,                /var/lib/cacti/rra(/.*)?,&lt;br /&gt;            /usr/share/openca/htdocs(/.*)?,            /usr/share/selinux-pol‐&lt;br /&gt;            icy[^/]*/html(/.*)?,   /usr/share/drupal.*,   /var/lib/trac(/.*)?,&lt;br /&gt;            /var/www(/.*)?, /var/www/icons(/.*)?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# ls -lZd /var/www/html&lt;br /&gt;drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You could simply put the labels in place using chcon.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;chcon -R -t httpd_sys_content_t /myapache&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The best solution is to tell SELinux about the label change.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# semanage fcontext -a -t httpd_sys_content_t '/myapache(/.*)?'&lt;br /&gt;# restorecon -R -v /myapache&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Done&lt;br /&gt;&lt;br /&gt;Note:  If you wanted to allow httpd to write to the directory you would use the httpd_sys_rw_content_t type.&lt;br /&gt;</content:encoded>
	<dc:date>2012-03-20T13:30:25+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54803.html">
	<title>Dan Walsh: SELinux Types Revisited.</title>
    <link>http://danwalsh.livejournal.com/54803.html</link>
	<content:encoded>A common mistake people make with SELinux is thinking all types are the same. &lt;br /&gt;&lt;br /&gt;I often get bugzilla's from people who first got a bug saying that httpd_t can not read some directory, say /myapache.  The admin then does some limited research and discovers the chcon command.  The admin then assumes if he uses the chcon command with the httpd type, it will solve his problem.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# chcon -t httpd_t /myapache&lt;br /&gt;chcon: failed to change context of `/myapache' to `staff_u:object_r:httpd_t:s0': Permission denied&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What, wait I am unconfined_t, why won't this be allowed.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# setenforce 0&lt;br /&gt;# chcon -t httpd_t /myapache&lt;br /&gt;#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Works, I guess I am all set.&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# setenforce 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Apache blows up.&lt;br /&gt;&lt;br /&gt;Now they have AVC messages that indicate they need&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;allow unconfined_t httpd_t:dir relabelto;&lt;br /&gt;allow httpd_t fs_t:filesystem associate;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since the admin forced the label onto the system, other parts of SELinux start to break.  Later locate runs and they get an AVC that requires&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;allow locate_t httpd_t:dir getattr;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What the ...&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The assumption, the administrator mistakenly made, was that all types are created equally.  But SELinux groups different types and then controls what &quot;Classes&quot; they can be assigned to.  SELinux block you from assigning a type to unsupported objects.&lt;br /&gt;&lt;br /&gt;For example SELinux has types for Files (file_type), Processes(domain), Ports (port_type), Ethernet Interfaces (netif_type), Node names (node_type), filesystems (filesystem_type) ...&lt;br /&gt;&lt;br /&gt;Types are grouped together using the policy attribute notated above within the ().&lt;br /&gt;&lt;br /&gt;SELinux only allows administrators to assign file_type to a filesystem_type object.  This access is controlled by the associate access.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# sesearch -A -s file_type -t filesystem_type -p associate  | grep file_type&lt;br /&gt;   allow file_type fs_t : filesystem associate ;&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want to list all file_types, execute:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;seinfo -afile_type -x&lt;br /&gt;   file_type&lt;br /&gt;      bluetooth_conf_t&lt;br /&gt;      cmirrord_exec_t&lt;br /&gt;      colord_exec_t&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have added an setroubleshoot plugin to Fedora 17 to try to help the administrator out.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;SELinux is preventing chcon from relabelto access on the directory myapache.&lt;br /&gt;&lt;br /&gt;*****  Plugin associate (99.5 confidence) suggests  **************************&lt;br /&gt;&lt;br /&gt;If you want to change the label of myapache to httpd_t, you are not allowed to since it is not a valid file type.&lt;br /&gt;Then you must pick a valid file label.&lt;br /&gt;Do&lt;br /&gt;select a valid file type.  List valid file labels by executing:&lt;br /&gt;# seinfo -afile_type -x&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope this hopes, although I agree this is a difficult concept to understand.</content:encoded>
	<dc:date>2012-03-19T16:06:00+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1972">
	<title>Adam Young: Announcing Dogtag 10.0.0 (Alpha)</title>
    <link>http://adam.younglogic.com/2012/03/announcing-dogtag-10-alpha/</link>
	<content:encoded>&lt;p&gt;The Dogtag team is pleased to announce the availability of an Alpha Release of the Dogtag 10.0 code.&lt;/p&gt;
&lt;p&gt;(Reposted from the pki-users mailing list)&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1972&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This release contains the following features:&lt;/p&gt;
&lt;p&gt;1. Extension of the functionality of the DRM to store and retrieve symmetric keys and passphrases,&lt;br /&gt;
rather than only asymmetric keys. This feature allows the DRM to be used as a secure&lt;br /&gt;
vault-like storage for essentially any sensitive data. The data is stored using the same&lt;br /&gt;
secure FIPS-compliant storage mechanism used to store PKI keys.&lt;br /&gt;
2. The new DRM functionality is exposed through a new REST interface, provided by the RESTEasy&lt;br /&gt;
framework. This provides an intuitive mechanism for writing clients to the interface. Both&lt;br /&gt;
Java (using the RESTEasy client proxy framework) and Python clients have been coded. The&lt;br /&gt;
server uses standard Java libraries to generate and parse XML or JSON input and output data.&lt;br /&gt;
3. Extracted authentication and authorization code from the individual servlets into a standard&lt;br /&gt;
Tomcat authentication realm. This realm has been configured to require client certificate&lt;br /&gt;
authentication, and is being used to secure the new DRM REST interface. In the future, this&lt;br /&gt;
authentication realm could be extended to include other kinds of authentication (such as&lt;br /&gt;
Kerberos). This is part of a push to refactor the code to expose the core business&lt;br /&gt;
functionality in the servlets, while extracting the ancillary tasks (authentication,&lt;br /&gt;
authorization, XML parsing and generation, etc.) and using standard methods and libraries to&lt;br /&gt;
accomplish these tasks.&lt;br /&gt;
4. Enhanced Java subsystems so that they could connect to the internal database using a&lt;br /&gt;
non-directory manager user, that is authenticated using client authentication. This resolves a&lt;br /&gt;
number of issues with LDAP operations ignoring search limits. In addition, some changes have&lt;br /&gt;
been made to allow integrating the Dogtag database with other systems such as IPA.&lt;br /&gt;
5. A new package pki-deploy contains the initial framework for a Python-based&lt;br /&gt;
installer/de-installer (pkispawn/pkidestroy) that will be used to install and configure a&lt;br /&gt;
Dogtag instance. This will ultimately replace the pki-setup installer/de-installer&lt;br /&gt;
(pkicreate, pkidestroy) package, and the pki-silent instance configuration (pkisilent) package.&lt;br /&gt;
6. Much of the focus of this release was on cleaning up and modernizing the Dogtag source code.&lt;br /&gt;
* Dogtag source code has been moved to git.&lt;br /&gt;
* Java coding standards have been revised – and the code has been reformatted to match those&lt;br /&gt;
standards.&lt;br /&gt;
* Initially, Eclipse reported about 13000 warnings in the dogtag code. Those have been reduced&lt;br /&gt;
to close to 2400. This included removing dead and unused code, replacing calls to deprecated&lt;br /&gt;
functions and replacing raw collections with type-safe generics.&lt;br /&gt;
NOTE: These numbers currently exclude console code.&lt;br /&gt;
* OSUtil is a package that has certain utilities that were not available when the Dogtag code&lt;br /&gt;
was originally written. These utilities are now available in current standard&lt;br /&gt;
libraries – and so this package has been eliminated entirely.&lt;br /&gt;
* Improved handling of short and long lived threads which allow threads to exit gracefully on&lt;br /&gt;
shutdown.&lt;/p&gt;
&lt;p&gt;The builds can be found at the following links:&lt;/p&gt;
&lt;p&gt;* http://pki.fedoraproject.org/pki/download/pki/10.0.0.alpha/fc16/RPMS/i686 – Fedora 16 (32-bit i686)&lt;br /&gt;
* http://pki.fedoraproject.org/pki/download/pki/10.0.0.alpha/fc16/RPMS/x86_64 – Fedora 16 (64-bit x86_64)&lt;br /&gt;
* http://pki.fedoraproject.org/pki/download/pki/10.0.0.alpha/fc16/SRPMS – Fedora 16 (Source)&lt;br /&gt;
* http://pki.fedoraproject.org/pki/download/pki/10.0.0.alpha/fc17/RPMS/i686 – Fedora 17 (32-bit i686)&lt;br /&gt;
* http://pki.fedoraproject.org/pki/download/pki/10.0.0.alpha/fc17/RPMS/x86_64 – Fedora 17 (64-bit x86_64)&lt;br /&gt;
* http://pki.fedoraproject.org/pki/download/pki/10.0.0.alpha/fc17/SRPMS – Fedora 17 (Source)&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-15T18:38:38+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54707.html">
	<title>Dan Walsh: Secure Boot versus Ksplice.</title>
    <link>http://danwalsh.livejournal.com/54707.html</link>
	<content:encoded>I have been attending many talks on Secure Boot.  The basic idea behind secure boot is to ensure that the bios/bootloader and kernel have not been hacked.  My understanding of how this is done is everything is signed and verified during the bootup.  Nothing can run in the kernel that was not signed and verified.  &lt;br /&gt;&lt;br /&gt;Then we Oracle pushing Ksplice.&lt;br /&gt;&lt;br /&gt;I can't help but ask the question?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is ksplice a security disaster waiting to happen?&lt;/b&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-03-15T12:50:56+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1872">
	<title>Adam Young: HATEOAS Openstack Keystone</title>
    <link>http://adam.younglogic.com/2012/03/hateoas-openstack-keystone/</link>
	<content:encoded>&lt;p&gt;Of all the principals of REST, perhaps the most overlooked it &lt;a href=&quot;http://en.wikipedia.org/wiki/HATEOAS&quot; target=&quot;_blank&quot; title=&quot;HATEOAS&quot;&gt;Hypermedia as the Engine of Application State&lt;/a&gt;, or HATEOAS. This term tries to encapsulate several concepts together, but the primary is the principal of discoverability.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;All future actions the client may take are discovered within resource representations returned from the server.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What does this mean for Keystone?&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1872&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Keystone is currently a fairly simplistic application.  It can issue tokens to users,  and it can verify that a given token has been assigned to a user.  Assuming for the moment that this is all we want to be able to do,  we should be able to discover this from the top down.&lt;/p&gt;
&lt;p&gt;Keystone listens on two ports: &lt;em&gt;5000&lt;/em&gt; and &lt;em&gt;35357&lt;/em&gt;.  Pointing a browser at either of these should be the start of the discovery process.  Indeed,  we see that the server returns three hyperlinks to us.  The second and third links  are for documentation,  and lead us not to other resources controlled by the server,  but back to docs.openstack.org.  Only the first provides guidance,  but it makes an interesting design decision.  It points us to the sub url for a version of the Keystone library.  On my development server, this url is http://localhost:5000/v2.0/.  Submitting this URL only provides us with the same information again.&lt;/p&gt;
&lt;p&gt;What should it show us?  Lets forget for a moment that this service is specifically for programmatic use, and imagine instead that we are building a web based user interface.  From previous experience,  we know that the URL to request a token is http://0.0.0.0:5000/v2.0/tokens.  However, this is specifically accessed via a POST action.  &lt;/p&gt;
&lt;p&gt;Lets ignore authentication for a moment.  Keystone integrates authentication with token access.  However, they are distinct options.  If we remove the password value from the “request token” form we get something that accepts:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;userid&lt;/dt&gt;
&lt;dd&gt;The user that should be associated with the token.  This can be the authenticated user, but there are use cases where it we might want to delegate the ability to create a token.&lt;/dd&gt;
&lt;dt&gt;tenantId&lt;/dt&gt;
&lt;dd&gt;This limits the scope of the token&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;So without authentication,  other applications need a way to indicate that they should provide this data in order to create a token.  For a webUI, this would be something like:&lt;/p&gt;
&lt;pre class=&quot;brush:html&quot;&gt;&lt;form action=&quot;http://adam.younglogic.com/feed/tokens&quot; method=&quot;post&amp;quot;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;userid&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;tenantid&quot; /&gt;
&lt;input type=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;p&gt;Aside from this being a functional form in its own right, it provides sufficient information to another system to indicate how to create a new token.&lt;/p&gt;
&lt;p&gt;The URL of the token validation is of the form  http://0.0.0.0:35357/v2.0/tokens/$TOKEN,  we would want a form that allows the user to submit that value.  A Form can do a Get action, but it cannot rewrite the target hyperlink without Javascript, something we would avoid here.  We do not want to enumerate all tokens, as that would wrongly expose shared secrets.  Thus, a post to an URL with a parameter of the token ID, as well as any other identifying information required would be more useful.  This would be token id,  user id, and tenant id.  The HTML response code would be 200, and the body of the response would indicate valid or invalid.  This post could also return a hyperlink to the original  URL  of the form http://0.0.0.0:35357/v2.0/tokens/$TOKEN,  and that URL would still be accessible via HTTP GET.&lt;/p&gt;
&lt;pre class=&quot;brush:html&quot;&gt;&lt;form action=&quot;http://adam.younglogic.com/feed/token/validate&quot; method=&quot;post&amp;quot;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;token&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;userid&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;tenantid&quot; /&gt;
&lt;input type=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;p&gt;This form could easily be displayed in JSON:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;{&quot;fields&quot;:[&quot;name&quot;,&quot;userid&quot;,&quot;tenantid&quot;]}
&lt;/pre&gt;
&lt;p&gt;This would could be extended with more information about fields types and so forth.&lt;/p&gt;
&lt;p&gt;So from the tope level of the Keystone site,  once the user is authenticated and has passed down through the hyperlinks:&lt;/p&gt;
&lt;pre class=&quot;brush:html&quot;&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://adam.younglogic.com/feed/tenants&quot;&gt;Tenants&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://adam.younglogic.com/feed/tokens&quot;&gt;Tokens&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/pre&gt;
&lt;p&gt;And clicking through to tokens:&lt;/p&gt;
&lt;pre class=&quot;brush:html&quot;&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://adam.younglogic.com/feed/token/abcd&quot;&gt;abcd&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://adam.younglogic.com/feed/token/fghi&quot;&gt;fghi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Add New Token&lt;/h2&gt;
&lt;form action=&quot;http://adam.younglogic.com/feed/tokens&quot; method=&quot;post&amp;quot;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;userid&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;tenantid&quot; /&gt;
&lt;input type=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;h2&gt;Validate Token&lt;/h2&gt;
&lt;form action=&quot;http://adam.younglogic.com/feed/token/validate&quot; method=&quot;post&amp;quot;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;token&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;userid&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;tenantid&quot; /&gt;
&lt;input type=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;p&gt;These last two forms probably should only be shown if the content type is set to HTM or XHTML.  &lt;/p&gt;
&lt;p&gt;Right now,  even if content type is set to HTML,  Keystone resorts to XML.  The first step is to add a marshaller for HTML alongside to the JSON and XML marshallers, and then to support each of the content types equally.&lt;/p&gt;
&lt;p&gt;Should Keystone support HATEOAS?  I’d say yes.  It makes the system more transparent and less surprising.  It will give the implementors a means to debug at the server level, while not denying them the ability to hit things programmatically or from the CLI.  It will also, I think make the desig more solid move forward, as it will be more visually obvious how the different members of the Keystone domain model fit together.&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-15T01:47:23+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1910">
	<title>Adam Young: Dependency Injection in Python</title>
    <link>http://adam.younglogic.com/2012/03/di-python/</link>
	<content:encoded>&lt;p&gt;Object oriented design principals are not language specific.  While there is variation from language to language on details of implementations, and some techniques are not appropariate to all languages,  for the most part,  good design is good design.&lt;br /&gt;
&lt;span id=&quot;more-1910&quot;&gt;&lt;/span&gt;&lt;br /&gt;
One principal worth emphasizing in any Object Oriented system is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Single_responsibility_principle&quot;&gt;Single Responsibility Principal&lt;/a&gt;.  An object should do one thing, and do it well.  However,  that object will often need another object to complete a portion of its work.  In simple cases,  one object can control the lifespan of the dependency.  As systems get more complex,  these relationships grow more complex.  In order to make objects reusable throughout a system and possibly even in other systems,  the developer refactors the code,  not chaning the behavior,  but only the structure.  One step is to &lt;a href=&quot;http://martinfowler.com/refactoring/catalog/addParameter.html&quot;&gt;Introduce a parameter&lt;/a&gt; to the constructor, in order to extract the construction code from the dependant object.   What code now links up this dependency?&lt;/p&gt;
&lt;p&gt;One reason that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Singleton_pattern&quot;&gt;Singleton Design Pattern&lt;/a&gt; is commonly used is that it provides an unmistakble instance of the object to use.  Ideally, a Dependency Injection framework would provide the same degree of confidence,  but with a more flexible means of providing mechanism for specifying how to create the dependent object.  Using a singleton to get an object usually looks like this:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;myobject=packagename.Instance
&lt;/pre&gt;
&lt;p&gt;Which, of course, assumes that the instace has already been created.  If you can’t be assured of that fact, the code is more likely to look like:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;myobject=packagename.Instance()
&lt;/pre&gt;
&lt;p&gt;Where instance is logic along the lines of:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;instance=None
def Instance():
     if not instance:
         instance = MyLocalInstanceCreator()
     return instance
&lt;/pre&gt;
&lt;p&gt;As you see here, I’ve split up the construction of the function from the caching of the resultant variable.  Remember this technique…&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;http://keystone.openstack.org/&quot;&gt;Keystone&lt;/a&gt; code, we have a business object that encpsulates the Identity operations of the system:  managing users, tenants, and roles.  There are several implementations of this business object, depending on where the data is stores.  We have one instace for SQL, and another for LDAP, as well as several others.  To indicate that a given installation uses the SQL back end,  the administrator should add the following line into the configuration file:&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;[identity]
driver = keystone.identity.backends.sql.Identity
&lt;/pre&gt;
&lt;p&gt;The configuration for this Driver is then pulled from the appropriate section.  For SQL,  the block would look something like this:&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;[sql]
connection = sqlite:///bla.db
idle_timeout = 200
min_pool_size = 5
max_pool_size = 10
pool_timeout = 200
&lt;/pre&gt;
&lt;p&gt;Whereas,  if the Driver is set to the LDAP driver you would have text like this:&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;[ldap]
url = ldap://localhost
user = dc=Manager,dc=example,dc=com
password = freeipa4all
suffix = cn=example,cn=com

[identity]
driver = keystone.identity.backends.ldap.Identity
&lt;/pre&gt;
&lt;p&gt;The class that implements the identity is now accessble from the configuration object via the api:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;identity = CONF.identity.driver
&lt;/pre&gt;
&lt;p&gt;And the SQL identity Driver loads itself.  However, if random code in the application wants to access the identity driver, it now has to go looking for the singleton instance that has already constructed the identity object and called on that.  SQL dervices from code in Common, as does the LDAP code,  but the construction mechanisms are very different.&lt;/p&gt;
&lt;p&gt;We can take these two branches and unify them into a single approach with the example above.  &lt;/p&gt;
&lt;p&gt;For SQL,  we first define a function that creates the SQL Identity provider.  To keep things simple for now, we will continue to use the constructor.  We do the same for LDAP.  To determine which to call looks like this:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;identity=None
def Identity(CONF):
     if not identity:
         identity = get_class(CONF.idenity.driver)()
     return identity
&lt;/pre&gt;
&lt;p&gt;I’m assuming &lt;strong&gt;get_class&lt;/strong&gt; is something &lt;a href=&quot;http://stackoverflow.com/questions/452969/does-python-have-an-equivalent-to-java-class-forname&quot;&gt;along the lines described here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We are going to be seeing this pattern over and over again.  For example, the identity driver needs the SQL database connection,  but other business objects will also need the SQL database connection.  The same goes for every external resource in the application.  With a minor extension to our code, we can create a pattern of object access that is consistant across all global objects.&lt;/p&gt;
&lt;p&gt;When we start up the application, we register the factory functions that create the instances based on the unique key used to look them up.  In this case, we will use the same key were using before:  &lt;em&gt;the python class name&lt;/em&gt;.&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;def create_identity_driver():
     return get_class(CONF.idenity.driver)()

def factories = {keystone.identity.Driver: create_identity_driver}

instances = dict()

def get_instance(classname):
    try:
        instance = instances(classname)
    except:
        instance = factories[classname]()
        instances[classname] = instance
    return instance
&lt;/pre&gt;
&lt;p&gt;This is the simplest case of inversion of control.  Instad of creating objects directly,  you register their factories, and let the application create them for you on demand.  I’ve taken this a little further.  &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/admiyo/python-resolver&quot;&gt;Please check out my full code, to include test cases, on github.&lt;/a&gt;  This project will continue to evolve.&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-14T15:48:39+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54343.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VIII - New SELinux Domains in F17</title>
    <link>http://danwalsh.livejournal.com/54343.html</link>
	<content:encoded>Each Fedora we release a bunch of new domains that will run in permissive mode for the release.  When the next release is released, the permissive domains are made enforcing.&lt;br /&gt;&lt;br /&gt;In my blog,&lt;a href=&quot;http://danwalsh.livejournal.com/42394.html&quot;&gt;10 things you probably did not know about SELinux.. #4&lt;/a&gt;, I describe how you can interact with permissive domains.&lt;br /&gt;&lt;br /&gt;Any ways these are the permissive domains in Fedora 16 that will now be confined.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 16 Permissive Domains&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;pptp_t quota_nld_t sshd_sandbox_t nova_ajax_t nova_api_t nova_compute_t nova_direct_t nova_network_t nova_objectstore_t nova_scheduler_t nova_vncproxy_t nova_volume_t rabbitmq_epmd_t rabbitmq_beam_t deltacloudd_t iwhd_t mongod_t thin_t chrome_sandbox_nacl_t matahari_sysconfigd_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 17 Permissive Domains&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;couchdb_t (/usr/bin/couchdb)&lt;br /&gt;blueman_t (/usr/libexec/blueman-mechanism)&lt;br /&gt;httpd_zoneminder_script_t (/usr/libexec/zoneminder/cgi-bin(/.*)?)&lt;br /&gt;zoneminder_t (/usr/bin/zmpkg.pl)&lt;br /&gt;selinux_munin_plugin_t (/usr/share/munin/plugins/selinux_avcstat)&lt;br /&gt;sge_shepherd_t (/usr/bin/sge_shepherd)&lt;br /&gt;sge_execd_t (/usr/bin/sge_execd)&lt;br /&gt;sge_job_t&lt;br /&gt;matahari_rpcd_t (/usr/bin/sge_execd)&lt;br /&gt;keystone_t (/usr/bin/keystone-all)&lt;br /&gt;pacemaker_t (/usr/sbin/pacemakerd)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Of course I reserve the right to add to this list.  our goal is to make sure all init/dbus services run with a type other then initrc_t. &lt;br /&gt;&lt;br /&gt;If you see a process on your machine that is shipped from Fedora running as initrc_t, please open a bugzilla on SELinux policy.</content:encoded>
	<dc:date>2012-03-13T14:47:35+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54092.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VII - thumbnail protection.</title>
    <link>http://danwalsh.livejournal.com/54092.html</link>
	<content:encoded>&lt;p&gt;John Leyden wrote an interesting article &lt;a href=&quot;http://www.theregister.co.uk/2011/02/09/linux_autorun_problems/&quot; rel=&quot;nofollow&quot;&gt;Linux vulnerable to Windows-style autorun exploits&lt;/a&gt;, about how security researches had discovered that Linux is potentially vulnerable to a user sticking a USB device or CDRom into a locked machine.  The basic idea was that &quot;Nautilus&quot; would execute thumbnail drive code, to display thumbnails icons in the file browsers based on the content on the removable media, even if the machine was locked.  If the thumbnail executables were vulnerabile, a cracker could use the code used to process the thumbnail images to kill the screensaver/lock. &lt;br /&gt;&lt;br /&gt;Never mind this, just plugging in a USB stick when you a logged in, could allow a cracker to take over your machine.&lt;br /&gt;&lt;br /&gt;At that time, I wrote policy for all thumbnail drivers to be locked down with SELinux, but I only turned it on for confined users.&lt;br /&gt;I and other users have been running this confinement thoughout Fedora 16. &lt;br /&gt;&lt;br /&gt;In Fedora 17 I have turned this on for the unconfined user. &lt;br /&gt;&lt;br /&gt;We are confining the following applications.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;/usr/bin/evince-thumbnailer&lt;br /&gt;/usr/bin/ffmpegthumbnailer&lt;br /&gt;/usr/bin/gnome-exe-thumbnailer.sh&lt;br /&gt;/usr/bin/gnome-nds-thumbnailer&lt;br /&gt;/usr/bin/gnome-xcf-thumbnailer&lt;br /&gt;/usr/bin/gsf-office-thumbnailer&lt;br /&gt;/usr/bin/raw-thumbnailer&lt;br /&gt;/usr/bin/shotwell-video-thumbnailer&lt;br /&gt;/usr/bin/totem-video-thumbnailer&lt;br /&gt;/usr/bin/whaaw-thumbnailer&lt;br /&gt;/usr/lib(64)?/tumbler-1/tumblerd&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have seen these applications try to &quot;execstack&quot; when running mplayer executable on an thumbnails, kind of scary.&lt;br /&gt;&lt;br /&gt;If you know of other thumbnail applications that get launched as thumbnails, please tell me.&lt;br /&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-12T15:55:56+00:00</dc:date>
</item>
<item rdf:about="http://mgrepl.wordpress.com/?p=142">
	<title>Miroslav Grepl: How to confine a new service using an available policy</title>
    <link>http://mgrepl.wordpress.com/2012/03/08/how-to-confine-a-new-service-using-an-available-policy/</link>
	<content:encoded>&lt;p&gt;Sometimes new services, which are a part of a project, are added. For example we could talk about cluster, cloudform, MRG services and so on. Yesterday I got a new bug with the following description&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
“matahari-qmf-rpcd runs as initrc_t”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It means that our policy does not cover the matahari-qmf-rpcd service which probably has been shipped recently. I know nothing about this service and I want to confine it. I am not sure if we have a policy for Matahari project so I use the selinux-policy-doc package to check it.&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ rpm -q selinux-policy-doc&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;selinux-policy-doc-3.10.0-96.fc17.noarch&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;The package is installed and I am able to find whether a policy exists&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ grep -r matahari /usr/share/selinux/devel/include/ |wc -l&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;256&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;There is a policy which I could use. We are interested in the &lt;em&gt;/usr/share/selinux/devel/include/services/matahari.if&lt;/em&gt; policy file and the &lt;em&gt;matahari_domain_template()&lt;/em&gt; interface. A template interface is a special interface to create a basic set of rules for services – template interfaces generate domain, executable and file types for a service. &lt;/p&gt;
&lt;p&gt;In our case I declare the following local policy.&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ cat mymatahari.te&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;policy_module(mymatahari,1.0)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;matahari_domain_template(rpcd)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Then I load and install it.&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ make -f /usr/share/selinux/devel/Makefile mymatahari.pp&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;$ semodule -i mymatahari.pp&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;You can see what types were added.&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ seinfo -t |grep matahari_rpc&lt;/font&gt;&lt;br /&gt;
   &lt;font color=&quot;blue&quot;&gt;matahari_rpcd_unit_file_t&lt;/font&gt;&lt;br /&gt;
   &lt;font color=&quot;blue&quot;&gt;matahari_rpcd_exec_t&lt;/font&gt;&lt;br /&gt;
   &lt;font color=&quot;blue&quot;&gt;matahari_rpcd_t&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;These three types were created by the matahari_domain_template() interface and we use them for an initial confinement. Now we need to tell SELinux that the matahari-qmf-rpcd service started by systemd should end up in the matahari_rpcd_t domain.&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ chcon -t matahari_rpcd_exec_t `which matahari-qmf-rpcd`&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;$ systemctl restart matahari-rpc.service&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;$ ps -eZ |grep matahari&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;system_u:system_r:matahari_rpcd_t:s0 3338 ?    00:00:00 matahari-qmf-rp&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;You are done and you have this new service running in the proper domain. Now you can use ausearch/audit2allow tools to check AVC messages&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ ausearch -m avc -ts recent |audit2allow&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;#============= matahari_rpcd_t ==============&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;allow matahari_rpcd_t bin_t:file getattr;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;allow matahari_rpcd_t passwd_file_t:file { read getattr open };&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;allow matahari_rpcd_t usr_t:file { read getattr open };&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;The next step would be either file a new bug with these AVC messages and with the local policy or use the audit2allow tool to generate rules for the mymatahari.te policy file.&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;blue&quot;&gt;$ ausearch -m avc -ts recent |audit2allow -R |grep \(matahari &amp;gt;&amp;gt; mymatahari.te&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;$ make -f /usr/share/selinux/devel/Makefile mymatahari.pp&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;blue&quot;&gt;$ semodule -i mymatahari.pp&lt;/font&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/comments/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/delicious/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/facebook/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/twitter/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/stumble/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/digg/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/mgrepl.wordpress.com/142/&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://feeds.wordpress.com/1.0/reddit/mgrepl.wordpress.com/142/&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;img src=&quot;http://stats.wordpress.com/b.gif?host=mgrepl.wordpress.com&amp;amp;blog=26699041&amp;amp;post=142&amp;amp;subd=mgrepl&amp;amp;ref=&amp;amp;feed=1&quot; alt=&quot;&quot; height=&quot;1&quot; border=&quot;0&quot; width=&quot;1&quot; /&gt;</content:encoded>
	<dc:date>2012-03-08T21:56:41+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53878.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VI - man pages for SELinux user/role domains</title>
    <link>http://danwalsh.livejournal.com/53878.html</link>
	<content:encoded>Ok, maybe this should be Security Feature IV.5 but Roman numerals do not support decimal points.  :^)&lt;br /&gt;&lt;br /&gt;After I wrote the tool to &lt;a href=&quot;http://danwalsh.livejournal.com/52156.html&quot;&gt;generate service domains man pages&lt;/a&gt;, Miroslav Grepl thought it would be a good idea to generate similar policy for user domains and roles.&lt;br /&gt;&lt;br /&gt;We hacked up a new script called &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/segenuserman&quot; rel=&quot;nofollow&quot;&gt;segenuserman&lt;/a&gt;, which generates 13 new SELinux user and Role man pages.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: smaller;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;auditadm_selinux.8  git_shell_selinux.8  logadm_selinux.8 secadm_selinux.8    sysadm_selinux.8 user_selinux.8    xguest_selinux.8 dbadm_selinux.8 guest_selinux.8  nx_server_selinux.8  staff_selinux.8 unconfined_selinux.8  webadm_selinux.8&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: smaller;&quot;&gt;Note segenuserman also requires &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/senetwork.py&quot; rel=&quot;nofollow&quot;&gt;senetwork.py&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is the &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/staff_selinux.html&quot; rel=&quot;nofollow&quot;&gt;staff_selinux.8&lt;/a&gt; for an SELinux user, and &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/webadm_selinux.html&quot; rel=&quot;nofollow&quot;&gt;webadm_selinux.8&lt;/a&gt; for an SELinux role.&lt;br /&gt;&lt;br /&gt;I have also updated the SELinux service domain man pages to include booleans,process types, file context paths, better descriptions, network ports.&lt;br /&gt;&lt;br /&gt;Here is an update &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/zebra_selinux.html&quot; rel=&quot;nofollow&quot;&gt;zebra_selinux.8&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-03-08T16:46:18+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53603.html">
	<title>Dan Walsh: Excuse me son, but your code is leaking !!!</title>
    <link>http://danwalsh.livejournal.com/53603.html</link>
	<content:encoded>I have written over the years about leaked file descriptors, and what a pain they have been to SELinux.&lt;br /&gt;&lt;br /&gt;C on Unix many many years ago was designed to leak by default.  A file descriptor is leaked if you open a file descriptor or socket and then do a fork/exec.  The new process will automatically get access to the file descriptor unless SELinux blocks it. &lt;br /&gt;&lt;br /&gt;When SELinux blocks the leaked file descriptor you usually end up with a strange looking AVC about the new domain trying to read or write a random file or a socket owned by the parent or even worse an ancestor.&lt;br /&gt;&lt;br /&gt;Talking with Uli Drepper the other day about leaked file descriptors.  He reminded me that the gcc/glibc teams had added a flags to open,fopen, socket, accept4 to change the default.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;man open&lt;br /&gt;...&lt;br /&gt;By  default,  the  new  file descriptor is set to remain open across an execve(2) (i.e., the  FD_CLOEXEC  file  descriptor  flag  described  in fcntl(2)  is  initially  disabled; the O_CLOEXEC flag, described below, can be used to change this default).&lt;br /&gt;...&lt;br /&gt;O_CLOEXEC (Since Linux 2.6.23)          Enable the close-on-exec  flag  for  the  new  file  descriptor. Specifying  this  flag  permits  a  program  to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC  flag.   Additionally,  use  of  this flag is essential in some multithreaded programs since using a separate fcntl(2)  F_SETFD  operation  to set  the  FD_CLOEXEC  flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same  time as another thread does a fork(2) plus execve(2).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sadly this can not be made the default, but as a good programing practice all open/socket,accept and fopen calls should use this flag in order to close the file descriptor by default.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;open(path, O_CLOEXEC | flags)&lt;br /&gt;socket(DOMAIN, SOCK_CLOEXEC | type, PROTOCOL)&lt;br /&gt;accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, SOCK_CLOEXEC | flags);&lt;br /&gt;fopen(path, &quot;re&quot;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you can not open a file descriptor with one of these commands then you can execute&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;fctnl(fd, F_SETFD, FD_CLOEXEC)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;He gcc developers or code analysys tools, you probably should catch when leaks happen, especially if they are not STDIN, STDOUT, STDERR.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Just be neat and stop leaking all over the place.&lt;/b&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-03-08T04:34:27+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53378.html">
	<title>Dan Walsh: bash completion for setsebool/getsebool added for Fedora 17</title>
    <link>http://danwalsh.livejournal.com/53378.html</link>
	<content:encoded>&lt;span style=&quot;color: #000000;&quot;&gt;policycoreutils-python-2.1.10-26.fc17.x86_64 now has bash completion scripts for semanage and setsebool/getsebool&lt;br /&gt;&lt;br /&gt;/etc/bash_completion.d/semanage-bash-completion.sh&lt;br /&gt;/etc/bash_completion.d/setsebool-bash-completion.sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;# getsebool -&amp;lt;tab&amp;gt;&lt;br /&gt;# getsebool -a&lt;br /&gt;&lt;br /&gt;# getsebool samba_&amp;lt;tab&amp;gt;&lt;br /&gt;samba_create_home_dirs   samba_export_all_ro      samba_share_fusefs&lt;br /&gt;samba_domain_controller  samba_export_all_rw      samba_share_nfs&lt;br /&gt;samba_enable_home_dirs   samba_run_unconfined   &lt;br /&gt;&lt;br /&gt;# setsebool -&amp;lt;tab&amp;gt;&lt;br /&gt;# setsebool -P&amp;lt;tab&amp;gt;&lt;br /&gt;&lt;br /&gt;# setsebool -P samba_&amp;lt;tab&amp;gt;&lt;br /&gt;samba_create_home_dirs   samba_export_all_ro      samba_share_fusefs&lt;br /&gt;samba_domain_controller  samba_export_all_rw      samba_share_nfs&lt;br /&gt;samba_enable_home_dirs   samba_run_unconfined &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;semanage completion is a little more complicated.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# semanage &amp;lt;tab&amp;gt;&lt;br /&gt;boolean     fcontext    login       node        port       &lt;br /&gt;dontaudit   interface   module      permissive  user&lt;br /&gt;&lt;br /&gt;# semanage fcontext -&amp;lt;tab&amp;gt;&lt;br /&gt;-a           -d           --deleteall  -f           --help       --modify&lt;br /&gt;--add        -D           -e           --ftype      --locallist  -t&lt;br /&gt;-C           --delete     --equal      -h           -m           --type&lt;br /&gt;&lt;br /&gt;# semanage fcontext -a -t samba&amp;lt;tab&amp;gt;&lt;br /&gt;samba_etc_t                     samba_secrets_t&lt;br /&gt;sambagui_exec_t                 samba_share_t&lt;br /&gt;samba_initrc_exec_t             samba_unconfined_script_exec_t&lt;br /&gt;samba_log_t                     samba_unit_file_t&lt;br /&gt;samba_net_exec_t&lt;br /&gt;&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Try it out.  If you find problems, patches accepted... :^)</content:encoded>
	<dc:date>2012-03-06T16:43:32+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1922">
	<title>Adam Young: F17 Openstack Test Day on Thursday.</title>
    <link>http://adam.younglogic.com/2012/03/f17-openstack-test-day-on-thursday/</link>
	<content:encoded>&lt;p&gt;If you want Openstack support for Fedora or RHEL,  this day is for you!  Once we get the F17 code stable,  we will use that as the code base for EPEL,  so lend a hand.&lt;/p&gt;
&lt;p&gt;https://fedoraproject.org/wiki/Test_Day:2012-03-08_OpenStack_Test_Day&lt;/p&gt;
&lt;p&gt;I’ll be lurking around to help out with Keystone questions,  but at the same time I’ll also be involved with a &lt;a href=&quot;http://www.meetup.com/Openstack-Boston/events/53635802/&quot; target=&quot;_blank&quot; title=&quot;Boston Openstack meetup installfest&quot;&gt;local  installfest&lt;/a&gt; so I expect to be logged in to IRC,  but also very much walking around and answering questions….as well as running through test cases myself.&lt;/p&gt;
&lt;p&gt;So join us:&lt;/p&gt;
&lt;p&gt;IRC 	#fedora-test-day on Freenode&lt;br /&gt;
WebIRC: &lt;a href=&quot;http://webchat.freenode.net/?channels=fedora-test-day&quot;&gt;http://webchat.freenode.net/?channels=fedora-test-day &lt;/a&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-06T01:38:57+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53182.html">
	<title>Dan Walsh: senetwork: new tool for examining SELinux networking policy.</title>
    <link>http://danwalsh.livejournal.com/53182.html</link>
	<content:encoded>A couple of years ago I added some python bindings for setools.  I hoped we would start to see new tools arise to analyze SELinux policy.  Maybe making SELinux easier to user and understand. &lt;br /&gt;&lt;br /&gt;Lately I have gone back to these tools and started playing with them to see what tools I could build. &lt;br /&gt;&lt;br /&gt;Last couple of days I have hacked together a little script called &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/senetwork&quot; rel=&quot;nofollow&quot;&gt;senetwork&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The goal was to answering questions like:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What ports can a particular domain connect to?  Bind to?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# senetwork ftpd_t&lt;br /&gt;ftpd_t tcp name_connect&lt;br /&gt;    ephemeral_port_t: 32768-61000&lt;br /&gt;    ldap_port_t: 389,636,3268&lt;br /&gt;    dns_port_t: 53&lt;br /&gt;    ocsp_port_t: 9080&lt;br /&gt;    kerberos_port_t: 88,750,4444&lt;br /&gt;ftpd_t tcp name_bind&lt;br /&gt;    ephemeral_port_t: 32768-61000&lt;br /&gt;    ftp_port_t: 21,990&lt;br /&gt;    ftp_data_port_t: 20&lt;br /&gt;    unreserved_port_t: 1024-32767,61001-65535&lt;br /&gt;    port_t: all ports with out defined types&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What type(s) are associated with a particular port number?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# senetwork 8080&lt;br /&gt;8080: tcp unreserved_port_t 1024-32767&lt;br /&gt;8080: udp unreserved_port_t 1024-32767&lt;br /&gt;8080: tcp http_cache_port_t 8080&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What ports are associated with a particular port_type?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# senetwork ftp_port_t&lt;br /&gt;ftp_port_t: tcp: 21,990&lt;br /&gt;ftp_port_t: udp: 990&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Basically senetwork looks at the argument and figures out whether or not it is a number, port type or domain type&lt;br /&gt;and then prints out the information.&lt;br /&gt;&lt;br /&gt;I plan on packaging up these little scriptlets with setools-console.&lt;br /&gt;</content:encoded>
	<dc:date>2012-03-02T21:35:09+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1895">
	<title>Adam Young: Booting a LiveCD as a Virtual Machine</title>
    <link>http://adam.younglogic.com/2012/03/booting-livecd-as-vm/</link>
	<content:encoded>&lt;p&gt;As a Fedora Community Member, I always feel guilty if I postpone trying out a testing release of Fedora. Since I have a limited amount of hardware, I can’t just install on a physical machine. Turns out that testing on a virtual machine is about as easy as it can be.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1895&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The following works well on Fedora 16 running KVM.&lt;/p&gt;
&lt;p&gt;Download the LiveCD.&lt;/p&gt;
&lt;p&gt;Open Up virt-manager&lt;/p&gt;
&lt;p&gt;type in password and connect to your local hypervisor&lt;/p&gt;
&lt;p&gt;Rightclick on localhost. From the popup menu select &lt;strong&gt;New&lt;/strong&gt;&lt;br /&gt;
Add a new virtual machine, and select &lt;strong&gt;Import Existing Disk Image&lt;/strong&gt;. Give the VM a name and click &lt;em&gt;Forward&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/CreateNewVM.png&quot;&gt;&lt;img src=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/CreateNewVM-202x300.png&quot; title=&quot;CreateNewVM&quot; height=&quot;300&quot; width=&quot;202&quot; alt=&quot;&quot; class=&quot;alignleft size-medium wp-image-1911&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Find the virtual machine. If you downloaded it to the default location, you’ll have to select &lt;strong&gt;Browse&lt;/strong&gt;, and then &lt;strong&gt;Browse Local.  &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/BrowseForVM.png&quot;&gt;&lt;img src=&quot;http://adam.younglogic.com/wp-content/uploads/2012/03/BrowseForVM-300x213.png&quot; title=&quot;BrowseForVM&quot; height=&quot;213&quot; width=&quot;300&quot; alt=&quot;&quot; class=&quot;alignleft size-medium wp-image-1913&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Mine is at /home/ayoung/Downloads/Fedora-17-Alpha-x86_64-Live-Desktop.iso&lt;/p&gt;
&lt;p&gt;You can click through to the end of the wizard now if you want. The select boxes for  OS Type and Version  will have no real effect.  Take the default for memory and CPUs, or increase them if you really want. Click &lt;em&gt;finish&lt;/em&gt; and your VM should be booting shortly.&lt;/p&gt;
&lt;p&gt;Now you really have no reason not to try out Fedora 17.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</content:encoded>
	<dc:date>2012-03-02T18:10:40+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1907">
	<title>Adam Young: PKI for Keystone</title>
    <link>http://adam.younglogic.com/2012/03/pki-for-keystone/</link>
	<content:encoded>&lt;p&gt;A recent discussion on the Openstack mailing list brought to light the high load that the Keystone server has due to each server having to authenticate each and every request against Keystone.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1907&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;While appropriate caching will obviously limit some aspect of the traffic,  there is another approach that will remove  it altogether. If each token issued by the Keystone server is a document that is cryptographically signed by a private key, its authenticity can be verified by a public key published by the Keystone server.  This transfers the burden from Network traffic to CPU for decrypting.&lt;/p&gt;
&lt;p&gt;The public keys should have a relatively short lifespan,  probably being updated no less frequently than once a day,  the current lifespan of a ticket.&lt;/p&gt;
&lt;p&gt;The public key should be published as an X509 certificate, signed by a local Certificate Authority.&lt;/p&gt;
&lt;p&gt;Keystone should be able to publish a  revocation list in case a user loses privileges.  Since the lifespan of tokens is short, the revocation lists should be minimal, and do not need to be kept past the lifespan of the associated tokens.&lt;/p&gt;
&lt;p&gt;Both Kerberos and Dogtag PKI  have all of the capabilities listed above.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</content:encoded>
	<dc:date>2012-03-02T02:37:26+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1896">
	<title>Adam Young: Keystone should move to Apache HTTPD</title>
    <link>http://adam.younglogic.com/2012/03/keystone-should-move-to-apache-httpd/</link>
	<content:encoded>&lt;p&gt;Keystone and the other Openstack components run in an &lt;a href=&quot;http://www.eventlet.net&quot;&gt;Eventlet&lt;/a&gt; based HTTP server. Eventlet and &lt;a href=&quot;http://http://pypi.python.org/pypi/greenlet&quot;&gt; Greenlet&lt;/a&gt; (the project Eventlet is built on) are designed to be highly performant in networked environments due to their non-blocking nature. Everything is handled in a single thread, and scheduling is performed in user space. The one caveat is that not only must the code you write never block, the code you call must not block, either. If you are going to make a call into a third party library that performs I/O, you need to wrap that library in a thread pool.&lt;/p&gt;
&lt;p&gt;For Keystone, every call is going to be going through to a Database layer, either SQL or LDAP. Which is in turn going to call into the native driver for that Database, or the LDAP libraries. Either way, it is a native call, and it has to be wrapped in a thread pool.&lt;/p&gt;
&lt;p&gt;Keystone is an authentication hub. As such, it is literally the “Keystone” of the security architecture around Openstack. In order to do anything on any of the other services in Openstack, a use needs a token from Keystone. But in order to authenticate against Keystone, the user needs to provide a clear-text password. This approach may be sufficient to start development, but it is not going to be acceptable when a company needs to prove compliance with &lt;a href=&quot;http://www.soxlaw.com/&quot; target=&quot;_blank&quot; title=&quot;Sarbanes Oxley Act of 2002&quot;&gt;Sarbanes-Oxley&lt;/a&gt;. Or &lt;a href=&quot;http://www.hhs.gov/ocr/privacy/hipaa/understanding/index.html&quot; target=&quot;_blank&quot; title=&quot;Health Information Privacy&quot;&gt;HIPPAA&lt;/a&gt;. For these cases, we want stronger encryption and better authentication management. The Eventlet based web server does not currently support forms of authentication other than Basic-Auth. Ideally, organizations would be able to employ their Kerberos or Public Key Infrastructure (PKI) assets to support their Openstack based authentication.&lt;/p&gt;
&lt;p&gt;IPv6 is coming. The last block of IPv4 addresses has been allocated. For Cloud based deployments, people are going to need large numbers of routable IP Addresses. However, Eventlet does not currently support IPv6. Work is happening upstream, but it has not yet been commited, and will not be available for the Essex release of Openstack.&lt;/p&gt;
&lt;p&gt;There is a simple solution. Keystone is a WSGI application, and has minimal dependencies on Eventlet. Deploying Keystone in an Apache HTTPD server with mod_wsgi running in prefork mode provides the same operating environment as Eventlet does. As the de facto standard open source web server, it has received a higher degree of scrutiny than most other software products. HTTPD support for GSSAPI/Kerberos authentication, Client and Server based certificates, and IPv6. It is well supported in all the major Linux distributions.&lt;/p&gt;
&lt;p&gt;What would the drawbacks be? Probably the first thing people would look to from Eventlet is performance. I don’t have the hard numbers to compare Eventlet to Apache HTTPD, but I do know that Apache is used in enough high volume sites that I would not be overly concerned. The traffic in an Openstack deployment to a Keystone server is going to be about two orders of magnitude less than any other traffic, and is highly unlikely to be the bottleneck. Second is the fact that we would be pulling in dependencies to Apache HTTPD, and that configuring it would be different and more difficult than Eventlet. However, this is a fairly well trodden path. The benefits of putting all HTTP traffic behind ports 80 and 443 overwhelm the drawbacks of configuration.&lt;/p&gt;
&lt;p&gt;Since Keystone has just gone through a major reworking,  I realize that people might be reluctant to support a move like this.  However,  the effect on other components should be minimal or none.  Apache HTTPD can be set up  using the same ports that Keystone already uses, and thus replace an existing Keystone install with no changes to the configuration or code to the other services.  The changes should be limited to Keystone alone.&lt;/p&gt;
&lt;p&gt;The problem that Eventlet solves does not map to Keystone. The amount of work it would take to add the features Keystone really requires to Eventlet is significant, is difficult, and is likely to be far buggier than using well established and audited libraries. The simpler path forward is for Keystone to move over to Apache HTTPD. It is also the path for greater stability, security, and growth.&lt;/p&gt;</content:encoded>
	<dc:date>2012-03-01T17:34:36+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52958.html">
	<title>Dan Walsh: VMWare wants you to turn SELinux off?  Really?</title>
    <link>http://danwalsh.livejournal.com/52958.html</link>
	<content:encoded>i·ro·ny&lt;br /&gt;1.  The use of words to convey a meaning that is the opposite of its literal meaning: the irony of her reply, “How nice!” when I said I had to work all weekend.&lt;br /&gt;2. an outcome of events contrary to what was, or might have been, expected.&lt;br /&gt;&lt;br /&gt;One of the great features of KVM Virtualization is that each virtual machine is wrapped in an SELinux sandbox.   All the software used to run a virtual machine on a host is called a hypervisor.  When you run virtual machines, you have to worry about hypervisor vulnerabilities, which would allow your guest operating system to attack the host or other virtual machines you have running on the host.&lt;br /&gt;&lt;br /&gt;We strive to make the Linux KVM Hypervisor as secure as possible, but bugs happen.  SELinux can control what the virtual machine process can and can not do on the host machine.   If you are running virtual machines on you Fedora or Red Hat box, you really should be running SELinux in enforcing mode.&lt;br /&gt;&lt;br /&gt;It has come to my attention that VMWare support is suggesting people turn off SELinux...  I guess SELiux is too complicated for the VMWare crack support team to handle.&lt;br /&gt;&lt;br /&gt;At Red Hat we consider security a priority, VMWare I am not so sure.&lt;br /&gt;&lt;br /&gt;If you are having a problem running any VMWare product on a RHEL or Fedora Operating system, contact me dwalsh@redhat.com and I will help you run your virtual machines and leave the security in place...&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.popsci.com/science/article/2011-03/april-2011-how-it-works&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/Presentations/hackthecloud.png&quot; alt=&quot;Hacking the Cloud&quot; height=&quot;1024&quot; style=&quot;border-width: 0pt; border-style: solid;&quot; width=&quot;768&quot; /&gt;&lt;/a&gt;&lt;br /&gt;April 2011 &quot;How it Works&quot; issue of Popular Science,   by Marie Pacella&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-03-01T13:50:07+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1878">
	<title>Adam Young: FreeIPA  Keystone LDAP Store</title>
    <link>http://adam.younglogic.com/2012/02/freeipa-keystone-ldap/</link>
	<content:encoded>&lt;p&gt;The next interim release of Openstack  Keystone will once again have LDAP support.  I am developing against OpenLDAP to start, as that is what the LDAP support has been based on in the past.  However, the directory server that backs FreeIPA works perfectly well,  and provides a backend that allows for Keystone support.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1878&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I am running FreeIPA in a virtual machine (KVM) that runs on my laptop.  I have a /etc/host entry that allows it to resolve.  I’ve taken the pattern of using my laptops name as the domain for IPA to control.  Since my laptop&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;ayoung@ayoung etc]$ hostname
ayoung.boston.devel.redhat.com&lt;/pre&gt;
&lt;p&gt;I’ve named the vm: f16server.ayoung.boston.devel.redhat.com. To install FreeIPA, I ran:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; ipa-server-install --forwarder=192.168.122.1  --setup-dns -n `hostname -d` -U -r `hostname  | tr &quot;[:lower:]&quot; &quot;[:upper:]&quot;` -p freeipa4all -a freeipa4all&lt;/pre&gt;
&lt;p&gt;Which should almost work for you, too: You will want to modify the forwarder to be one of the current nameserver values in /etc/resolv.conf&lt;/p&gt;
&lt;p&gt;I loaded it up with sample data, including the following line as part of a batch command:&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt; {&quot;method&quot;:&quot;user_add&quot;, &quot;params&quot;:[[&quot;zmarsh&quot;],{&quot;givenname&quot;:&quot;Zackary&quot;,&quot;sn&quot;:&quot;Marsh&quot;}]},&lt;/pre&gt;
&lt;p&gt;Note that I first run&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;ipapasswd zmarsh&lt;/pre&gt;
&lt;p&gt;And set the password to &lt;strong&gt;1&lt;/strong&gt; to one, and then I&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;kinit  zmarsh&lt;/pre&gt;
&lt;p&gt;to change the password to be the old standby of &lt;strong&gt;freeipa4all&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I made the following changes to my keystone.conf file:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;diff --git a/etc/keystone.conf b/etc/keystone.conf
index 9020ea6..c929b42 100644
--- a/etc/keystone.conf
+++ b/etc/keystone.conf
@@ -23,17 +23,21 @@ max_pool_size = 10
 pool_timeout = 200

 [ldap]
-#url = ldap://localhost
-#tree_dn = dc=example,dc=com
-#user_tree_dn = ou=Users,dc=example,dc=com
-#role_tree_dn = ou=Roles,dc=example,dc=com
-#tenant_tree_dn = ou=Groups,dc=example,dc=com
-#user = dc=Manager,dc=example,dc=com
-#password = freeipa4all
-#suffix = cn=example,cn=com
+url = ldap://f16server.ayoung.boston.devel.redhat.com
+tree_dn = cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
+
+user_id_attribute=uid
+user_tree_dn = cn=users,cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
+role_tree_dn = cn=groups,cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
+tenant_tree_dn = cn=groups,cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
+user = uid=admin,cn=users,cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
+password = freeipa4all
+ldapsearch -x -W -D  uid=admin,cn=users,cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com     -H ldap://f16server.ayoung.boston.devel.redhat.com  -b &quot;&quot;
+
+

 [identity]
-driver = keystone.identity.backends.kvs.Identity
+driver = keystone.identity.backends.ldap.Identity

 [catalog]
 driver = keystone.catalog.backends.templated.TemplatedCatalog&lt;/pre&gt;
&lt;p&gt;Yes, I am aware that using the LDAP protocol in the clear is not the preferred way to do things. LDAPS support is coming, I promise.&lt;/p&gt;
&lt;p&gt;Now I fired up Keystone ( I run it in Eclipse, for integrated debugging) and first tested it using curl.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;curl -s  -H &quot;Content-Type:application/json&quot;          -H &quot;Accept:applicaton/json&quot;  -d '{&quot;auth&quot;:{&quot;passwordCredentials&quot;:{&quot;userId&quot;:&quot;zmarsh&quot;, &quot;password&quot;:&quot;freeipa4all&quot;} ,&quot;tenantId&quot;:&quot;ipausers&quot;}}'   -X POST  http://0.0.0.0:35357/v2.0/tokens&lt;/pre&gt;
&lt;p&gt;Which returned the value.&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;{&quot;access&quot;: {&quot;token&quot;: {&quot;expires&quot;: &quot;2012-03-01T22:06:49Z&quot;, &quot;id&quot;: &quot;bfd6299ac37c4c91982867eb269b4505&quot;, &quot;tenant&quot;: {&quot;enabled&quot;: true, &quot;id&quot;: &quot;ipausers&quot;}}, &quot;serviceCatalog&quot;: [{&quot;endpoints&quot;: [{&quot;adminURL&quot;: &quot;http://localhost:8774/v1.1/ipausers&quot;, &quot;region&quot;: &quot;RegionOne&quot;, &quot;publicURL&quot;: &quot;http://localhost:8774/v1.1/ipausers&quot;, &quot;internalURL&quot;: &quot;http://localhost:8774/v1.1/ipausers&quot;}], &quot;endpoints_links&quot;: [], &quot;type&quot;: &quot;compute&quot;, &quot;name&quot;: &quot;'Compute Service'&quot;}, {&quot;endpoints&quot;: [{&quot;adminURL&quot;: &quot;http://localhost:35357/v2.0&quot;, &quot;region&quot;: &quot;RegionOne&quot;, &quot;publicURL&quot;: &quot;http://localhost:5000/v2.0&quot;, &quot;internalURL&quot;: &quot;http://localhost:35357/v2.0&quot;}], &quot;endpoints_links&quot;: [], &quot;type&quot;: &quot;identity&quot;, &quot;name&quot;: &quot;'Identity Service'&quot;}], &quot;user&quot;: {&quot;username&quot;: &quot;Marsh&quot;, &quot;roles_links&quot;: [], &quot;id&quot;: &quot;zmarsh&quot;, &quot;roles&quot;: [], &quot;name&quot;: &quot;Marsh&quot;}}}&lt;/pre&gt;
&lt;p&gt;And hit it from Keystone client (running in the python interpreter)&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;&amp;gt;&amp;gt;&amp;gt; from keystoneclient.v2_0 import client
&amp;gt;&amp;gt;&amp;gt; keystone = client.Client(username='Marsh', password='freeipa4all', tenant_name='', auth_url='http://0.0.0.0:5000/v2.0')
&amp;gt;&amp;gt;&amp;gt; print keystone&lt;/pre&gt;
&lt;p&gt;One trick that makes ipa a great teaching tool for ldap is running &lt;strong&gt;ipa show&lt;/strong&gt; and &lt;strong&gt;ipa find&lt;/strong&gt; commands with the –raw and –all switches. For example, to confirm the distinguished name of the test user, I can run:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa user-show zmarsh --all --raw
  dn: uid=zmarsh,cn=users,cn=accounts,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
  uid: zmarsh
  givenname: Zackary
...&lt;/pre&gt;
&lt;p&gt;Some details and warts.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I’m using FreeIPA’s &lt;strong&gt;User Groups&lt;/strong&gt;for the tenant grouping. I’d prefer long term to use netgroups.&lt;/li&gt;
&lt;li&gt;Keystone Roles are not yet implemented.&lt;/li&gt;
&lt;li&gt;The User object usese SN for the user name, which is not a unique field.&lt;/li&gt;
&lt;/ul&gt;</content:encoded>
	<dc:date>2012-03-01T03:25:06+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52550.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VI - systemd-journal</title>
    <link>http://danwalsh.livejournal.com/52550.html</link>
	<content:encoded>There has been a lot written about the systemd-journal, this link gives a pretty good description of why it is good from a security point of view, although I don't see this as a full replacement of syslog.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://techspear.com/2011/11/systemd-journal-an-alternate-for-the-syslog/&quot; rel=&quot;nofollow&quot;&gt;http://techspear.com/2011/11/systemd-journal-an-alternate-for-the-syslog/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Since the syslog format is ubiquitous, I don't see it going away.  Also systemd-journal caused a lot of people who were working on &quot;Structured Logging&quot; to get all up in arms over it, since Lennart and Kay did not work with them.&lt;br /&gt;&lt;br /&gt;I still like it. &lt;br /&gt;&lt;br /&gt;systemd has become the central point of launching system apps, so it knows more about what is going on in the system then any other process save the kernel.&lt;br /&gt;&lt;br /&gt;Years ago when the audit system was being build Karl MacMillan of Tresys believed that some of the problems that the audit system was trying to fix could be handled by extending syslog to record all the information about the sending process.  ALL of the UIDs associated with a process as well as recording the SELinux Context.   Systemd-journald now does this. &lt;br /&gt;&lt;br /&gt;Let me give an example of where systemd-journal could be used to increase security. &lt;br /&gt;&lt;br /&gt;SELinux controls processes by only allowing them to do what they were designed to do.  Sometimes even less depending on the security goals of the policy writer.  This means SELinux would prevent a hacked ntpd process from doing anything other then handle  Network Time.  SELinux would prevent the hacked ntpd from reading mysql database or credit card data from the users home directory,  even if the ntpd process was running as root.  However, since the ntpd process sends syslog messages, SELinux would allow the hacked process to continue to send syslog messages.  The hacked ntpd could format syslog messages to match other daemons and potentially trick and administrator or even better a tool that reads the syslog file (Intrusion detection tools?) into doing something bad.   If all messages were verified with the systemd-journal then the administrator or syslog analysis tool could notice that ntpd_t is sending messages about sshd, and we could realize your ntpd daemon was hacked.&lt;br /&gt;&lt;br /&gt;.cursor=s=f328cc4b2615417189ab76b00c7ae041;i=2;b=4c3d0faf6b774fb7930972c1a4a5f87&lt;br /&gt;.realtime=1329940273078467&lt;br /&gt;...skipping...&lt;br /&gt;SYSLOG_IDENTIFIER=sshd&lt;br /&gt;SYSLOG_PID=2302&lt;br /&gt;MESSAGE=sshd Fake message from sshd.&lt;br /&gt;_PID=2302&lt;br /&gt;_UID=0&lt;br /&gt;_GID=0&lt;br /&gt;_COMM=ntpd&lt;br /&gt;_EXE=/usr/sbin/ntpd&lt;br /&gt;_CMDLINE=/usr/sbin/ntpd -n -u ntp:ntp -g&lt;br /&gt;_SYSTEMD_CGROUP=/system/ntpd.service&lt;br /&gt;_SYSTEMD_UNIT=ntpd.service&lt;br /&gt;_SELINUX_CONTEXT=system_u:system_r:ntpd_t:s0&lt;br /&gt;_SOURCE_REALTIME_TIMESTAMP=1330527027590337&lt;br /&gt;_BOOT_ID=4c3d0faf6b774fb7930972c1a4a5f870&lt;br /&gt;_MACHINE_ID=432d8198a8fc421caf2dca48ccde1cf2&lt;br /&gt;_HOSTNAME=dhcp-189-250.bos.redhat.com&lt;br /&gt;</content:encoded>
	<dc:date>2012-02-29T14:53:13+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52281.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part V - sudo can now use sssd for authorization data (sudoers)</title>
    <link>http://danwalsh.livejournal.com/52281.html</link>
	<content:encoded>Currently sudo can be configure to read the /etc/sudoers file locally or to look it up via sudoers content via LDAP.  The LDAP server provides a useful feature for organizations  which wanted to centralize authorization data. &lt;br /&gt;&lt;br /&gt;But, as in all types of centralized authorization/authentications systems, it does not work well when your machine is disconnected&lt;br /&gt;from the network.&lt;br /&gt;&lt;br /&gt;sssd - System Security Services Daemon to the rescue.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/42186.html&quot;&gt;sssd was added to Fedora a few releases ago, as I blogged about back in March 2011.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the biggest benefits of sssd is that it allows for disconnected access to cached authorization/authentication data. &lt;br /&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SSSDSudoIntegration&quot; rel=&quot;nofollow&quot;&gt;A new feature in Fedora 17 adds sssd as a source for sudoers data.&lt;/a&gt;&lt;br /&gt;&lt;p&gt;The benefits of this integration as described on the feature page are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;offline access - sudoers rules would be stored in a persistent cache, allowing sudo to fetch the rules seamlessly even in cases when the LDAP server is not reachable such as user roaming with a laptop.&lt;/li&gt;&lt;li&gt;unified configuration of LDAP parameters such as the servers used, timeout options and security properties at one places (sssd.conf)&lt;/li&gt;&lt;li&gt;sudo would take advantage of the advanced features SSSD has such as server fail over, server discovery using DNS SRV lookups and more&lt;/li&gt;&lt;li&gt;only one connection to the LDAP server open at a time resulting in less load on the LDAP server and better performance&lt;/li&gt;&lt;/ul&gt;And from an SELinux point of view one less network access for the sudoers application.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;caching of the rules - less load on the LDAP server and better performance on the client side as the client wouldn't have to go to the server with each request&lt;/li&gt;&lt;li&gt;back end abstraction - data may be stored in NIS or other databases and accessed by the sudo transparently&lt;/li&gt;&lt;/ul&gt;Imagine if sssd and IPA could eventually cache SELinux Roles/Confined Users, maybe sometime in the not too distant future ...&lt;br /&gt;</content:encoded>
	<dc:date>2012-02-28T17:03:55+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52156.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part IV - man pages for SELinux service domains</title>
    <link>http://danwalsh.livejournal.com/52156.html</link>
	<content:encoded>A couple of weeks ago, I began to look at the man pages for SELinux policy that we had written for SELinux several years ago.    I wanted to update them and maybe add a few new ones.    When I looked at the httpd_selinux man page, I noticed it was missing lots of descriptions of booleans and file types associated with the httpd domain.  When I started adding the boolean definitions, I quickly became board and realized this would not scale. &lt;br /&gt;&lt;br /&gt;I decided to write a tool &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/genman.py&quot; rel=&quot;nofollow&quot;&gt;genman.py&lt;/a&gt;, that would query the SELinux Policy and write a man page for every executable service domain.   &lt;br /&gt;DOMAIN_selinux.8&lt;br /&gt;&lt;br /&gt;I made a few assumptions that a service domain had an entrypoint ending in &quot;_exec_t&quot;.  Which we have pretty much standardized on.  Then I truncated the first part of the name off and searched for types and booleans containing this name. &lt;br /&gt;&lt;br /&gt;httpd_exec_t -&amp;gt; httpd for example. &lt;br /&gt;&lt;br /&gt;I actually took is a step further and truncated a &quot;d&quot; off if the domain name ended in &quot;d&quot;, since this is common. &lt;br /&gt;&lt;br /&gt;httpd -&amp;gt; http.&lt;br /&gt;&lt;br /&gt;Booleans have a description in policy so this was fairly easy to add to the man pages.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;# semanage boolean -l | grep http &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Would give you all the booleans that mention http, for example.&lt;br /&gt;&lt;br /&gt;Since we don't have a description for each file type associated with a domain, I had to hard code a big it/then table with common definitions,  for example.&lt;br /&gt;&lt;br /&gt;def explain(f, k):&lt;br /&gt;    if f.endswith(&quot;_var_run_t&quot;):&lt;br /&gt;        return &quot;store the %s files under the /run directory.&quot; % prettyprint(f, &quot;_var_run_t&quot;)&lt;br /&gt;&lt;br /&gt;Then I added a special section for any domains that use public_content_t. &lt;br /&gt;&lt;br /&gt;Bottom line the tool was generated over 400 man pages that have been added to the selinux-policy-doc rpm.&lt;br /&gt;&lt;br /&gt;For example&lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/abrt_selinux.html&quot; rel=&quot;nofollow&quot;&gt; abrt man page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Are these man pages perfect? NO. &lt;br /&gt;&lt;br /&gt;But they are a lot better then nothing.  Now if you want to know the types/and or booleans associated with a service, all you need to execute is man SERVICE_selinux.&lt;br /&gt;&lt;br /&gt;If anyone wishes to enhance this, by perhaps adding file context definitions, patches welcomed...&lt;br /&gt;</content:encoded>
	<dc:date>2012-02-27T16:11:34+00:00</dc:date>
</item>
<item rdf:about="http://www.bress.net/blog/archives/203-guid.html">
	<title>Josh Bressers: How to use a cryptostick with Gnu Privacy Guard</title>
    <link>http://www.bress.net/blog/archives/203-How-to-use-a-cryptostick-with-Gnu-Privacy-Guard.html</link>
	<content:encoded>I've had an OpenPGP smartcard for quite some time now. I recently acquired a &lt;a href=&quot;http://shop.kernelconcepts.de/product_info.php?products_id=133&quot;&gt;Crypto Stick&lt;/a&gt; as well thanks to rcvalle. Using these things with GnuPG isn't very clear and took a lot of work to figure out. Rather than let others struggle through all this, I'll document the procedure here.&lt;br /&gt;
&lt;br /&gt;
The basic idea behind using a smartcard to hold your GPG keys is that an attacker can't steal the key. The worst they could do is to sign or decrypt something while you have the card inserted.&lt;br /&gt;
&lt;br /&gt;
Please take the time to understand what's going on here. I have lots of examples to make this all work, but be sure you understand what's happening. Public key cryptography is hard, you should at least have a basic grasp of what's happening here. This howto should be treated as an example, not a cookie cutter recipe to follow.&lt;br /&gt;
&lt;br /&gt;
This is a rather long post, more after the fold.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;a href=&quot;http://www.bress.net/blog/archives/203-How-to-use-a-cryptostick-with-Gnu-Privacy-Guard.html#extended&quot;&gt;Continue reading &quot;How to use a cryptostick with Gnu Privacy Guard&quot;&lt;/a&gt;</content:encoded>
	<dc:date>2012-02-27T13:40:00+00:00</dc:date>
</item>
<item rdf:about="http://www.bress.net/blog/archives/204-guid.html">
	<title>Josh Bressers: Is Linus' Law real?</title>
    <link>http://www.bress.net/blog/archives/204-Is-Linus-Law-real.html</link>
	<content:encoded>Long long ago, Eris Raymond coined &quot;Linus' Law&quot;.&lt;br /&gt;
&lt;blockquote&gt;given enough eyeballs, all bugs are shallow.&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Last week Coverity released a report showing that open source software has a lower defect rate than proprietary software. This of course has some folks claiming that Linus' Law works!&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://techcrunch.com/2012/02/23/with-many-eyeballs-all-bugs-are-shallow/&quot;&gt;http://techcrunch.com/2012/02/23/with-many-eyeballs-all-bugs-are-shallow/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now I'm about as big of a fan of open source as they come, but I'm not sure if this is the proper course for cause and effect. I've done a lot of thinking about Linus' Law in the past few months as part of the Red Hat Product Security Team. What the Coverity report shows is that open source has fewer of the kind of defects Coverity can detect. That's really it.&lt;br /&gt;
&lt;br /&gt;
On the topic of open source code quality and bugs though, I think there are a few more important things to consider.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;1) The source code is available.&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
We've all written horrible horrible code when we know nobody will look at it. If I know someone will see my work, especially THE WHOLE WORLD, I'm going to spend a few extra minutes to make it look nice, which will help reduce bugs.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;2) The original author is probably still around&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
One of the problems you can see with proprietary software is that the developers don't own the code. If a developer gets a new job, they'll probably never see it again. With open source, regardless of where you work, you're going to work on your projects. This &quot;old knowledge&quot; is a very powerful thing.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;3) Anyone can help&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
If you report a bug to a proprietary vendor, they have to justify the fix from a business perspective. If the bug is obscure, or doesn't affect functionality, they may decide not to fix it. With open source, anyone can submit a patch. That means you can benefit from the long tail of contributions. The core 5% of people may write 95% of the software, but it's the other 95% of users and their 5% patches that can make the real difference. Those 5% patches are likely bugfixes, not new functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;4) The Distribution model is powerful&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
I worked for a company that write proprietary software once. The use and testing are very well defined. If a user found a bug because they were doing something weird, they were told to go away. With open source, there are hundreds of Distributions, all of them do things a little bit different. These corner cases improve overall code quality (a bug is a bug).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I suspect the overall message here isn't that Linus' Law works (it might, I'm not sure honestly). The message is that open source works. Why can't be pinned down to one thing, it's a lot of factors all coming together. Maybe all bugs ARE shallow with enough eyeballs. It's more likely though that the message should be &quot;more eyeballs is better than less eyeballs&quot;.&lt;br /&gt;
&lt;br /&gt;
What do you think?</content:encoded>
	<dc:date>2012-02-26T13:55:00+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/51942.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part III - systemd starting daemons</title>
    <link>http://danwalsh.livejournal.com/51942.html</link>
	<content:encoded>&lt;p&gt;Ok, this is not really a new feature in Fedora 17.  &lt;br /&gt;&lt;br /&gt;systemd has been starting some daemons in Fedora 16, but more and more daemons and privileged processes are being started by systemd in 17.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: larger;&quot;&gt;&lt;b&gt;Why is this a security feature? &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: smaller;&quot;&gt;Symbols: &lt;span style=&quot;color: #0000ff;&quot;&gt;@&lt;/span&gt; means Execute, &lt;span style=&quot;color: #0000ff;&quot;&gt;-&amp;gt;&lt;/span&gt; indicates transition, &lt;span style=&quot;color: #0000ff;&quot;&gt;===&lt;/span&gt; indicates a client/server communication &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the past daemons would be started in two ways.  At boot init (sysV) launches an initrc script and then this script would launch the daemon, or an admin could log in and launch the init script by hand causing the daemon to run.&lt;br /&gt;&lt;br /&gt; From an SELinux point of view this looked like:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;init_t @ initrc_exec_t -&amp;gt; initrc_t @ httpd_exec_t -&amp;gt; httpd_t:  &lt;/span&gt;&lt;br /&gt;This  apache processes would end up running with the full label of:&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;system_u:system_r:httpd_t:s0 &lt;/span&gt;&lt;br /&gt;If apache created content it would be labeled&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;system_u:object_r:httpd_sys_content_rw_t:s0 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When an administrator started restarted the process say through &lt;span style=&quot;color: #0000ff;&quot;&gt;service httpd restart&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;unconfined_t @initrc_exec_t -&amp;gt; initrc_t @httpd_exec_t -&amp;gt; httpd_t &lt;/span&gt;&lt;br /&gt;The process would adopt the user portion of the SELinux label that started it&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;unconfined_u:system_r:httpd_t:s0&lt;/span&gt;&lt;br /&gt;Content would be created by this apache would be:&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;unconfined_u:object_r:httpd_sys_content_rw_t:s0 &lt;/span&gt;&lt;br /&gt;SELinux ends up confusing the user since we have to ignore the user componant of the SELinux label. If you wanted to write policy to confine based on user type, you can't.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;With systemd this improves greatly.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The transitions is very different.&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;init_t @ httpd_exec_t -&amp;gt; httpd_t&lt;br /&gt;system_u:system_r:httpd_t:s0 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But if you want to restart the Apache daemon as admin you now do.&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;unconfined_t === init_t @ httpd_exec_t -&amp;gt; httpd_t&lt;br /&gt;system_u:system_r:httpd_t:s0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;With systemd we don't have the labeling problem and we can tighten up the SELinux policy. &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: larger;&quot;&gt;&lt;b&gt;Systemd starting daemons affects more than just SELinux.  &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Over the years lots of vulnerabilities and administration failures had to be worked around because of admins restarting daemons.  Daemons need to be coded to cleanup any leaked information from the admin process influencing the way the Daemon ran.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;    Need to clean $ENV&lt;/li&gt;&lt;li&gt;    Need to change working directory&lt;/li&gt;&lt;/ul&gt;        cd / in order to make sure they don't blow up because they lack access to the current working directory (service script does for them).&lt;br /&gt;&lt;ul&gt;&lt;li&gt;    Need do something with the terminal, close stdin, stdout, stderr after they start.&lt;/li&gt;&lt;/ul&gt;         In SELinux we are always in a quandary about this, since if we allow the daemon access to the terminal, a hacked daemon could present the admin with passwd:  and trick him into revealing the admin password.)&lt;br /&gt;&lt;ul&gt;&lt;li&gt;    Changing the controlling terminal&lt;/li&gt;&lt;li&gt;    Change the handling of signals&lt;/li&gt;&lt;li&gt;     ... &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;If a daemon writer screws up on one of these he could make the system vulnerable or end up with unexpected bugs. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Using systemd to start daemons, guarantees the daemon always gets started with  the same environment whether they are started at boot or restarted by an administrator.&lt;/b&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-02-24T17:02:20+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/51459.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part II - PrivateTmp</title>
    <link>http://danwalsh.livejournal.com/51459.html</link>
	<content:encoded>One of the reasons I am really excited about Fedora 17 is amount of new Security Features we have added, and not all of them involve SELinux ...&lt;br /&gt;&lt;br /&gt;As  I blogged a few weeks ago, we have stopped the ability for one process to look at another processes memory even if they have same UID, with the&lt;a href=&quot;http://danwalsh.livejournal.com/49336.html&quot;&gt; deny_ptrace&lt;/a&gt; feature.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PrivateTmp&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;But today I want to talk about PrivateTmp.    One of my goals over the years has been to stop system services from using /tmp. &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/11467.html&quot;&gt;I blogged about this back in 2007.&lt;/a&gt;    Any time I have found out a daemon was using /tmp, I tried to convince the packager to move the content to /run directory if it was temporary or /var/lib if it was permanent. &lt;br /&gt;&lt;br /&gt;Over the years there have been several vulnerabilities  (CVEs) about this.  For example:&lt;br /&gt;&lt;pre&gt;CVE-2011-2722, which covered a case where hplib actually included code like.

&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;fp = fopen (&quot;/tmp/hpcupsfax.out&quot;, &quot;w&quot;); // &amp;lt;- VULN
system (&quot;chmod 666 /tmp/hpcupsfax.out&quot;); // &amp;lt;- &quot;&lt;/span&gt;

Meaning if you setup a machine running cups daemon, a bad user or a application that a user ran could attack your system.

I have convinced a lot of packages to stop using /tmp, but I can't get them all and in some cases services like Apache,  need to use /tmp.   Apache runs lots of other packages that might store content in /tmp.

Well systemd has added lots of new security features (more on these later).  

PrivateTmp, which showed up in Fedora 16,  is an option in systemd unit configuration files. 

&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;      &amp;gt; man system.unit
       ...
       A unit configuration file encodes information about a service, a socket, a device, a mount point, an automount point, a   
&lt;/span&gt;     &lt;span style=&quot;font-size: small;&quot;&gt;swap file or partition, a start-up target, a file system path or a timer controlled and supervised by systemd(1).
&lt;/span&gt;
&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;     &amp;gt; man systemd.exec
     NAME
       systemd.exec - systemd execution environment configuration
     SYNOPSIS
       systemd.service, systemd.socket, systemd.mount, systemd.swap
     DESCRIPTION
       Unit configuration files for services, sockets, mount points and swap devices share a subset of configuration 
       options which define the execution environment of spawned processes.
      ...
       PrivateTmp=
           Takes a boolean argument. If true sets up a new file system namespace for the executed processes and mounts a 
           private /tmp directory inside it, that is not shared by processes outside of the namespace. This is useful to secure 
           access to temporary files of the process, but makes sharing between processes via /tmp impossible. 
           Defaults to false.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;PrivateTmp causes systemd to do the following any time it starts a service with this option turned on:

   Allocate a private &quot;tmp&quot; directory
   Create a new file system namespace 
   Bind mount this private &quot;tmp&quot; directory within the namespace over /tmp
   Start the service.  

This means that processes running with this flag would see a different and unique /tmp from the one users and other daemons sees or can access.

&lt;b&gt;&lt;span style=&quot;font-size: smaller;&quot;&gt;Note:  We have found bugs using PrivateTmp in Fedora 16, so make sure you test this well before turning it on in Production.&lt;/span&gt;&lt;/b&gt;

For Fedora 17, I opened a &lt;a href=&quot;http://fedoraproject.org/wiki/Features/ServicesPrivateTmp&quot; rel=&quot;nofollow&quot;&gt;feature page&lt;/a&gt; that requested all daemons that were using systemd unit files and /tmp to turn this feature on by default.

Apache and Cups now have PrivateTmp turned on by default in Fedora 17, along will several other daemons.

Giving three options as a Developer of System Service, I still believe that you should not use /tmp, you should use /run or /var/lib.  But if you have to use /tmp and do not communicate with other users then use PrivateTmp.  If you need to communicate with users be careful...
&lt;/pre&gt;</content:encoded>
	<dc:date>2012-02-23T14:34:28+00:00</dc:date>
</item>
<item rdf:about="http://www.awe.com/mark/blog/20120221.html">
	<title>Mark J Cox: Enterprise Linux 5.7 to 5.8 risk report</title>
    <link>http://www.awe.com/mark/blog/20120221.html</link>
	<content:encoded>Red Hat Enterprise Linux 5.8 was released today (February 2012), seven
months since the release of 5.7 in July 2011.  So let's use this opportunity to
take a quick look back over the vulnerabilities and security updates made in
that time, specifically for Red Hat Enterprise Linux 5 Server.

&lt;p&gt;

Red Hat Enterprise Linux 5 is coming up to its fifth year since release, and is
&lt;a href=&quot;https://access.redhat.com/support/policy/updates/errata/&quot;&gt;supported for
another five years&lt;/a&gt;, until 2017.

&lt;/p&gt;&lt;h3&gt;Errata count&lt;/h3&gt;
&lt;p&gt;
The chart below illustrates the total number of security updates issued for Red
Hat Enterprise Linux 5 Server if you had installed 5.7, up to and including the
5.8 release, broken down by severity.  It's split into two columns, one for
the packages you'd get if you did a default install, and the other if you
installed every single package (which is unlikely as it would involve quite a bit of
manual effort to select every one).  For a given installation, the number of
package updates and vulnerabilities that affected you will depend on exactly
what packages you have installed or removed.&lt;/p&gt;



&lt;p&gt;
&lt;img src=&quot;https://www.awe.com/mark/talks/20120221a.gif&quot; alt=&quot;Number of security errata between      5.7 and 5.8&quot; height=&quot;240&quot; hspace=&quot;20&quot; width=&quot;600&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So, for a default install, from release of 5.7 up to and including
5.8, we shipped 42 advisories to address 118 vulnerabilities.  4
advisories &lt;a href=&quot;https://access.redhat.com/security/updates/classification/&quot;&gt;were
rated&lt;/a&gt; critical, 13 were important, and the remaining
25 were moderate and low.&lt;/p&gt;

&lt;p&gt;Or, for all packages, from release of 5.7 up to and including 5.8, we
shipped 71 advisories to address 177 vulnerabilities.  7 advisories
were rated critical, 16 were important, and the remaining 48 were
moderate and low.&lt;/p&gt;

&lt;h3&gt;Critical vulnerabilities&lt;/h3&gt;

&lt;p&gt;The 7 critical advisories addressed 20 critical vulnerabilities across 4 different packages:&lt;/p&gt;

&lt;ol&gt;

&lt;p&gt;&lt;/p&gt;&lt;li&gt;An update to 
    &lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1380.html&quot;&gt;OpenJDK 6 Java Runtime Environment&lt;/a&gt;,
    (October 2011)
    where a web site hosting a malicious Java applet could potentially run
    arbitrary code as the user.&lt;/li&gt;

&lt;p&gt;&lt;/p&gt;&lt;li&gt;An update to the 
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1851.html&quot;&gt;MIT krb5 telnet daemon&lt;/a&gt;
(December 2011) where
a remote attacker who can access the telnet port of a target machine could use
this flaw to execute arbitrary code as root.  Note that the krb5 telnet daemon
is not installed or enabled by default, and the default firewall rules block remote access to
the telnet port. This flaw did not affect the more commonly used telnet daemon distributed in the
telnet-server package.&lt;/li&gt;

&lt;p&gt;&lt;/p&gt;&lt;li&gt;Updates to 
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2012-0093.html&quot;&gt;PHP&lt;/a&gt;
and 
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2012-0092.html&quot;&gt;PHP 5.3&lt;/a&gt;
(February 2012)
where a remote attacker could send a specially-crafted HTTP request to cause the
PHP interpreter to crash or, possibly, execute arbitrary code.  This flaw was
caused by the fix for &lt;a href=&quot;https://access.redhat.com/security/cve/CVE-2011-4885&quot;&gt;CVE-2011-4885&lt;/a&gt;.&lt;/li&gt;

&lt;p&gt;&lt;/p&gt;&lt;li&gt;Three updates to Firefox (&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1164.html&quot;&gt;August 2011&lt;/a&gt;, &lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1341.html&quot;&gt;September 2011&lt;/a&gt;, &lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1437.html&quot;&gt;November 2011&lt;/a&gt;)
where a malicious web site could potentially run arbitrary code as the user
running Firefox.&lt;/li&gt;

&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Updates to correct 19 out of the 20 critical vulnerabilities were
available via Red Hat Network either the same day or the next
calendar day after the issues were public.  The update to krb5
took 2 calendar days because it was public on Christmas day.

&lt;/p&gt;&lt;p&gt;Overall, for Red Hat Enterprise Linux 5 since release until 5.8, 98%
of critical vulnerabilities have had an update available to address
them available from the Red Hat Network either the same day or the
next calendar day after the issue was public.&lt;/p&gt;

&lt;h3&gt;Other significant vulnerabilities&lt;/h3&gt;

&lt;p&gt;Although not in the definition of critical severity, also of interest during
this period were a couple of remote denial of service flaws that were easily exploitable:

&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;

&lt;p&gt;&lt;/p&gt;&lt;li&gt;A flaw in BIND,
&lt;a href=&quot;https://access.redhat.com/security/cve/CVE-2011-4313&quot;&gt;CVE-2011-4313&lt;/a&gt;, fixed by
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1458.html&quot;&gt;RHSA-2011:1458&lt;/a&gt; (bind) and
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1459.html&quot;&gt;RHSA-2011:1459&lt;/a&gt;
(bind97).  A remote attacker could use this flaw to cause 
BIND to crash.&lt;/li&gt;

&lt;p&gt;&lt;/p&gt;&lt;li&gt;A flaw in Apache HTTP Server,
&lt;a href=&quot;https://access.redhat.com/security/cve/CVE-2011-3192&quot;&gt;CVE-2011-3192&lt;/a&gt;, fixed by
&lt;a href=&quot;http://rhn.redhat.com/errata/RHSA-2011-1245.html&quot;&gt;RHSA-2011:1245&lt;/a&gt;.
A remote attacker could use this flaw to cause httpd to use an
excessive amount of memory and CPU time.&lt;/li&gt;

&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;In addition, updates to 
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1242.html&quot;&gt;Firefox&lt;/a&gt;,
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1282.html&quot;&gt;NSS&lt;/a&gt;, and
&lt;a href=&quot;https://rhn.redhat.com/errata/RHSA-2011-1243.html&quot;&gt;Thunderbird&lt;/a&gt;
were made to blacklist a &lt;a href=&quot;https://bugzilla.redhat.com/show_bug.cgi?id=734316&quot;&gt;compromised Certificate Authority&lt;/a&gt;.

&lt;/p&gt;&lt;h3&gt;Previous update releases&lt;/h3&gt;

&lt;p&gt;To compare these statistics with previous update releases we need
to take into account that the time between each update release is different.
So looking at a default installation and calculating the number of
advisories per month gives the following chart:&lt;/p&gt;

&lt;img src=&quot;https://www.awe.com/mark/talks/20120221b.gif&quot; alt=&quot;Errata per month for each update release&quot; height=&quot;240&quot; hspace=&quot;20&quot; width=&quot;700&quot; /&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;This data is interesting to get a feel for the risk of running Enterprise
Linux 5 Server, but isn't really useful for comparisons with other major
versions, distributions, or operating systems -- for example, a default install
of Red Hat Enterprise Linux 4AS did not include Firefox, but 5 Server does.  You
can use our &lt;a href=&quot;https://www.redhat.com/security/data/metrics/&quot;&gt;public
security measurement data and tools&lt;/a&gt;, and run your own custom metrics for any
given Red Hat product, package set, timescales, and severity range of interest.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
&lt;p&gt;See also:
&lt;a href=&quot;http://www.awe.com/mark/blog/20110727.html&quot;&gt;5.7&lt;/a&gt;,
&lt;a href=&quot;http://www.awe.com/mark/blog/20110117.html&quot;&gt;5.6&lt;/a&gt;,
&lt;a href=&quot;http://www.awe.com/mark/blog/20100427.html&quot;&gt;5.5&lt;/a&gt;,
&lt;a href=&quot;http://www.awe.com/mark/blog/20090902.html&quot;&gt;5.4&lt;/a&gt;,
&lt;a href=&quot;http://www.awe.com/mark/blog/2009012017.html&quot;&gt;5.3&lt;/a&gt;,
&lt;a href=&quot;http://www.awe.com/mark/blog/200805262100.html&quot;&gt;5.2&lt;/a&gt;, and
&lt;a href=&quot;http://www.awe.com/mark/blog/200711071924.html&quot;&gt;5.1&lt;/a&gt;
risk reports.&lt;/p&gt;</content:encoded>
	<dc:date>2012-02-21T14:52:00+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/51435.html">
	<title>Dan Walsh: How can I allow a process to listing all processes on a system.</title>
    <link>http://danwalsh.livejournal.com/51435.html</link>
	<content:encoded>SELinux blocks lots of domains from listing all processes on the system. &lt;br /&gt;&lt;br /&gt;Lots of useful information can be optained from reading the process info on a machine, so we would like to block this by default.  But sometimes users/policy writers really need to allow their domains to be able to list the processes on a system.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Ole on the Fedora SELinux Users Mail list asked:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080;&quot;&gt;I have a problem with SELinux not allowing PHP to list other users' processes with the &quot;ps&quot; command.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;If I disable SELinux with &quot;setenforce 0&quot; it works immediately.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Is it possible to allow PHP to do this without disabling SELinux completely?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Processes are listed by reading all of the contents of /proc.  SELinux linux labels everything in /proc based on the label of the process.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;ps -eZ | grep sshd | head -1&lt;br /&gt;system_u:system_r:sshd_t:s0-s0:c0.c1023 853 ?  00:00:00 sshd&lt;br /&gt;&lt;br /&gt;ls -lZ /proc/853 | head -1&lt;br /&gt;dr-xr-xr-x. root root system_u:system_r:sshd_t:s0-s0:c0.c1023 attr&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want a confined process to run ps, it needs to list /proc/PID, it needs to read certain files in this directory, needs to read symbolic links in this directory and needs to getattr on the process.   When writing policy we have added a macro for this access.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;define(`ps_process_pattern',`&lt;br /&gt;    allow $1 $2:dir list_dir_perms;&lt;br /&gt;    allow $1 $2:file read_file_perms;&lt;br /&gt;    allow $1 $2:lnk_file read_lnk_file_perms;&lt;br /&gt;    allow $1 $2:process getattr;&lt;br /&gt;')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we wanted to allow one process type (myuser_t) to read another process /proc data on sshd (sshd_t), we would need to write a line like:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;ps_process_pattern(myuser_t, sshd_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What if I want to allow a type to list all processes types?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In SELinux policy language we use &lt;b&gt;attributes&lt;/b&gt; are used to group multiple types together. &lt;br /&gt;SELinux calls processes &quot;domains&quot;.  When we write policy we always give process types the &lt;b&gt;domain&lt;/b&gt; attribute.&lt;br /&gt;&lt;br /&gt;So if you wanted to allow a process myuser_t to  list all the processes on a system, you would write a rule like.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;ps_process_pattern(myuser_t, domain)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Dominic Grift answered Ole question by suggesting he install a local policy module that looked like:&lt;br /&gt;&lt;pre&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;policy_module(mytest, 1.0.0)
gen_require(` 
  type httpd_t; 
  attribute domain; 
')
ps_process_pattern(httpd_t, domain)&lt;/span&gt;

This works great.  Note that the apache daemon runs all php scripts within its process space, to they run as &lt;b&gt;httpd_t&lt;/b&gt;.

Another solution would be to use an interface that we have defined in policy to allow this, &lt;b&gt;domain_read_all_domains_state&lt;/b&gt;.  

The &lt;b&gt;/usr/share/selinux/devel/include/kernel/domain.if&lt;/b&gt; interface file defines several interfaces that can be used to interact with all domains.  An alternative policy module could have been written:

&lt;span style=&quot;color: #0000ff;&quot;&gt;policy_module(mytest, 1.0.0)
gen_require(` 
  type httpd_t; 
')
domain_read_all_domains_state(httpd_t)&lt;/span&gt;

&lt;/pre&gt;</content:encoded>
	<dc:date>2012-02-20T16:45:00+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1779">
	<title>Adam Young: Working with Keystone Authenticate</title>
    <link>http://adam.younglogic.com/2012/02/working-with-keystone-authenticate/</link>
	<content:encoded>&lt;p&gt;Here is a little utility I’ve worked up while working with the Openstack Keystone code.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1779&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To extract the token out of the JSON,  use the following pyton script&lt;/p&gt;
&lt;pre class=&quot;brush:python&quot;&gt;#!/usr/bin/python

from sys import stdin
import json
print json.load(stdin)['access']['token']['id']
&lt;/pre&gt;
&lt;p&gt;Which I save in  ~/bin/extract_keystone_id.py&lt;/p&gt;
&lt;p&gt;Here’s the Curl to fetch a token from  Keystone, assuming you ‘ve loaded up the sample data from the unit tests:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;curl -v   -H &quot;Content-Type:application/json&quot;  -s  -H &quot;Accept:applicaton/json&quot;  -d '{&quot;auth&quot;:{&quot;passwordCredentials&quot;:{&quot;userId&quot;:&quot;foo&quot;, &quot;password&quot;:&quot;foo2&quot;} ,&quot;tenantName&quot;:&quot;bar&quot;}}'   -X POST  http://0.0.0.0:35357/v2.0/tokens  | ~/bin/extract_keystone_id.py
&lt;/pre&gt;</content:encoded>
	<dc:date>2012-02-17T22:03:07+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1841">
	<title>Adam Young: Openstack Keystone LDAP Redux</title>
    <link>http://adam.younglogic.com/2012/02/openstack-keystone-ldap-redux/</link>
	<content:encoded>&lt;p&gt;A recent change in the structure of the Openstack Keystone architecture resulted in the loss of support for an LDAP Backend. I’ve been working to rectify that.  Here’s my set up and the design decisions I’ve made so far.  Since this code is not yet submitted for code review,  there is a good chance that it will change prior to deployment.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1841&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Users will be stored in a flat collection. &lt;strong&gt;ou=Users,$SUBTREE&lt;/strong&gt; and be based on the standard LDAP objectClass &lt;strong&gt;inetOrgPerson&lt;/strong&gt; which is defined in &lt;em&gt;/etc/openldap/schema/inetorgperson.ldif&lt;/em&gt;. Currently, only two fields are used: &lt;strong&gt;cn&lt;/strong&gt; and &lt;strong&gt;sn&lt;/strong&gt;. &lt;strong&gt;cn&lt;/strong&gt; is used for the bind call, and is the &lt;strong&gt;id&lt;/strong&gt; field in the &lt;strong&gt;user&lt;/strong&gt; object.&lt;/p&gt;
&lt;p&gt;Tenants are in a collection that is a peer to Users. Tenants are instancs of the &lt;strong&gt;groupOfNames&lt;/strong&gt; object class defined in /etc/openldap/schema/core.ldif. Tenant membership is indicated by the presence of the User’s &lt;strong&gt;DN&lt;/strong&gt; in the tenant’s &lt;strong&gt;members&lt;/strong&gt; attribute.&lt;/p&gt;
&lt;p&gt;Roles are instances of the LDAP object class &lt;strong&gt;organizationalRole&lt;/strong&gt; defined in &lt;em&gt;/etc/openldap/schema/core.ldif.&lt;/em&gt; Role assignment is indicated by the presence of the User’s DN in the &lt;strong&gt;roleOccupant&lt;/strong&gt; attribute.&lt;/p&gt;
&lt;p&gt;Configuration of LDAP for the Keystone server is provided by the [LDAP] stanza in the appropriate keystone.conf file. Here are the supported values&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;url&lt;/li&gt;
&lt;li&gt;user&lt;/li&gt;
&lt;li&gt;password&lt;/li&gt;
&lt;li&gt;suffix&lt;/li&gt;
&lt;li&gt;use_dumb_member&lt;/li&gt;
&lt;li&gt;user_tree_dn&lt;/li&gt;
&lt;li&gt;tenant_tree_dn&lt;/li&gt;
&lt;li&gt;role_tree_dn&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And an example of what my config file looks like:&lt;/p&gt;
&lt;pre class=&quot;brush:plain&amp;quot;&quot;&gt;[ldap]
url = ldap://localhost
tree_dn = dc=younglogic,dc=com
user_tree_dn = ou=Users,dc=younglogic,dc=com
role_tree_dn = ou=Roles,dc=younglogic,dc=com
tenant_tree_dn = ou=Groups,dc=younglogic,dc=com
user = dc=Manager,dc=younglogic,dc=com
password = freeipa4all
backend_entities = ['Tenant', 'User', 'UserRoleAssociation', 'Role']
suffix =cn=younglogic,cn=com

[identity]
driver = keystone.identity.backends.ldap.Identity
&lt;/pre&gt;
&lt;p&gt;Not all of these fields need to be specified.  It is expected that the user will supply simply the &lt;strong&gt;suffix&lt;/strong&gt; field,  and not override the values of &lt;strong&gt;user_tree_dn&lt;/strong&gt;,&lt;strong&gt;role_tree_dn&lt;/strong&gt;, or &lt;strong&gt;tenant_tree_dn&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;backend_entities&lt;/strong&gt; is not currently honored.  It is expected that LDAP will instead either manage all of these or non e of them,  with token management handled by a different backend provider.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;use_dumb_member&lt;/strong&gt; is still honored from the previous incarnation, but has not been tested, nor do I understand the intention of this code.&lt;/p&gt;
&lt;p&gt;The unit tests for the LDAP code use a common code sournce with the other Identity management backends.  To run just the LDAP unit tests,  from the Keystone directory, run&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; python ./run_tests.py  test_backend_ldap
&lt;/pre&gt;
&lt;p&gt;Additionally,  the unit tests can be run against a live OpenLDAP server by running.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; python ./run_tests.py  _ldap_livetest
&lt;/pre&gt;
&lt;p&gt;All tests pass successfully on my development machine as of this posting.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I’m running Fedora 16, which supports OpenLDAP. Specifically I am running openldap-servers-2.4.26-5.fc16.x86_64. To start the service, run&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;sudo service slapd start&lt;/pre&gt;
&lt;p&gt;To configure the server, I use a file I call manager.ldif:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;dn:  olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=younglogic,dc=com
-
replace: olcRootDN
olcRootDN: dc=Manager,dc=younglogic,dc=com
-
add: olcRootPW
olcRootPW: {SSHA}lBDIdfwvZkITal0k9tdhiCUolxpf6anu&lt;/pre&gt;
&lt;p&gt;You should modify the suffix for your organization.&lt;br /&gt;
Execute the configuration with:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; sudo ldapmodify -Y EXTERNAL -H ldapi:///  -f ./manager.ldif&lt;/pre&gt;
&lt;p&gt;And test that you can now do a simple bind to the localhost server.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;ldapsearch -x -D &quot;dc=Manager,dc=younglogic,dc=com&quot; -H ldap://localhost  -w freeipa4all  -b ou=Groups,dc=younglogic,dc=com &quot;(objectClass=*)&quot;&lt;/pre&gt;
&lt;p&gt;Now set up the subtree for Keystone. I use file I call org.ldif&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;dn: dc=younglogic,dc=com
dc: younglogic
objectClass: dcObject
objectClass: organizationalUnit
ou: younglogic

dn: ou=Groups,dc=younglogic,dc=com
objectClass: top
objectClass: organizationalUnit
ou: groups

dn: ou=Users,dc=younglogic,dc=com
objectClass: top
objectClass: organizationalUnit
ou: users

dn: ou=Roles,dc=younglogic,dc=com
objectClass: top
objectClass: organizationalUnit
ou: users&lt;/pre&gt;
&lt;p&gt;Technically, the Roles ou is not required. My original thought was that this collection would contain the superset of roles possible for all of the Tenants. However, I have not implemented that.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/admiyo/keystone/tree/ldap3&quot; target=&quot;_blank&quot; title=&quot;Github LDAP&quot;&gt;Current code is commited to Github&lt;/a&gt;  I will update this link if I rebase the branch.&lt;/p&gt;
&lt;p&gt;Update:  fixed typos in the config file segment.  user_tree_dn etc should start with ou, not cn.&lt;/p&gt;</content:encoded>
	<dc:date>2012-02-17T17:27:55+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1811">
	<title>Adam Young: Programmatic EXTERNAL SASL connection to OpenLDAP</title>
    <link>http://adam.younglogic.com/2012/02/exteranl-sasl/</link>
	<content:encoded>&lt;p&gt;The documentation on the OpenLDAP site discusses modifying the ldif files used to start up the server.  If you try to do this on a Fedora or Debian based install,  you will find that the server does not start up.  The HASH of the files is stored and compared with the contents at start up time.  There is a better way.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1811&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;On my OpenLDAP install,  there are three databases served by SLAPD.  The first two  are for  configuration and  monitoring.  The third is the one that acts as the backing store for authentication and other data that is publicly served.  When the server starts up,  it is configured with a common name of   cn=example,cn=com,  which is obviously sample data.  To modify this,  requires changing the values in the config database.&lt;/p&gt;
&lt;p&gt;Below is an ldif file that would change the Common name, as well as set the userid and password for managing the directory&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;dn:  olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=younglogic,dc=com
-
replace: olcRootDN
olcRootDN: dc=Manager,dc=younglogic,dc=com
-
add: olcRootPW
olcRootPW: {SSHA}lBDIdfwvZkITal0k9tdhiCUolxpf6anu&lt;/pre&gt;
&lt;p&gt;I generated the HASH using the &lt;strong&gt;slappasswd&lt;/strong&gt; command line tool.&lt;br /&gt;
To modify the config, you then execute ldapmodify.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;sudo ldapmodify -Y EXTERNAL -H ldapi:///  -f /home/ayoung/etc/managerbase.ldif&lt;/pre&gt;
&lt;p&gt;What is this EXTERNAL? It is a SASL mechanism that uses the underlying system configured authentication. This is the NSS value that you would get back from getent. The default install protects the configuration database using the root credentials. The URL ldapi:/// is a Unix socket connection to /var/run/ldapi.&lt;/p&gt;
&lt;p&gt;What happens if you want to modify the configuration pragmatically? The steps to make a SASL External connection are not to clear.  In order to figure out how to do it, I’ve started poking inside of the ldapmodify code from the openldap source. The CLI tools are under openldap/clients/tools/. The connection is created in the file common.c. From what I’ve seen elsewhere on the web, I know it needs to resolve to one of the ldap*bind calls. In my file, inside the function tool_bind, I see it on line 1469&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;	rc = ldap_sasl_interactive_bind_s(
          ld, binddn, sasl_mech,
	   sctrlsp, NULL, sasl_flags, lutil_sasl_interact, defaults )&lt;/pre&gt;
&lt;p&gt;Now, I’ve run this through ltrace and I’ve seen&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;ldap_sasl_interactive_bind_s(0x1abf290, 0, 0x1abf030, 0, 0&lt;/pre&gt;
&lt;p&gt;So I know to expect binddn to be null, and sasl_mech needs to have a real value. Look in the argument parsing part of the code for the -Y flag tells that this is a pass through of the string passed on the command line.&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;    case 'Y':
        /*error chcking ellided here*/
	sasl_mech = ber_strdup( optarg );&lt;/pre&gt;
&lt;p&gt;So that should be the string EXTERNAL for our purposes.&lt;/p&gt;
&lt;p&gt;The next two parameters are 0, sctrlsp and (surprise) NULL.&lt;/p&gt;
&lt;p&gt;sasl_flags looks like it is set to the default in the top of the file and never modified in our code path:&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;unsigned	sasl_flags = LDAP_SASL_AUTOMATIC;&lt;/pre&gt;
&lt;p&gt;That leaves the last two parameters. One is a callback function &lt;strong&gt;lutil_sasl_interact&lt;/strong&gt; and one is the &lt;strong&gt;defaults&lt;/strong&gt; structure. The function lutil_sasl_interact is defined in the file openldap/libraries/liblutil/sasl.c. Between it and the function &lt;strong&gt;interaction&lt;/strong&gt; which it calls, we are talking about 200 lines of code. For now, I am just going to cut and paste that code into my C file and get all of the headers coorect to run it. Later, I’ll step through it in the debugger to see what it is really doing.&lt;/p&gt;
&lt;p&gt;The defaults structure is also defined in the sasl/c file specified above. From the ldap_bind man page:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The interact function uses the provided defaults to handle requests from the SASL library for particular authentication parameters. There is no defined format for the defaults information; it is up to the caller to use whatever format is appropriate for the supplied interact function. The sasl_interact parameter comes from the underlying SASL library. When used with Cyrus SASL this is an array of sasl_interact_t structures. The Cyrus SASL library will prompt for a variety of inputs, including:…&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Again, I will cut and paste this code into my file and get it running. In order to compile I need to add the flags&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;CFLAGS=-lldap -llber -lsasl2 -g -I/usr/include/sasl&lt;/pre&gt;
&lt;p&gt;Once I can compile and run, I can dump out the contents of the config directory. Stepping through the code I discover a few things. In the code that builds the defaults, the non-zero values are. defaults-&amp;gt;authcid = “root” and defaults-&amp;gt;mech “EXTERNAL”. When the function lutil_sasl_interact is called, the parameters are: The ldap structure from our init, flags=0, defaults, and in, which is cast to at sasl_interact_t. The only part of this that seems interesting to us is that it requests SASL_CB_USER from interact, which basically checks the user is root. The code then makes the most elegant use of a goto that I’ve seen in a long while, skips a whole load of interactive code, and returns the default:&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;use_default:
		/* input must be empty */
		interact-&amp;gt;result = (dflt &amp;amp;&amp;amp; *dflt) ? dflt : &quot;&quot;;
		interact-&amp;gt;len = strlen( interact-&amp;gt;result )&lt;/pre&gt;
&lt;p&gt;This says to me that the interaction callback function could be reduced to:&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;int do_interact(
	LDAP *ld,
	unsigned flags,
	void *defaults,
	void *in )
{
	sasl_interact_t *interact = in;
	lutilSASLdefaults * sasl_defaults = (lutilSASLdefaults *)defaults;
	const char *dflt = interact-&amp;gt;defresult;
	dflt = sasl_defaults-&amp;gt;authzid;
	interact-&amp;gt;result = (dflt &amp;amp;&amp;amp; *dflt) ? dflt : &quot;&quot;;
	interact-&amp;gt;len = strlen( interact-&amp;gt;result );
	return LDAP_SUCCESS;
}&lt;/pre&gt;
&lt;p&gt;But now I see that the defaults passed in are defined external to the ldap code. We can drop all of the pointers except the one to the authzid. In fact, we can just make this a char *.&lt;/p&gt;
&lt;p&gt;Here’s the code in a functional state. It leaks memory, which would need to be cleaned up for a real application.&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;sasl.h&amp;gt;
#include &amp;lt;ldap.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

int do_interact(
		LDAP *ld,
		unsigned flags,
		void *defaults,
		void *in )
{
  sasl_interact_t *interact = in;
  char * sasl_defaults = (char  *)defaults;
  const char *dflt = interact-&amp;gt;defresult;
  dflt = sasl_defaults;
  interact-&amp;gt;result = (dflt &amp;amp;&amp;amp; *dflt) ? dflt : &quot;&quot;;
  interact-&amp;gt;len = strlen( interact-&amp;gt;result );
  return LDAP_SUCCESS;
}

int main(){
  printf(&quot;Start\n&quot;);
  LDAP *ldap;
  int rc;
  struct berval *servercredp;
  unsigned long version = LDAP_VERSION3;
  LDAPMessage *res;
  char ** vals;
  int message_count;
  int i,j,k;

  if (( rc = ldap_initialize(&amp;amp;ldap,  &quot;ldapi:///&quot;)) != LDAP_SUCCESS)
    {
      perror ( NULL );
      return( 1 );
    }

  rc = ldap_set_option(ldap,
		       LDAP_OPT_PROTOCOL_VERSION,
		       (void*)&amp;amp;version);
  char * defaults;
  char * sasl_mech = &quot;EXTERNAL&quot;;
  char * sasl_realm = NULL;
  char * sasl_authc_id = NULL;
  char * sasl_authz_id = NULL;
  struct berval	passwd = { 0, NULL };
  unsigned	sasl_flags = LDAP_SASL_AUTOMATIC;
  LDAPControl	**sctrlsp = NULL;

  ldap_get_option( ldap, LDAP_OPT_X_SASL_AUTHZID, &amp;amp;defaults );

  char *	binddn = NULL;
  rc = ldap_sasl_interactive_bind_s( ldap, binddn, sasl_mech,
				     sctrlsp,
				     NULL, sasl_flags, do_interact, defaults );

  if ((rc =  ldap_search_ext_s
       (
	ldap,
	&quot;cn=config&quot;,
	LDAP_SCOPE_SUBTREE,
	&quot;(objectClass=*)&quot;,
	NULL,
	0,
	NULL,
	NULL,
	NULL,
	0,
	&amp;amp;res ) != LDAP_SUCCESS))
    {
      printf(&quot;ldap_search  failed with 0x%x.\n&quot;,rc);
      perror ( NULL );
      return( 1 );
    }
  LDAPMessage *entry = ldap_first_entry( ldap, res );

  int entry_count = ldap_count_entries(ldap, res);
  for (i = 0 ; i &amp;lt; entry_count; i++){
    printf(&quot;dn: %s\n&quot;,ldap_get_dn(ldap, entry));
    BerElement * ber;
    char * attribute = ldap_first_attribute(ldap,entry, &amp;amp;ber);
    while(attribute){
      printf (&quot;attribute = %s\n&quot;,attribute);
      attribute = ldap_next_attribute(ldap,entry, ber);
    }
    ber_free(ber,0);
    entry = ldap_next_entry(ldap, entry);

  }
  return 0;

}&lt;/pre&gt;
&lt;p&gt;Note: The reason I do SASL using a -I option in the makefile instead of sasl/sasl.h is that the code formatter is messing it up.&lt;/p&gt;</content:encoded>
	<dc:date>2012-02-17T16:30:27+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/50980.html">
	<title>Dan Walsh: SELinux problems on Fedora 17.</title>
    <link>http://danwalsh.livejournal.com/50980.html</link>
	<content:encoded>Anyone that has tried Fedora 17 over the last couple of days, might have noticed SELinux going nuts and blocking logins. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;systemd had a bug which was causing transitions to break.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The way the system is supposed to work is during boot systemd reads in the policy file on disk and then loads policy into the kernel.&lt;br /&gt;This causes all processes at that are running to be labeled kernel_t. &lt;br /&gt;&lt;br /&gt;systemd then reads the label on its image file /sbin/systemd (init_exec_t) and the label that it is currently running as (kernel_t), then it asks the kernel what label would the /sbin/systemd process get if kernel_t executed it.  The answer would be init_t, and then systemd is supposed to set the current label to init_t.   From that point on all processes started by systemd would transition to their proper domains.&lt;br /&gt;&lt;br /&gt;Well just before systemd/Fedora 17 Alpha was about to be released.  Systemd changed the location of its executable from /bin/systemd to /usr/lib/systemd/systemd.  But they never changed the checking code.  We fixed policy to look at the new location and labeled /usr/lib/systemd/systemd correctly, but when systemd checked for the label of /bin/systemd, there was no file and systemd just continued running as kernel_t.  Since there are few rules for transitions of kernel_t to any other label, most of the system was labeled as kernel_t.  Finally when a user logged in via gdm or login or sshd, they were running as kernel_t and the code transitioned them to abrt_t, one of the few domains kernel_t will transition to.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;systemd-42-1.fc17&lt;/span&gt; fixes this problem, so if you update to this systemd or later, you should be able to run your system in enforcing mode. &lt;br /&gt;&lt;br /&gt;Needless to say, we have been flooded with bug reports...</content:encoded>
	<dc:date>2012-02-13T20:35:38+00:00</dc:date>
</item>
<item rdf:about="http://adam.younglogic.com/?p=1753">
	<title>Adam Young: DNS Managers in FreeIPA</title>
    <link>http://adam.younglogic.com/2012/02/dns-managers-in-freeipa/</link>
	<content:encoded>&lt;p&gt;The Domain Name System (DNS) is an essential part of systems management. If you need to manage multiple physical hosts you’d really benefit by a degree of control of some subset of DNS. With Virtual machines, the sheer number of hosts created demand a responsive DNS. Kerberos, X509 and other security mechanisms require a proper DNS configuration. Yet, for many organizations, DNS is locked down by IT to a very static set of records. Earlier articles discussed &lt;a href=&quot;http://adam.younglogic.com/2012/02/group-managers-in-freeipa/&quot; target=&quot;_blank&quot; title=&quot;User Group Managers&quot;&gt;User Groups&lt;/a&gt;, &lt;a href=&quot;http://adam.younglogic.com/2012/02/hostgroup-managers-freeipa/&quot; target=&quot;_blank&quot; title=&quot;Hostgroup Managers&quot;&gt;Host Groups&lt;/a&gt;, and &lt;a href=&quot;http://adam.younglogic.com/2012/02/netgroup-managers-in-freeipa/&quot; target=&quot;_blank&quot; title=&quot;Netgroup Managers&quot;&gt;Netgroups&lt;/a&gt;. The final installment in this series discsusses how to delegate DNS Zone management in FreeIPA.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-1753&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;First, create a Zone for the project, and one DNS record&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa dnszone-add beowulf.younglogic.com
Authoritative nameserver: f16server.ayoung.boston.devel.redhat.com
Administrator e-mail address [hostmaster.beowulf.younglogic.com.]:
Zone name: beowulf.younglogic.com
Authoritative nameserver: f16server.ayoung.boston.devel.redhat.com.
Administrator e-mail address: hostmaster.beowulf.younglogic.com.
SOA serial: 2012110201
SOA refresh: 3600
SOA retry: 900
SOA expire: 1209600
SOA minimum: 3600
Active zone: TRUE
Dynamic update: FALSE
[root@f16server ~]# ipa dnsrecord-add
Zone name: beowulf.younglogic.com
Record name: www1
[A record]: 10.10.2.1
[AAAA record]: feed:0123::babe
Record name: www1
A record: 10.10.2.1
AAAA record: feed:0123::babe&lt;/pre&gt;
&lt;p&gt;Here’s the LDAP details of what we just created:&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa dnszone-show beowulf.younglogic.com --all --raw
dn: idnsname=beowulf.younglogic.com,cn=dns,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
idnsname: beowulf.younglogic.com
idnssoamname: f16server.ayoung.boston.devel.redhat.com.
idnssoarname: hostmaster.beowulf.younglogic.com.
idnssoaserial: 2012110201
idnssoarefresh: 3600
idnssoaretry: 900
idnssoaexpire: 1209600
idnssoaminimum: 3600
idnszoneactive: TRUE
idnsallowdynupdate: FALSE
nsrecord: f16server.ayoung.boston.devel.redhat.com.
objectclass: top
objectclass: idnsrecord
objectclass: idnszone&lt;/pre&gt;
&lt;p&gt;Notice that the A and AAAA records are not visible in the DNS Zone object. Since we are not just modifying values of attributes, we can’t perform the same type of delegation as we did with User Groups, Host Groups or Netgroups. Lets take a look at the LDAP details of the Record.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa dnsrecord-show beowulf.younglogic.com www1 --all --raw
dn: idnsname=www1,idnsname=beowulf.younglogic.com,cn=dns,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
idnsname: www1
arecord: 10.10.2.1
aaaarecord: feed:0123::babe
objectclass: top
objectclass: idnsrecord&lt;/pre&gt;
&lt;p&gt;A and AAAA records that have the same &lt;strong&gt;idnsname&lt;/strong&gt; go into the same LDAP object. PTR and CNAME records would all be put into additional attributes of this object if they, too, had the same idnsname. This LDAP object is a subordinate object to the Zone, beowulf.younglogic.com.&lt;/p&gt;
&lt;p&gt;Thus, we can use the &lt;strong&gt;Subtree&lt;/strong&gt; permission type to manage access to this resource. The subtree is the &lt;strong&gt;distinguished name&lt;/strong&gt; (DN) of the DNS Zone.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa permission-add 'beowulf-dns-modify'  --permissions=add,delete
[Attributes]:
[Type]:
[Member of group]:
[Filter]:
[Subtree]: idnsname=beowulf.younglogic.com,cn=dns,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com
[Target group]:
-------------------------------------
Added permission &quot;beowulf-dns-modify&quot;
-------------------------------------
  Permission name: beowulf-dns-modify
  Permissions: add, delete
  Subtree: ldap:///idnsname=beowulf.younglogic.com,cn=dns,dc=f16server,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com&lt;/pre&gt;
&lt;p&gt;We could use the &lt;strong&gt;objectname&lt;/strong&gt; and &lt;strong&gt;cn&lt;/strong&gt; as we did before, but  &lt;strong&gt;subtree&lt;/strong&gt; is better documentation to our intent.&lt;/p&gt;
&lt;p&gt;Again, we need to add the permission to the privilege.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa privilege-add-permission beowulf-manage --permission=beowulf-dns-modify
  Privilege name: beowulf-manage
  Description: Manage the Assets of the Beowulf project
  Permissions: beowulf-manage, beowulf-manage-group, beowulf-hostgroup-modify,
               beowulf-netgroup-modify, beowulf-dns-modify
  Granting privilege to roles: beowulf-managers
-----------------------------
Number of permissions added 1
-----------------------------&lt;/pre&gt;
&lt;p&gt;Test it out with the &lt;em&gt;admiyo&lt;/em&gt; account (that already has the Role beowulf-managers. This time, we’ll add both an A and AAAA record, which are managed by the same object in BINDs LDAP backend.&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;[root@f16server ~]# ipa privilege-add-permission beowulf-manage --permission=beowulf-dns-modify
  Privilege name: beowulf-manage
  Description: Manage the Assets of the Beowulf project
  Permissions: beowulf-manage, beowulf-manage-group, beowulf-hostgroup-modify,
               beowulf-netgroup-modify, beowulf-dns-modify
  Granting privilege to roles: beowulf-managers
-----------------------------
Number of permissions added 1
-----------------------------
[root@f16server ~]# kinit admiyo
Password for admiyo@F16SERVER.AYOUNG.BOSTON.DEVEL.REDHAT.COM:
[root@f16server ~]# ipa dnsrecord-add
Zone name: beowulf.younglogic.com
Record name: mail1
[A record]: 10.10.2.3
[AAAA record]: feed:babe:beef::cafe
  Record name: mail1
  A record: 10.10.2.3
  AAAA record: feed:babe:beef::cafe&lt;/pre&gt;
&lt;p&gt;These four articles have attempted to show how the access controls of FreeIPA allow a system administrator to delegate specific actions to power users in their organization. From the simplest and most targeted of Target Groups, through simple and then more complex filter queries, then finally subtree queries. While FreeIPA can abstract you away from having to understand LDAP,  it does not prevent you from doing so.  Instead,  LDAP know how built on top of the structure provided with FreeIPA can help to craft secure and flexible delegation policy.&lt;/p&gt;</content:encoded>
	<dc:date>2012-02-13T02:48:21+00:00</dc:date>
</item>

</rdf:RDF>

