<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EstilCorreuElectrnic17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="CA" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi all, I am trying to configure an <AuthBy EXTERNAL> that will get VLAN information from our JIRA inventory using MAC authentication.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am trying to achieve this using a perl script, but I am starting from the first as it does not work for me.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I just configured this Handler:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Courier New""><Handler Client-Identifier=Extreme><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Courier New""> <AuthBy EXTERNAL><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Courier New""> Command "C:\perl\perl\bin\perl.exe C:\PROGRA~1\Radiator\MACAuth.pl"<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Courier New""> ResultInOutput<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Courier New""> </AuthBy><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Courier New""></Handler><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The “MACAuth.pl” script is by now the perl sample found in the goodies directory, but slightly modified (code follows)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The issue is that I see in the logs that it runs the script, but then it never returns to radiator, and the daemon will stop processing requests. Basically, it hangs waiting for the response of the script.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am running Server 2012 R2 with Strawberry Perl 5.18<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Am I doing something wrong? Is this a bug?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This is the code of the script. Thank you!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">#<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># testcommand<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Example to demonstrate how to handle AuthBy EXTERNAL, using<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># a perl script<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">#<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># The incoming attributes are on stdin, one per line in to format<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># <tab>attribute-name = value<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Some will have quoted values, and some wont<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">#<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">my $log = "C:\\Program Files\\Radiator\\log.txt";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">while (<>)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> chomp;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> open(my $fh, '>>', $log);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> if ($_ =~ /^\s*([^\s=]+)\s*=\s*"((\\"|[^"])*)"/)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> # Quoted value<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> $input{$1} = $2;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> elsif ($_ =~ /^([^\s=]+)\s*=\s*(.*)/)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> # Unquoted value<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> $input{$1} = $2;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> print $fh "$1 = $2\n";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> close $fh;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Now have all the incoming attributes in %input<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># As a test we will see if User-Name is fred. If so,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># we will accept, else reject with a suitable Reply-Message<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># You can set other reply attributes too, if you like.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># The exit value indicates accept or reject:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># 0 = Accept<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># 1 = Reject<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># 2 = Ignore<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># 3 = Challenge<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Alternatively you can print one of the strings ACCEPT, REJECT<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># IGNORE CHALLENGE or REJECT_IMMEDIATE on the first line if<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># you are using ResultInOutput<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">if ($input{'User-Name'} eq '0022411fdeba')<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> print "ACCEPT\n"; # If you are using ResultInOutput<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> print "Tunnel-Type = VLAN\n";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> print "Tunnel-Medium-Type = Ether_802\n";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> print "Tunnel-Private-Group-ID = 15\n";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sleep 1;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> exit 0; # accept, if not using ResultInOutput<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">else<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> print "REJECT\n"; # If you are using ResultInOutput<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sleep 1;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> exit 1; # reject, if not using ResultInOutput<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D;mso-fareast-language:ES">-------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D;mso-fareast-language:ES">Viktu Pons i Colomer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D;mso-fareast-language:ES">-------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>