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

<channel>
	<title>rory</title>
	<atom:link href="http://blogs.splunk.com/rory/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.splunk.com/rory</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Thu, 06 Dec 2007 03:15:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>flexibles roles and chamber of secrets</title>
		<link>http://blogs.splunk.com/rory/2007/12/05/flexibles-roles-and-chamber-of-secrets/</link>
		<comments>http://blogs.splunk.com/rory/2007/12/05/flexibles-roles-and-chamber-of-secrets/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 23:16:44 +0000</pubDate>
		<dc:creator>rory</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<category><![CDATA[preview]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/rory/2007/12/05/flexibles-roles-and-chamber-of-secrets/</guid>
		<description><![CDATA[Hi Kids, 
So we have added in flexible roles into the preview release. Well, what does that mean.
We will now allow folks to create their own roles. The previous ones of Admin, Power
and User will be included as defaults.
There is currently no GUI available for editing roles but you can directly edit the
config file $SPLUNK_HOME/etc/bundles/default/authorize.conf.
To [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Kids, </p>
<p>So we have added in flexible roles into the preview release. Well, what does that mean.<br />
We will now allow folks to create their own roles. The previous ones of Admin, Power<br />
and User will be included as defaults.</p>
<p>There is currently no GUI available for editing roles but you can directly edit the<br />
config file $SPLUNK_HOME/etc/bundles/default/authorize.conf.</p>
<p>To add in these roles we did an audit of our system and broke down various actions<br />
into capabilities.  These capabilities can be grouped together to create any role.<br />
Please bear with us here, this is just a first cut and we may not have chopped up<br />
things in a way that makes sense to you. This is the beauty of preview, you got a suggestion<br />
about capabilities you&#8217;d like to see added or removed then comment or mail us.<br />
The more feedback we get at this stage the faster this feature will improve.</p>
<p>A role in the splunk system contains the following things.<br />
1. A list of capabilities that role can perform.<br />
2. A list of roles that are contained within this role ( their capabilities will be imported into our role)<br />
3. A list of search filters that should be applied when searching as this role.</p>
<p>Below demonstrates how to define a role called kwyjibo that can edit users information and<br />
make changes to the authentication system. It imports in the capabilities of the roles User and Power.</p>
<p>[role_kwyjibo]<br />
edit_user                          = enabled<br />
change_authentication   = enabled<br />
bounce_authentication   = enabled<br />
importRoles                      = Power;User<br />
srchFilter                           =</p>
<p>If you have any questions, comments please let me know.</p>
<p>Rory</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/rory/2007/12/05/flexibles-roles-and-chamber-of-secrets/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scripted auth in preview</title>
		<link>http://blogs.splunk.com/rory/2007/11/16/scripted-auth-in-preview/</link>
		<comments>http://blogs.splunk.com/rory/2007/11/16/scripted-auth-in-preview/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 00:37:03 +0000</pubDate>
		<dc:creator>rory</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<category><![CDATA[hacks]]></category>

		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/rory/2007/11/16/scripted-auth-in-preview/</guid>
		<description><![CDATA[Hey Kids, 
How are things? so I&#8217;ve made some progress in my attempt to code myself out of a job. Just checked the scripted auth into the preview branch which should be released in a few days. It&#8217;s very basic right now with more improvements to come. At the moment userLogin,  getUserType and getUserInfo [...]]]></description>
			<content:encoded><![CDATA[<p>Hey Kids, </p>
<p>How are things? so I&#8217;ve made some progress in my attempt to code myself out of a job. Just checked the scripted auth into the preview branch which should be released in a few days. It&#8217;s very basic right now with more improvements to come. At the moment userLogin,  getUserType and getUserInfo are the only methods you need to fill in. </p>
<p>I&#8217;ve written up a sample that interfaces with PAM on the linux, using /etc/passwd to get user lists. Mac users skip the pamauth.c compile you don&#8217;t need this app and pam don&#8217;t  like macs ( can&#8217;t say I blame pam on that score)</p>
<p>First off a pamauth.c program to compile that will talk to pam for ya.  Donated by Phillppe Troin, thank you fif. Feel free to take and edit for your own purposes, but  you must send fif a chocolate chip cookie if you found it useful.</p>
<p>File pamauth.c is attach due to severe lameness on part of wordpress, insisting on screwing with the #include&#8217;s</p>
<p><a href="/devuploads/2007/11/pamauth.c">pamauth.c</a></p>
<p>Compile that puppy like so<br />
gcc -Wall -Wextra -o pamauth pamauth.c -lpam</p>
<p>You may need to create an entry for pam<br />
edit /etc/pam.d/pamauth and put this line in<br />
auth        sufficient    pam_unix.so</p>
<p>To access pam root access is usually required so we will just set the pamauth script setuid instead of running splunk as root (which would be deeply stupid BTW).</p>
<p>as root:<br />
chown root.root pamauth; chmod a+s pamauth</p>
<p>You can test it by doing echo  PASSWORD | ./pamauth username<br />
returns 0 for auth passed<br />
returns 1 on fail.</p>
<p>K now that you have your nifty pam app running you need to add your python script that will interface<br />
with splunk. As they say on cooking shows, here&#8217;s one we made earlier.</p>
<p>[source:py]<br />
# Required functions;<br />
# 1. userLogin    : login with username password pair<br />
# 2. getUserInfo  : get user information. passed back in the form.userId;username;password;realname;userType<br />
# 3. getUserType  : the splunk role to attach that user to.<br />
# optional functions<br />
# 1. getUsers     : Enumerate all users in the system, these will then be displayed on the user page in splunk.<br />
# Later release<br />
# 1. checkSession : Current version just auths and then splunk managed the session, this will allow<br />
#                   session management to be handled here. Careful though splunkd and the frontend<br />
#                   are quite chatty this will be called alot. If it&#8217;s slow it will degrade performance.</p>
<p>import sys<br />
import subprocess</p>
<p>SUCCESS = &#8220;success&#8221;<br />
FAILED  = &#8220;fail&#8221;</p>
<p>PAM_EXE = &#8220;&#8221;</p>
<p>def writeToStdout( listIn ):<br />
   result = &#8220;&#8221;<br />
   for fu in listIn:<br />
      result = result + &#8220;[" + fu + "]&#8221;</p>
<p>   sys.stdout.write( result )</p>
<p>def readFromStdin( ):<br />
   input = sys.stdin</p>
<p>   inStr = &#8220;&#8221;<br />
   for line in input:<br />
      inStr = inStr + line</p>
<p>   inStr = inStr.replace( &#8220;[", "" )<br />
   return inStr.split( ']&#8216; )</p>
<p>def userLogin( infoIn ):<br />
   listFu = []<br />
   username = infoIn[0]<br />
   password = infoIn[1]</p>
<p>   command = PAM_EXE + infoIn[0]</p>
<p>   # our check with pam is done with a setuid program called pamauth<br />
   proc = subprocess.Popen( PAM_EXE +  &#8216; %s&#8217; % username,<br />
                            shell=True,<br />
                            stdin=subprocess.PIPE,<br />
                            )<br />
   proc.communicate( password)<br />
   retCode = proc.wait()</p>
<p>   if retCode == 0:<br />
      listFu.append( SUCCESS )<br />
   else:<br />
      listFu.append( FAILED )</p>
<p>   return listFu</p>
<p>def getUsers( infoIn ):<br />
   listFu = []<br />
   listFu.append( SUCCESS )<br />
   # just going to use /etc/passwd here but you may use any method you wish.<br />
   FILE = open(&#8221;/etc/passwd&#8221; ,&#8221;r&#8221;)<br />
   fileLines = FILE.readlines()</p>
<p>   for line in fileLines:<br />
      userBits = line.split( &#8220;:&#8221; )<br />
      if userBits[6].find( &#8216;/bin/bash&#8217; ) != -1:<br />
         realname = userBits[4]<br />
         if realname == &#8220;&#8221; :<br />
            realname = userBits[0]<br />
         #              userId       username       password          realName       userType/splunk role<br />
         listFu.append( userBits[2] + &#8220;;&#8221; +userBits[0] + &#8220;;***********;&#8221; + realname + &#8220;;Admin&#8221; )</p>
<p>   FILE.close()</p>
<p>   return listFu</p>
<p># IN UserId<br />
# OUT [RESULT(SUCCESS|FAILED)][userType]<br />
def getUserType( infoIn ):<br />
   # Here you are given a userId<br />
   # you must return the user type (splunk role)<br />
   # I&#8217;m just going to make everyone an admin.<br />
   listFu = []<br />
   listFu.append( SUCCESS )<br />
   listFu.append( &#8220;Admin&#8221; )<br />
   return listFu</p>
<p>def getUserInfo( infoIn ):<br />
   listFu = []<br />
   listFu.append( SUCCESS )<br />
   #userId;<br />
   listFu.append( infoIn[0] + &#8220;;&#8221; + infoIn[0] + &#8220;;***********;&#8221; + infoIn[0] + &#8220;;Admin&#8221; )<br />
   return listFu</p>
<p>if __name__ == &#8220;__main__&#8221;:<br />
   callName = sys.argv[1]<br />
   listIn = []<br />
   listIn = readFromStdin(  )</p>
<p>   returnList = []<br />
   if callName == &#8220;userLogin&#8221;:<br />
      returnList = userLogin( listIn )<br />
   elif callName == &#8220;checkSession&#8221;:<br />
      returnList = checkSession( listIn )<br />
   elif callName == &#8220;getUsers&#8221;:<br />
      returnList = getUsers( listIn )<br />
   elif callName == &#8220;getUserType&#8221;:<br />
      returnList = getUserType( listIn )<br />
   elif callName == &#8220;getUserInfo&#8221;:<br />
      returnList = getUserInfo( listIn )<br />
   else:<br />
      returnList.append(&#8221;ERROR call name no known&#8221; )<br />
      returnList.append( callName )</p>
<p>   writeToStdout( returnList )<br />
[/source]</p>
<p>Change the PAM_EXE variable in the script to point to the app that will check the password. On linux : the pamauth module you just compiled.  On Mac (the piano-accordion of computers): use chkpasswd program shipped with mac.</p>
<p>Now that you have a script auth plugin ready to go all you need to do now is tell splunk about it.</p>
<p>Example of the authentication.conf bundle.</p>
<p>[source]<br />
[auth]<br />
authSettings = fubar<br />
authType = Scripted</p>
<p>[fubar]<br />
programPath = /opt/splunk/bin/python<br />
scriptPath = /home/boo/splunk/scriptedAuth/flubber.py   # my python auth script.<br />
[/source]</p>
<p>Now pay attention here you do need to edit programPath and scriptPath to paths on your system.</p>
<p>Things left to do.<br />
1. Allow users to pass back search filters on userLogin and getUserType.<br />
2. Allow session management to be handled by scripted input. ( right not once auth is confirmed as correct splunk takes over session management).</p>
<p>Also this script will not return user lists on the mac ( not big deal you just can&#8217;t see all users in the admin/users tab ).  Erik Swan has volunteered to fix this because he loves macs, a little too much really it&#8217;s kinda unhealthy.</p>
<p>Download this and play with it, let me know of any problems.</p>
<p>I will publish more details on the communication between splunkd and the script but for the moment you folks can reverse engineer this, it&#8217;s pretty simple, a lame wilder beast could figure it out.</p>
<p>More later, for now it&#8217;s time for beer pong, played for cold hard cash and ugly women.</p>
<p>Ciao,<br />
Rory </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/rory/2007/11/16/scripted-auth-in-preview/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I&#8217;m cold and there are wolves after me</title>
		<link>http://blogs.splunk.com/rory/2007/10/08/im-cold-and-there-are-wolves-after-me/</link>
		<comments>http://blogs.splunk.com/rory/2007/10/08/im-cold-and-there-are-wolves-after-me/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 00:53:43 +0000</pubDate>
		<dc:creator>rory</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/rory/2007/10/08/im-cold-and-there-are-wolves-after-me/</guid>
		<description><![CDATA[Just fresh from the splunk poker game. Good fun, made a whopping $10. Jef looked like
he was on the verge or paying for his kids education. Maverick even threatened to sing,
good times.
So Erik did a pretty good job of describing the environment here at splunk.
The people here are great and lots of fun, there are [...]]]></description>
			<content:encoded><![CDATA[<p>Just fresh from the splunk poker game. Good fun, made a whopping $10. Jef looked like<br />
he was on the verge or paying for his kids education. Maverick even threatened to sing,<br />
good times.</p>
<p>So Erik did a pretty good job of describing the environment here at splunk.<br />
The people here are great and lots of fun, there are some great problems<br />
just begging to be solved, we need more monkeys on them typewriters </p>
<p>Poker games, golf, visits to the jackson arms, beer pong, foosball<br />
(Raffy really needs a challenge )</p>
<p>Don&#8217;t worry about that collage bit  http://en.wikipedia.org/wiki/Collage</p>
<p>Erik insists everyone draw a picture of themselves in crayon, but really<br />
who doesn&#8217;t ask for that in a serious interview these days.</p>
<p>In the coming weeks I&#8217;m going to be working on a way to allow people to<br />
plug in their own auth systems. We&#8217;ve had requests running the gamut from<br />
the normal stuff like PAM, RADIUS etc to carrier pidgeon and bob&#8217;s trusty<br />
auth system. The most common thread of all these is that they are all scriptable.<br />
You folks know your own auth systems. We&#8217;ll throw this in the unstable<br />
release/dev branch that we&#8217;ll be launching and hopefully get some feed back<br />
from you folks to fine tune it before we put it into stable.</p>
<p>Now that I&#8217;ve said that in public I&#8217;m well and truly screwed and will have to do it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/rory/2007/10/08/im-cold-and-there-are-wolves-after-me/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
