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

<channel>
	<title>Robert Juric</title>
	<atom:link href="http://robertjuric.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertjuric.com</link>
	<description>Network Engineer</description>
	<lastBuildDate>Mon, 23 Apr 2012 11:56:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>My Promise to You</title>
		<link>http://robertjuric.com/2012/04/12/my-promise-to-you/</link>
		<comments>http://robertjuric.com/2012/04/12/my-promise-to-you/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 00:28:27 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=658</guid>
		<description><![CDATA[By using this icon on my website I am stating&#8230; 1. That I am opposed to the use of corporate advertising on blogs. 2. That I feel the use of corporate advertising on blogs devalues the medium. 3. That I &#8230;<p class="read-more"><a href="http://robertjuric.com/2012/04/12/my-promise-to-you/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;"><a href="http://www.adfreeblog.org/" target="_blank"><img src="http://www.adfreeblog.org/adfreebutton2.jpg" alt="" /></a></p>
<p style="text-align: center;">
<p align="left"><strong>By using this icon on my website I am stating&#8230;</strong></p>
<p align="left">1. That I am opposed to the use of corporate advertising on blogs.</p>
<p align="left">2. That I feel the use of corporate advertising on blogs devalues the medium.</p>
<p align="left">3. That I do not accept money in return for advertising space on my blog.</p>
<p align="left">Signed,</p>
<p align="left">Robert Juric</p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2012/04/12/my-promise-to-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rethinking Scripting</title>
		<link>http://robertjuric.com/2012/02/21/rethinking-scripting/</link>
		<comments>http://robertjuric.com/2012/02/21/rethinking-scripting/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 02:21:25 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[SharpSSH]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=628</guid>
		<description><![CDATA[I recently wrote a post stating I was beginning learning scripting to aid in my network administration tasks. I had initially stated I was going to use Perl for this. Then I tried to write a script at work, but &#8230;<p class="read-more"><a href="http://robertjuric.com/2012/02/21/rethinking-scripting/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I recently wrote a post stating I was beginning learning scripting to aid in my network administration tasks. I had initially stated I was going to use Perl for this. Then I tried to write a script at work, but I&#8217;m not allowed to install unauthorized software on my machine, much less multiple machines or servers. We are also a Windows shop, so unfortunately no built-in scripting for me. Or so I thought. I overheard our Windows admin group talking about their Powershell scripts and this got me thinking. Can I use Powershell to write scripts for network device administration? It would make a great platform mostly because its authorized and it&#8217;s built-in to Windows 7 and Server 2008. I started to do some research and one of the first things I came across was the use of the command line version of PuTTY called PLink to SSH into boxes and then pass commands. I started down this path, but it wasn&#8217;t long before I began running into problems. Problems either passing commands through PLink or being unable to capture the entire output when running multiple commands. I had to find a better way.</p>
<p>I did some more research and discovered the use of a library called <a href="http://huddledmasses.org/scriptable-ssh-from-powershell/" target="_blank">SharpSSH in Powershell</a>. Now this is what I was looking for. In his post, Joel wrote a few Powershell functions using the SharpSSH library. All I have to do is store the DLLs some place and update the script with their location. The Invoke-SSH function he wrote closely mimics Expect scripts. You run a command and then &#8216;expect&#8217; the prompt. This allows the function to know when the command is complete, something I was seriously hurting for using PLink.</p>
<p>I&#8217;m a firm believer in not re-inventing the wheel, so what I did was take Joel&#8217;s functions and use them in a manner that would benefit myself and maybe other network admins. Let me walk you through a quick script I wrote utilizing Joel&#8217;s functions:</p>
<p>First I want to create my SSH session:</p>
<pre>New-SshSession root 192.168.1.1 ## Will be prompted for password
if (Receive-SSH '%')
{
#root prompt
Write-Host "Logged in as root. Starting CLI."
$a = Invoke-SSH "cli" '&gt;'
$rootlogin = 'true'
}</pre>
<p>Now you may ask why I created the if statement to check if I received the % prompt. If you&#8217;re a Juniper engineer then you would know that % is the shell prompt you receive if you log in as root. I know I hard-coded sending the root username, but in future posts I will share a snippet that will allow for more dynamic entry of username/password combos, and if it happens to be the root user, then we would like to send CLI to start the CLI and enter operational mode. The Invoke-SSH function sends command &#8216;cli&#8217; and expects the operational prompt &gt;. I used the variable to call the function because I didn&#8217;t want it to write any output at this time so I capture it in the variable and sit on it. I also set a variable to true if logged in as root, for use later in the script.</p>
<p>Next I want to download the entire config for my backup folder:</p>
<pre>#Invoke-SSH outputs the command(first line), the output, and the expected string line(EOF)
$a = Invoke-SSH "show config | no-more" '&gt;'
$a|out-file showconfig.txt
Write-Host "Config Backup Complete."</pre>
<p>Here I use a variable to call the Invoke-SSH function and send the command &#8220;show config | no-more&#8221;. Once the command is done executing we should be back at the operational mode prompt, therefore I expect &gt;. I then use out-file to write the variable to a text file, and write-host to display a little status message.</p>
<p>I then want to cleanly close out the session:</p>
<pre>#Extra exit when logged in as root.
if ($rootlogin='true')
{
Write-Host "Exiting CLI."
Send-SSH exit
}
Write-Host "Terminating Session."
Remove-SshSession #Will send exit.</pre>
<p>If I previously set the variable of rootlogin to &#8216;true&#8217;, then my I need an extra exit to get back to the shell prompt before my final exit closing the session.</p>
<p>This post is not intended to be an introduction to Powershell or scripting in general. There are better places for that. I just wanted to share an example of how you can use Powershell + SharpSSH to make your life a little easier. This script was written for Junos devices, however it could easily be modified for IOS devices, or any device for that matter.This example was a basic, single device, config backup script. I have some great snippets I will be sharing in future posts that can bolt on to make a more powerful script. </p>
<p>If you want the entire script, including Joel&#8217;s functions:</p>
<pre>## USING the binaries from:
## http://downloads.sourceforge.net/sharpssh/SharpSSH-1.1.1.13.bin.zip
[void][reflection.assembly]::LoadFrom( (Resolve-Path "D:\Scripts\Libraries\Tamir.SharpSSH.dll") )

## NOTE: These are bare minimum functions, and only cover ssh, not scp or sftp
##       also, if you "expect" something that doesn't get output, you'll be completely stuck.
##
## As a suggestion, the best way to handle the output is to "expect" your prompt,  and then do
## select-string matching on the output that was captured before the prompt.

function New-SshSession {
Param(
[string]$UserName
,  [string]$HostName
,  [string]$RSAKeyFile
,  [switch]$Passthru
)
if($RSAKeyFile -and (Test-Path $RSAKeyFile)){
$global:LastSshSession = new-object Tamir.SharpSsh.SshShell `
$cred.GetNetworkCredential().Domain,
$cred.GetNetworkCredential().UserName
$global:LastSshSession.AddIdentityFile( (Resolve-Path $RSAKeyFile) )
}
else {
$cred = $host.UI.PromptForCredential("SSH Login Credentials",
"Please specify credentials in user@host format",
"$UserName@$HostName","")
$global:LastSshSession = new-object Tamir.SharpSsh.SshShell `
$cred.GetNetworkCredential().Domain,
$cred.GetNetworkCredential().UserName,
$cred.GetNetworkCredential().Password
}

$global:LastSshSession.Connect()
$global:LastSshSession.RemoveTerminalEmulationCharacters = $true
if($Passthru) {
return $global:LastSshSession
}
}

function Remove-SshSession {
Param([Tamir.SharpSsh.SshShell]$SshShell=$global:LastSshSession)
$SshShell.WriteLine( "exit" )
sleep -milli 500
if($SshShell.ShellOpened) { Write-Warning "Shell didn't exit cleanly, closing anyway." }
$SshShell.Close()
$SshShell = $null
}

function Invoke-Ssh {
Param(
[string]$command
,  [regex]$expect ## there ought to be a non-regex parameter set...
,  [Tamir.SharpSsh.SshShell]$SshShell=$global:LastSshSession
)

if($SshShell.ShellOpened) {
$SshShell.WriteLine( $command )
if($expect) {
$SshShell.Expect( $expect ).Split("`n")
}
else {
sleep -milli 500
$SshShell.Expect().Split("`n")
}
}
else { throw "The ssh shell isn't open!" }
}

function Send-Ssh {
Param(
[string]$command
,  [Tamir.SharpSsh.SshShell]$SshShell=$global:LastSshSession
)

if($SshShell.ShellOpened) {
$SshShell.WriteLine( $command )
}
else { throw "The ssh shell isn't open!" }
}

function Receive-Ssh {
Param(
[RegEx]$expect  ## there ought to be a non-regex parameter set...
,  [Tamir.SharpSsh.SshShell]$SshShell=$global:LastSshSession
)
if($SshShell.ShellOpened) {
if($expect) {
$SshShell.Expect( $expect ).Split("`n")
}
else {
sleep -milli 500
$SshShell.Expect().Split("`n")
}
}
else { throw "The ssh shell isn't open!" }
}

#Script Start
New-SshSession root 192.168.1.1 ## Will be prompted for password
if (Receive-SSH '%')
{
#root prompt
Write-Host "Logged in as root. Starting CLI."
$a = Invoke-SSH "cli" '&gt;'
$rootlogin = 'true'
}
#Invoke-SSH outputs the command(first line) and the expected string line(EOF)
$a = Invoke-SSH "show config | no-more" '&gt;'
$a|out-file showconfig.txt
Write-Host "Config Backup Complete."
$b = Invoke-SSH "show version" "&gt;"
$b|out-file showversion.txt
Write-Host "Show Version Complete."

#Extra exit when logged in as root.
if ($rootlogin='true')
{
Write-Host "Exiting CLI."
Send-SSH exit
}
Write-Host "Terminating Session."
Remove-SshSession #Will send exit.</pre>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2012/02/21/rethinking-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Authenticating Cisco VoIP Phones via Dot1x</title>
		<link>http://robertjuric.com/2012/01/13/authenticating-cisco-voip-phones-via-dot1x/</link>
		<comments>http://robertjuric.com/2012/01/13/authenticating-cisco-voip-phones-via-dot1x/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 20:26:20 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[Dot1X]]></category>
		<category><![CDATA[Network Policy Server]]></category>
		<category><![CDATA[NPS]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=602</guid>
		<description><![CDATA[If anyone has attempted to authenticate Cisco VoIP phones via Dot1x and Microsoft Network Policy Server then you know there are a few small issues. First the username that the phones send to the Radius server exceeds the length allowed &#8230;<p class="read-more"><a href="http://robertjuric.com/2012/01/13/authenticating-cisco-voip-phones-via-dot1x/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>If anyone has attempted to authenticate Cisco VoIP phones via Dot1x and Microsoft Network Policy Server then you know there are a few small issues. First the username that the phones send to the Radius server exceeds the length allowed by Windows. Secondly it is not a straightforward setup to get the phones to properly authenticate. </p>
<p>First in Windows Server 2008, Microsoft removed support for EAP-MD5 authentication. However you can re-add this support to NPS by modifying the registry according to <a href="http://support.microsoft.com/kb/922574" target="_blank">Microsoft KB922574</a>. </p>
<p>Because phones are the exception to my normal radius policies, I used a separate Connection Request Policy for VOIP phones. I created one with the condition to match UserName = &#8220;CP-*&#8221;. This should ensure that this policy only applies to Cisco phones(because all their usernames start with CP-*). </p>
<p>Next we need to shorten the username which the phone sends so that we can match it to a valid Windows Domain Account. To do this we use the separate VOIP Connection Request Policy. Under Settings &gt; Attributes we need to override the Username attribute using a match and replace. For example we find &#8220;CP-7975G-&#8221; and replace with &#8220;&#8221;. This will essentially remove the first part of the username and leave us with the &#8220;SEP&#8230;&#8221; username. A separate match will have to be configured for every model of Cisco phone which needs to be authenticated.</p>
<p>Finally we need to configure the authentication methods. Under Settings &gt; Authentication Methods we want to Override Network Policy Authentication Settings. We add the EAP Type &#8220;MD5-Challenge&#8221; and then check Encrypted Authentication (CHAP). This allows us to use a single Network Policy and override it when necessary using our VOIP Connection Request Policy. </p>
<p>The only thing left to do is ensure that a Windows Domain Account is created and the Account Password is Stored using Reversible Encryption. Then enter the account password as the MD5 shared secret on the phone, turn Dot1x on the port and you&#8217;re good to go. If you&#8217;re using a Cisco switch, ensure you have dual-host authentication enabled so you can also authenticate a computer hanging off the phone.</p>
<p>If you need a little help troubleshooting NPS and can&#8217;t find events in MS Event Viewer from CMD Prompt, Run As Admin, type: &#8220;auditpol /set /subcategory:&#8221;Network Policy Server&#8221; /success:enable /failure:enable&#8221;. NPS logs are in Event Viewer/CustomViews/Server Roles/Network Policy Server</p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2012/01/13/authenticating-cisco-voip-phones-via-dot1x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2011 in review</title>
		<link>http://robertjuric.com/2012/01/01/2011-in-review/</link>
		<comments>http://robertjuric.com/2012/01/01/2011-in-review/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 20:05:30 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=594</guid>
		<description><![CDATA[The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog. Here&#8217;s an excerpt: The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 21,000 times in 2011. If it were a &#8230;<p class="read-more"><a href="http://robertjuric.com/2012/01/01/2011-in-review/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.</p>
<p>	<a href="/2011/annual-report/"><img src="http://www.wordpress.com/wp-content/mu-plugins/annual-reports/img/emailteaser.jpg" width="100%" alt="" /></a></p>
<p>Here&#8217;s an excerpt:</p>
</p>
<blockquote><p>The concert hall at the Syndey Opera House holds 2,700 people.  This blog was viewed about <strong>21,000</strong> times in 2011.  If it were a concert at Sydney Opera House, it would take about 8 sold-out performances for that many people to see it.</p></blockquote>
<p><a href="/2011/annual-report/">Click here to see the complete report.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2012/01/01/2011-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl &#8211; Reading from File</title>
		<link>http://robertjuric.com/2011/12/20/perl-reading-from-file/</link>
		<comments>http://robertjuric.com/2011/12/20/perl-reading-from-file/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 03:12:55 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Ping]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=587</guid>
		<description><![CDATA[In my first attempt at Perl scripting I wrote a short script to ping a host taken from a command-line argument. I now want to expound on that idea by pinging a list of hosts saved in a text file. &#8230;<p class="read-more"><a href="http://robertjuric.com/2011/12/20/perl-reading-from-file/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://robertjuric.com/2011/12/18/perl-beginnings/" title="Perl Beginnings" target="_blank">first attempt at Perl scripting</a> I wrote a short script to ping a host taken from a command-line argument. I now want to expound on that idea by pinging a list of hosts saved in a text file. To do this we simply open the text file as an array of lines and then use a &#8220;for&#8230;each&#8221; loop to ping each host individually. Each line contains a hidden newline character which has to be removed in order for the Net::Ping method to process the variable correctly. I attempted to use the Perl Chomp() function, however this was yielding strange results. After some experimentation I found an answer using my first foray into regular expressions (regex). Using the Perl search and replace regex function I was able to search the individual line for the newline character and replace it with nothing. I used a handy little tool, which you can find <a href="http://www.regextester.com/" target="_blank">here</a>, to practice and see if my regex matched correctly on the newline character. </p>
<p>Here is the script I ended up with:</p>
<pre>
use Net::Ping;
use strict;
open(MYINPUTFILE, "hosts.txt");
my(@hosts) = &lt;MYINPUTFILE&gt;;
my($host);
foreach $host (@hosts) {
	$host =~ s/s+$//; #strip newline character from variable
	my $pingobj = Net::Ping-&gt;new('icmp');
	my ($status,$time,$ip) = $pingobj-&gt;ping($host);
	if ($status) {
		print "Host $host ($ip) responded in $time secondsn";
	} else {
		print "Host $host ($ip) unreachablen";
	}
}
close(MYINPUTFILE);
</pre>
<p>And the results:<br />
<a href="http://robertj.files.wordpress.com/2011/12/screenshot017.jpg"><img src="http://robertj.files.wordpress.com/2011/12/screenshot017.jpg" alt="" title="Ping-Loop" width="597" height="329" class="aligncenter size-full wp-image-588" /></a></p>
<p>I created a hosts.txt file and put it alongside the script and for testing purposes I tried a few different formats for host entries as well as a &#8220;null&#8221; value to make sure the script was working as designed. I hope you can pick up where I am headed with this building block. This script will be the basis for more advanced scripts such as automating changes to multiple devices. </p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2011/12/20/perl-reading-from-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl Beginnings</title>
		<link>http://robertjuric.com/2011/12/18/perl-beginnings/</link>
		<comments>http://robertjuric.com/2011/12/18/perl-beginnings/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 01:52:46 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Ping]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=576</guid>
		<description><![CDATA[After reading some advice from some very smart people, I&#8217;ve decided to try my hand at learning a scripting language to aid in my network administration tasks. After some quick searching I&#8217;ve decided to learn Perl. From what I&#8217;ve gathered &#8230;<p class="read-more"><a href="http://robertjuric.com/2011/12/18/perl-beginnings/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>After reading some advice from some very smart people, I&#8217;ve decided to try my hand at learning a scripting language to aid in my network administration tasks. After some quick searching I&#8217;ve decided to learn Perl. From what I&#8217;ve gathered it has strong text manipulation capabilities which will come in handy parsing device configs or SNMP/SSH responses. I&#8217;m not going to attempt to teach programming basics, but what I hope to cover will be some useful examples and building blocks that we can use as network administrators. </p>
<p>For my scripting setup I will be focusing on a Windows perspective. Instead of using <a href="http://www.activestate.com/activeperl/downloads" target="_blank">ActivePerl</a> I decided to use <a href="http://www.cygwin.com/" target="_blank">Cygwin</a> and the Perl modules, so hopefully most of what I write will also apply to *nix users. I&#8217;m also using <a href="http://notepad-plus-plus.org/" target="_blank">Notepad++</a> for my editing/coding, but you could also use the default Windows Notepad or if you want to be hardcore, Cygwin and VIM. I may include some VIM tips/shortcuts in future posts.</p>
<p>My first Perl script is not &#8220;Hello, World&#8221;, but instead a simple Ping script. I used <a href="http://perldoc.perl.org/Net/Ping.html" target="_blank">Net::Ping</a> to conduct a simple ICMP Ping and then output the results. The example I first used had a hard-coded variable for the host, which I left commented out for reference purposes. Instead, I added a line to receive a command line argument for the host variable.</p>
<pre>
use Net::Ping;
use strict;

#Setting a variable
#my $host = "www.google.com";

#Using an arguement
my $host = "$ARGV[$0]";
my $pingobj = Net::Ping-&gt;new('icmp');
my ($status,$time,$ip) = $pingobj-&gt;ping($host);

if ($status) {
print "Host $host ($ip) responded in $time secondsn";
} else {
print "Host $host ($ip) unreachablen";
}
</pre>
<p>Voila!<br />
<a href="http://robertj.files.wordpress.com/2011/12/screenshot016.jpg"><img src="http://robertj.files.wordpress.com/2011/12/screenshot016.jpg" alt="" title="Ping" width="593" height="325" class="aligncenter size-full wp-image-580" /></a></p>
<p>I plan on using this script as a building block to test connectivity before performing more complex tasks in the future. Hopefully this will motivate somebody to get their hands dirty and add another tool to their skill set. </p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2011/12/18/perl-beginnings/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Working with IPv6 and Juniper SRX</title>
		<link>http://robertjuric.com/2011/11/22/working-with-ipv6-and-juniper-srx/</link>
		<comments>http://robertjuric.com/2011/11/22/working-with-ipv6-and-juniper-srx/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 14:23:44 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Juniper]]></category>
		<category><![CDATA[6to4]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[JUNOS]]></category>
		<category><![CDATA[slaac]]></category>
		<category><![CDATA[SRX]]></category>
		<category><![CDATA[SRX100]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=540</guid>
		<description><![CDATA[I finally decided that if I don’t run IPv6 then I am never truly going to understand it. I figured the best place to get started would be my own home. I didn’t want to completely get rid of my &#8230;<p class="read-more"><a href="http://robertjuric.com/2011/11/22/working-with-ipv6-and-juniper-srx/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I finally decided that if I don’t run IPv6 then I am never truly going to understand it. I figured the best place to get started would be my own home. I didn’t want to completely get rid of my IPv4 network, I only wanted to try to get IPv6 up and running, so I decided to run a dual-stack. Since the computers are running Windows 7 and I have an SRX100 as our household firewall this proved not to be a problem. Also, it was only an after-thought, but apparently our wireless access point would pass the IPv6 traffic without any problems. My next problem was external IPv6 connectivity, what good would my private IPv6 network be if I couldn’t connect to any other IPv6 networks?</p>
<p>Enter Hurricane Electric and their free IPv6 tunnel broker service at <a href="http://tunnelbroker.net/" target="_blank">http://tunnelbroker.net/</a>. This is a free service that allows you to build a 6to4 tunnel to their network which then acts as your IPv6 gateway. 6to4 tunneling (RFC 3056 <a href="http://tools.ietf.org/html/rfc3056" target="_blank">http://tools.ietf.org/html/rfc3056</a>) is an IPv6 transition mechanism which allows IPv6 packets to be encapsulated (aka tunneled) within IPv4 packets to a 6to4 gateway router which is then de-encapsulated and sent on to IPv6 networks. So I registered with HE using my external IPv4 address as the tunnel end-point and was assigned my tunnel endpoints as well as my very own routed /64 block of IPv6 addresses. I was also given an IPv6 DNS server to point to. It was finally time to get IPv6 up and running.</p>
<p>The first thing I needed to do was get my tunnel up and running. On my SRX100 this involved creating an IP tunnel interface, adding an IPv6 static route, and putting the SRX in packet-mode for IPv6 traffic.</p>
<pre>
interfaces {
   ip-0/0/0 {
      unit 0 {
         tunnel {
            source 99.111.88.228;
            destination 216.66.22.2;
         }
         family inet6 {
            address 2001:470:7:e9e::2/64;
         }
      }
   }
}
routing-options {
   rib inet6.0 {
      static {
         route ::/0 next-hop 2001:470:7:e9e::1;
      }
   }
}
security {
   forwarding-options {
      family {
         inet6 {
            mode packet-based;
         }
      }
   }
}
</pre>
<p>At that point I could see my tunnel was operational and I was able to ping the remote end of the tunnel. Next I needed to get IPv6 running internally. I decided to use Stateless Address Auto Configuration (SLAAC) for address configuration. Devices running IPv6 will automatically configure for themselves a link-local address. This address is created using the FE80::/64 block + the EIU64 Interface ID. The EIU64 Interface ID is dynamically created using the Ethernet MAC address. The link-local address is required for basic IPv6 operations such as Neighbor Discovery Protocol (NDP) which is used for SLAAC. Basically the link-local address allows for local communication of hosts without configuration in order to facilitate higher-level communications. One thing about link-local address are that they are not globally routable, which means that my computers with only a link-local IPv6 address would not be able to communicate with other IPv6 devices such as web servers.</p>
<p>I needed to use my /64 block of globally routable IPv6 addresses I was given and assign them to my hosts. To do this I needed to configure IPv6 Router Advertisements (RAs) to allow my hosts to use SLAAC and auto-configure themselves an IPv6 address.</p>
<pre>
interfaces {
   vlan {
      unit 0 {
         family inet {
            address 192.168.1.1/24;
         }
         family inet6 {
            address 2001:470:8:e9e::1/64;
         }
      }
   }
}
protocols {
   router-advertisement {
      interface vlan.0 {
         max-advertisement-interval 20;
         min-advertisement-interval 15;
         prefix 2001:470:8:e9e::/64;
      }
   }
}
</pre>
<p>Now my hosts have both a link-local and a global IPv6 address and are able to ping through my tunnel. So far I haven’t done enough experimenting to get DHCPv6 working for DNS server assignment so I currently have my hosts DNS servers statically configured. I was then able to go online and check my IPv6 connectivity via <a href="http://test-ipv6.com/" target="_blank">http://test-ipv6.com/</a>.</p>
<p>Caveats:<br />
Packet-based forwarding of IPv6 &#8211; Still researching the implications of this in regards to security<br />
Had to use Junos 10.4R7.5 to assign family inet6 on vlan interfaces<br />
Still have to experiment with DNS server assignment either through DHCPv6 or some other means<br />
Lack of IPv6 websites/stuff to do<br />
Security Considerations for 6to4 RFC 3964 <a href="http://tools.ietf.org/html/rfc3964" target="_blank">http://tools.ietf.org/html/rfc3964</a></p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2011/11/22/working-with-ipv6-and-juniper-srx/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>CLI Shortcuts</title>
		<link>http://robertjuric.com/2011/10/18/cli-shortcuts/</link>
		<comments>http://robertjuric.com/2011/10/18/cli-shortcuts/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 13:03:24 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Insights]]></category>
		<category><![CDATA[Juniper]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[JUNOS]]></category>
		<category><![CDATA[shortucts]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=531</guid>
		<description><![CDATA[In my attempt to become a CLI wizard I felt like I needed to gain a little more speed and control when I&#8217;m at the command line. Holding down arrow keys or the backspace key is really a time waster, &#8230;<p class="read-more"><a href="http://robertjuric.com/2011/10/18/cli-shortcuts/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>In my attempt to become a CLI wizard I felt like I needed to gain a little more speed and control when I&#8217;m at the command line. Holding down arrow keys or the backspace key is really a time waster, and not very accurate. So I dug around a little and found these shortcut combos. I&#8217;ve tested them in PuTTY on both a Cisco and Juniper device.</p>
<p>Move to Begining of Line<br />
Ctrl+a</p>
<p>Move to End of Line<br />
Ctrl+e</p>
<p>Move Forward a Word<br />
Alt+f</p>
<p>Move Backward a Word<br />
Alt+B</p>
<p>Delete a Line (On Cisco, Only Worked From End of Line)<br />
Ctrl+x or Ctrl+u</p>
<p>Delete a Character (Under Cursor)<br />
Ctrl+d</p>
<p>Delete Word Forward (In Front of Cursor)<br />
Alt+d or Esc+d</p>
<p>Delete Word Backwards (Behind Cursor)<br />
Ctrl+w or Alt+Backspace</p>
<p>Clear Line From Cursor Forward<br />
Ctrl+k</p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2011/10/18/cli-shortcuts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SRX Firewall User Authentication</title>
		<link>http://robertjuric.com/2011/10/17/srx-firewall-user-authentication/</link>
		<comments>http://robertjuric.com/2011/10/17/srx-firewall-user-authentication/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 02:44:55 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Juniper]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[firewall-authentication]]></category>
		<category><![CDATA[firewall-user-authentication]]></category>
		<category><![CDATA[JUNOS]]></category>
		<category><![CDATA[SRX]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=521</guid>
		<description><![CDATA[Juniper SRX firewalls have a feature called Firewall User Authentication. FUA is another layer of protection on top of security policies to restrict/permit users or groups of users individually. FUA is a very limited feature but it could be used &#8230;<p class="read-more"><a href="http://robertjuric.com/2011/10/17/srx-firewall-user-authentication/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Juniper SRX firewalls have a feature called Firewall User Authentication. FUA is another layer of protection on top of security policies to restrict/permit users or groups of users individually. FUA is a very limited feature but it could be used as a poor-man&#8217;s NAC in a pinch. Users are authenticated via a single external source(RADIUS, LDAP, or SecureID) or the local database. FUA can operate in two different modes, Pass-Through Authentication, and Web Authentication.</p>
<p>Pass-Through Authentication is limited to Telnet, FTP, and HTTP traffic only(notice these are plain-text protocols). Pass-through auth works by interjecting a login challenge into the original protocol login challenge. For example a user would initiate a telnet connection, the FUA would interject and prompt the security challenge. Once authenticated, traffic from the same source IP is automatically allowed to pass through the SRX(could be dangerous with source NAT). This would allow the telnet connection to continue and the user can authenticate to the telnet host. Once the user has authenticated via FUA the IP address becomes exempt from further FUA requirements. This means that you can create a security policy that matches on ANY traffic type and require FUA; Pass-through authentication only works with Telnet, FTP, or HTTP, however once the IP/user has authenticated then it is exempt from further FUA, and it is then only bound by security policy. I said that to say this: you can use a telnet session to authenticate a user via FUA who, once authenticated, can pass any type of traffic which is allowed by the security policy.</p>
<p>Web Authentication operates in two sub-modes, standard web authentication, and web redirect. Standard web auth first requires you enable the HTTP system service, and also allow http in host-inbound-traffic. With standard web auth, you would direct your users to a secondary IP address of an interface on the SRX. Users would be prompted with an HTTP login form for the FUA. Once authenticated the IP address is added to the exempt list and is able to pass through the firewall as much as security policy allows. The web redirect operates like standard web auth, but you don&#8217;t have to hand out an IP address of your firewall or direct users to a separate login page. Web redirect works much like what you&#8217;re used to in a hotel room; You open your browser and head to Google.com, and you are automagically redirected to a login page. Once you authenticate you are able to pass through the firewall as much as security policy allows.</p>
<p>With all the authentication methods you are also able to configure a default timeout for inactivity and login/success/failure banners. Web redirect + a login banner would be a great poor-man option for a Guest Wireless NAC. You could hand out the username and password to guests, and they would be prompted with the Acceptable Use Policy before logging in.</p>
<p><span style="color:#ff0000;">All FUA configuration follows the same basic principles: configure an access profile, configure the firewall authentication options, and finally call on the firewall authentication from security policy. (Good to know on an exam).</span></p>
<p>Configure the access profile (local user database):</p>
<pre>set access profile *profile-name* client *name* firewall-user password *pwd*</pre>
<p>or (external authentication):</p>
<pre>set access profile *profile-name* authentication-order [radius password]
set access profile *profile-name* radius-server *ip-address* secret *radius-secret*</pre>
<p>Then configure the authentication type and options:</p>
<pre>set access firewall-authentication pass-through default-profile *profile-name*
set access firewall-authentication pass-through [telnet/ftp/http] banner login "You must login"</pre>
<p>or</p>
<pre>set interface *name* unit 0 family inet address *ip/mask* web-authentication http
set access firewall-authentication web-authentication default-profile *profile-name*
set access firewall-authentication web-authentication banner success "Login successful"</pre>
<p>Finally set a permit action of firewall-authentication in the security policy. For pass-through use: &#8220;Permit firewall-authentication pass-through client-match *client-name*&#8221;. For web auth use: &#8220;Permit firewall-authentication web-authentication client-match *client-name*&#8221;. For web redirect use the same as pass-through but add a web-redirect argument: &#8220;Permit firewall-authentication pass-through web-redirect&#8221;.</p>
<p>And finally to verify:</p>
<pre>show security firewall-authentication users
show security firewall-authentication history</pre>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2011/10/17/srx-firewall-user-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security Policy and Address Groups</title>
		<link>http://robertjuric.com/2011/09/29/security-policy-and-address-groups/</link>
		<comments>http://robertjuric.com/2011/09/29/security-policy-and-address-groups/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 18:59:16 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Juniper]]></category>
		<category><![CDATA[JUNOS]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[ScreenOS]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://robertjuric.com/?p=510</guid>
		<description><![CDATA[I recently sat through a Juniper Security (JSEC) training course and learned something new about security policy regarding the objects that are able to be referenced in policy. When I got back to work I had a few rules I &#8230;<p class="read-more"><a href="http://robertjuric.com/2011/09/29/security-policy-and-address-groups/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I recently sat through a Juniper Security (JSEC) training course and learned something new about security policy regarding the objects that are able to be referenced in policy. When I got back to work I had a few rules I needed to add and some that needed to be removed so I thought it would be a good point to make the switch. I am talking about the use of address groups in security policy. Before we can reference a prefix in security policy it must be created as an address object. These address objects are stored in an address-book <em>per</em> security zone.  We can also create address-sets (Junos) and address groups (ScreenOS) which are basically groups consisting of individual address members. When we create a security policy, instead of creating a policy for each address entry, we can reference the address-set/address group to apply the policy to like entries. This allows us to change individual entries for a policy without directly affecting the policy. For example, I have a group of 5 servers that need web access to download updates, but I don&#8217;t want the entire zone to have Internet access. Instead of creating 5 individual policies I can create a single policy and refence an address-set/address group which consists of the 5 server address objects. In the future if I ever decide to give a new server Internet access or I need to remove Internet access for a server, I don&#8217;t have to worry about cluttered policies, I can just add or remove an address to the address-set/address group.</p>
<h2>Junos</h2>
<p>We first need to create our address objects:</p>
<pre>set security zones security-zone *ZoneName* address-book *AddressName* x.x.x.x/y</pre>
<p>Then we need to create our address-set:</p>
<pre>set security zones security-zone *ZoneName* address-book address-set *SetName* address *AddressName*</pre>
<p>A few caveats, an address-set can only exist when there multiple addresses in the address-book. An address-set can only contain addresses from the same security zone, and also the address-set name cannot be the same as an existing address name.</p>
<h2>ScreenOS</h2>
<p>First create the address objects:</p>
<pre>set address *ZoneName* *AddressName* x.x.x.x/y *Comment*</pre>
<p>Then create the address group:</p>
<pre>set group address *ZoneName* *GroupName* *Comment*
set group address *ZoneName* *GroupName* add *AddressName*</pre>
<p>One thing I noticed in the Junos TechPubs was that when you reference an address-set in policy Junos creates an internal rule for each member, as well as each service. So if you create a policy which references an address-set for both source and destination and also a service group, Junos actually creates multiple internal rules. If you don&#8217;t pay attention to the size of your groups you could exceed policy resources even though it appears you have a relatively small number of configured policies.</p>
<p>The main point I want to convey isn&#8217;t necessarily how to configure address sets/groups, but to motivate you to use them. It&#8217;s standard practice in the Windows AD realm where you rarely want to give an individual user rights to a server, it&#8217;s much cleaner to give a security group rights to the server and then manage the membership of that group. This is particularly helpful if the same group will be referenced on multiple servers. The same concept applies to our firewall security policies.</p>
<p>So go forth and simplify your firewall rules&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://robertjuric.com/2011/09/29/security-policy-and-address-groups/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

