<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>LINICKX.com</title><link>https://www.linickx.com/</link><description></description><lastBuildDate>Sat, 05 Sep 2020 09:16:00 +0100</lastBuildDate><item><title>Example Azure Web Application Firewall (WAF)</title><link>https://www.linickx.com/example-azure-web-application-firewall-waf</link><description>&lt;p&gt;I quite enjoyed my recent foray into setting up an &lt;a href="https://www.linickx.com/example-hub--spoke-azure-firewall"&gt;example Azure Firewall&lt;/a&gt;, so he's a sequel! 🙃&lt;/p&gt;
&lt;p&gt;As before, the post will be screenshot heavy but not all screenshots, the plan is to deploy a vulnerable web application behind the WAF in blocking mode so we can see basic exploits being blocked.&lt;/p&gt;
&lt;h2&gt;Step 1 - Planning&lt;/h2&gt;
&lt;p&gt;Here's a basic picture of what we want to achieve...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/WAF-Example-Drawing1.png"&gt;&lt;img src="/files/2020/09/WAF-Example-Drawing1.png"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For the Web Server, we're going to run &lt;a href="http://www.dvwa.co.uk"&gt;Damn Vulnerable Web Application (DVWA)&lt;/a&gt; in an &lt;a href="https://azure.microsoft.com/en-gb/services/container-instances/"&gt;Azure Container Instance&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Everything will be deployed into a single resource group to make cleanup/delete easier at the end.&lt;/p&gt;
&lt;h3&gt;Naming Convention&lt;/h3&gt;
&lt;p&gt;Here's a gotcha for Naming Conventions, in my last post I used hyphens, but container instances not allow that, so I'll have to plan a new way. &lt;/p&gt;
&lt;p&gt;I still want to follow the region followed by a primary identifier approach...&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;uksrgwaf → Resource Group&lt;br /&gt;
ukswaf1 → Azure Web Application Firewall&lt;br /&gt;
uksweb1 → 1st Web Server (Docker DVWA)&lt;br /&gt;
uksvnetwaf1 → WAF Network  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Something like that should do the trick!&lt;/p&gt;
&lt;h3&gt;Networking&lt;/h3&gt;
&lt;p&gt;Two networks will be needed, one for the Security Gateway and one for the Docker Web App, we'll then peer them together.... if you want to by-pass the WAF and access the App directly, plan yourself a 3rd network for a Virtual Windows box.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;uksvnetwaf1 → 172.16.1.0/24&lt;/li&gt;
&lt;li&gt;uksvnetweb1 → 172.16.2.0/24&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Step 2 - Create a Container Instance&lt;/h2&gt;
&lt;p&gt;The build takes a little while, so kick that off first.&lt;/p&gt;
&lt;p&gt;We're going to pull an image &lt;code&gt;vulnerables/web-dvwa&lt;/code&gt; from &lt;a href="https://hub.docker.com/r/vulnerables/web-dvwa/"&gt;the public docker hub&lt;/a&gt; based on linux.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/01-uksweb1.png"&gt;&lt;img src="/files/2020/09/01-uksweb1.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We want the networking type to be &lt;code&gt;Private&lt;/code&gt; as we're protecting this behind the WAF; I'm going to create a new vNet to meet my planning above, you are welcome to accept the defaults if you like.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/01-uksweb1-vnet.png"&gt;&lt;img src="/files/2020/09/01-uksweb1-vnet.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;
&lt;a href="/files/2020/09/01-uksweb1-vnet-2.png"&gt;&lt;img src="/files/2020/09/01-uksweb1-vnet-2.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Make no changes to Advanced Settings, skip the tags and hit create.&lt;/p&gt;
&lt;h2&gt;Step 3 - Create Log Analytics workspace&lt;/h2&gt;
&lt;p&gt;If you don't have one already, you need somewhere to send the logs...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/02-ukslogs.png"&gt;&lt;img src="/files/2020/09/02-ukslogs.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Step 4 - Create the WAF... well actually the Application Gateway.&lt;/h2&gt;
&lt;p&gt;So here's the thing, the WAF is part of the &lt;a href="https://azure.microsoft.com/services/application-gateway/"&gt;Azure Application Gateway&lt;/a&gt; product, which is actually a load balancer... so we're going to setup a basic load balancer and then enable the WAF functionaility. Of course we've only deployed "1x Web Server" (&lt;em&gt;docker container instance&lt;/em&gt;) but you get the gist!&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Change the Tier to &lt;code&gt;WAF V2&lt;/code&gt;, set the firewall mode to &lt;code&gt;Prevention&lt;/code&gt;, scroll down to networking and create a new vNet...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1-vnet.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-vnet.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For the frontend, setup a new PublicIP&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1-pubip.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-pubip.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next we need to setup a backend pool, for now select &lt;code&gt;Add backend pool without targets&lt;/code&gt; we'll come back to that later!&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1-pool.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-pool.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;On the configuration page, notice how the left &amp;amp; right sides are already completed, we just need to add some rules in the middle...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1-config.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-config.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For the listener, setup a basic HTTP routing rule..&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1-rule-listener.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-rule-listener.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And then select Backend targets, assign our pool and add a new HTTP Setting; the HTTP settings will be 100% defaults, this is all load balancer stuff that won't apply to us as we have 1x Web Server.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/03-ukswaf1-rule-httpsettings.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-rule-httpsettings.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;
&lt;a href="/files/2020/09/03-ukswaf1-rule-backend.png"&gt;&lt;img src="/files/2020/09/03-ukswaf1-rule-backend.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Skip over tags and we can finally create.&lt;/p&gt;
&lt;h3&gt;Step 5 - Start joining the dots.&lt;/h3&gt;
&lt;p&gt;At this stage we have two islands, a docker container and a WAF, they're not connected. The first thing you want to do it peer the vNets.&lt;/p&gt;
&lt;h4&gt;Peering&lt;/h4&gt;
&lt;p&gt;Open one of the vNets, I've selected &lt;code&gt;uksvnetwaf1&lt;/code&gt;, select peering on the left and add a peering. Give it a name like &lt;code&gt;uksvnetwaf1-to-uksvnetweb1&lt;/code&gt;, select &lt;code&gt;uksvnetweb1&lt;/code&gt; from the dropdown list and give that a name like &lt;code&gt;uksvnetweb1-to-uksvnetwaf1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/04-vnet-peering.png"&gt;&lt;img src="/files/2020/09/04-vnet-peering.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Scroll down to the bottom, and allow external traffic in...&lt;/p&gt;
&lt;h4&gt;Update the Pool&lt;/h4&gt;
&lt;p&gt;Remember that step we skipped when creating the WAF (Application Gateway)... time to fix that.&lt;/p&gt;
&lt;p&gt;Go into your container instance and grab the private IP&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/04-container-ip.png"&gt;&lt;img src="/files/2020/09/04-container-ip.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now, go into your application gateway → backend pool and set the IP, mine is &lt;code&gt;172.16.2.4&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/04-waf-pool.png"&gt;&lt;img src="/files/2020/09/04-waf-pool.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Diagnostic Settings&lt;/h4&gt;
&lt;p&gt;Remember that Log Analytics workspace we created; within your application gateway add some diagnostics pointing the logs to the workspace.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/04-diagnostics.png"&gt;&lt;img src="/files/2020/09/04-diagnostics.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;
&lt;a href="/files/2020/09/04-diagnostics-settings.png"&gt;&lt;img src="/files/2020/09/04-diagnostics-settings.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Step 6 - Bootstrap DVWA&lt;/h3&gt;
&lt;p&gt;If all has gone well, in a new tab/window you can browse to your public IP http://a.b.c.d and you should get the DVWA log in screen. &lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/06-dvwa-login.png"&gt;&lt;img src="/files/2020/09/06-dvwa-login.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 50%;"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The default credentials are &lt;code&gt;admin&lt;/code&gt; &amp;amp; &lt;code&gt;password&lt;/code&gt;, scroll to the bottom and click &lt;code&gt;create / reset database&lt;/code&gt; , you'll be redirected to the login screen where you can log back in.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/06-dvwa-setup.png"&gt;&lt;img src="/files/2020/09/06-dvwa-setup.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At this stage you might want to change the password (under the CSRF menu) so you can play in peace, but just remember this thing is designed to be hacked 🙃&lt;/p&gt;
&lt;h3&gt;Step 7 - Lets test!&lt;/h3&gt;
&lt;p&gt;To prove the functionality we're going to do a couple of basic tests, a command injection and an SQL Inject, we're also going to disable a WAF RULE to show how to switch stuff off.&lt;/p&gt;
&lt;h4&gt;How to disable a rule&lt;/h4&gt;
&lt;p&gt;The WAF comes with a bunch of rules enabled by default, if you're deploying this into production the developers are going to be very concerned about the WAF blocking legitimate requests. To demonstrate the steps, we're going to disable the rule that flags "IP in header"; by default you should browser a site by it's name, but in our test we don't have one so let's switch off that rule.&lt;/p&gt;
&lt;p&gt;Go into your logs, and run this query to find WAF events...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;AzureDiagnostics
| where ResourceType == &amp;quot;APPLICATIONGATEWAYS&amp;quot; and OperationName == &amp;quot;ApplicationGatewayFirewall&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Scroll to the right you should see message &lt;code&gt;Host header is a numeric IP address&lt;/code&gt; with the rule ID &lt;code&gt;920350&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/07-HostHeader-Logs.png"&gt;&lt;img src="/files/2020/09/07-HostHeader-Logs.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now go into Web Application Firewall → Rules and enable &lt;code&gt;advanced configuration&lt;/code&gt;, search for 920350 and untick the box... then click save.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/07-disable-920350.png"&gt;&lt;img src="/files/2020/09/07-disable-920350.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Job done, that should clean out your logs a bit for the next test.&lt;/p&gt;
&lt;h4&gt;Blocking Command Injection&lt;/h4&gt;
&lt;p&gt;We're going nice and simple, from your DVWA tab, select &lt;em&gt;Command Injection&lt;/em&gt; and type in &lt;code&gt;127.0.0.1;cat /etc/password&lt;/code&gt; and click submit.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/07-command-injection.png"&gt;&lt;img src="/files/2020/09/07-command-injection.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You should get a forbidden page, notice how it says &lt;em&gt;Microsoft-Azure-Application-Gateway/v2&lt;/em&gt; ... the WAF blocked the attack. At this point be a little patient, it can take a while for logs to show up in the azure portal, but this time run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;AzureDiagnostics
| where ResourceType == &amp;quot;APPLICATIONGATEWAYS&amp;quot; and ruleId_s == &amp;quot;932100&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see the command matched a rule that caused the block.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/07-rce-logs.png"&gt;&lt;img src="/files/2020/09/07-rce-logs.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Blocking SQL Injection&lt;/h4&gt;
&lt;p&gt;For the 2nd test, browse to SQL injection and type in &lt;code&gt;%' or '0'='0&lt;/code&gt; and click submit.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/07-SQL-Injection.png"&gt;&lt;img src="/files/2020/09/07-SQL-Injection.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once again, you should see the blank Azure 403 forbidden page! &lt;/p&gt;
&lt;p&gt;Run this log search:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;AzureDiagnostics
| where ResourceType == &amp;quot;APPLICATIONGATEWAYS&amp;quot; and OperationName == &amp;quot;ApplicationGatewayFirewall&amp;quot; and Message contains &amp;quot;SQL&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see the SQL Injection was detected!&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/09/07-sqli-logs.png"&gt;&lt;img src="/files/2020/09/07-sqli-logs.png" style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;/End&lt;/h3&gt;
&lt;p&gt;That was another long post but we got there in the end, there's a lot to unpack there from setting up a docker container to disabling a WAF rule. As a reader there's a couple of area's you can follow up with, if you're not familiar with the basic exploits, set the WAF to &lt;em&gt;detection mode&lt;/em&gt; to view DVWA get compromised, you will also want to spend some time looking at the logs and preparing &lt;em&gt;better&lt;/em&gt; searches as  my examples are very specific to this post.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Sat, 05 Sep 2020 09:16:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2020-09-05:example-azure-web-application-firewall-waf</guid><category>Security</category><category>Azure</category><category>WAF</category><category>Firewall</category></item><item><title>Example Hub &amp; Spoke Azure Firewall</title><link>https://www.linickx.com/example-hub--spoke-azure-firewall</link><description>&lt;p&gt;It's been a while since I've done a Technical How-to, recently I wanted to get my head around Azure's firewall appliance, here's an example setup and in true MicroSoft style it comes complete with Point-n-Click screenshots! I'm assuming you at least know how to navigate Azure so post doesn't contain all the possible screenshots, for example I will skip screenshots for creating tags, but that all being said, it's still going to be a long one, hold on tight!&lt;/p&gt;
&lt;h2&gt;Step1 - Planning&lt;/h2&gt;
&lt;p&gt;Whilst reading the doc's and getting to grips with the &lt;a href="https://portal.azure.com"&gt;Azure Portal&lt;/a&gt; it became clear to me, you really need to plan before clicking, it's sooo easy to get stuff running that I'm confident that most orgs will have objects with generic names like "monitoring server" and then forget details like, which region is the server hosted!&lt;/p&gt;
&lt;p&gt;This picture is basically what I want to achieve, 2 servers separated by a firewall appliance for access to the Internet and each other; spoke 1 and 2 are isolated zones.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-01-Overview.png"&gt;&lt;img alt="Firewall Overview Diagram" src="/files/2020/08/AZEGFW-01-Overview.png" title="Firewall Overview Diagram"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Naming Convention&lt;/h3&gt;
&lt;p&gt;To get started I planned a basic naming standard using region followed by a primary identifier and then a description... &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;UKS-FW-vNET → UK (South) Firewall Virtual Network
or
UKS-Route-Spoke1-to-Hub → UK (South) Routing table, Spoke 1 static routes to Hub
or
UKS-Spoke1-VM1 → UK (South), Spoke 1, Virtual Machine
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm sure it could be better or more rigid but it should be enough for me to know what's what. In the GUI you can group by type &amp;amp; region so you don't really need these in your naming convention, but it's useful to know priority, in my examples the type "Route" is more important that if it's for Spoke1 or Spoke2 ... but for the VM, the location is more important... it's just a lab, do whatever you want 😉&lt;/p&gt;
&lt;h3&gt;Resource Group(s)&lt;/h3&gt;
&lt;p&gt;For this example, I'm creating a single resource group and putting it all there; in the real world we would expect to see different networks &amp;amp; VM's in different groups; I'm calling mine &lt;code&gt;FW-Test&lt;/code&gt; plan what you need.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-02-ResourceGroup.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Resource Group" src="/files/2020/08/AZEGFW-02-ResourceGroup.png" title="Resource Group"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Networking (IP Addressing)&lt;/h3&gt;
&lt;p&gt;Before defining the IP structure, think about DNS, by default all networks/devices use Microsoft's DNS but now-a-days we expect our DNS provider to add some security filtering &amp;amp; protection, so I'll be using Cisco's Umbrella (OpenDNS): &lt;code&gt;208.67.222.222&lt;/code&gt; &amp;amp; &lt;code&gt;208.67.220.220&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Each &lt;em&gt;Virtual Network&lt;/em&gt; is like a zone, it lives in a region and it can be calved up into smaller subnets when needed. I'll be working in &lt;code&gt;/23&lt;/code&gt; chunks, with the first &lt;code&gt;/24&lt;/code&gt; as the "main" subnet leaving the 2nd &lt;code&gt;/24&lt;/code&gt; to be used for &lt;em&gt;other stuff&lt;/em&gt;, I'm also going to use the &lt;code&gt;172.16&lt;/code&gt; RFC1918 space instead of the &lt;code&gt;10.x&lt;/code&gt; generated by Azure to really help show how networking hangs together in this example.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;UKS-FW-vNET1 → &lt;code&gt;172.16.0.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;UKS-vNET-Spoke1 → &lt;code&gt;172.16.2.0/23&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;UKS-Spoke1-Subnet1 → &lt;code&gt;172.16.2.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;UKS-vNET-Spoke2 → &lt;code&gt;172.16.4.0/23&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;UKS-Spoke2-Subnet1 → &lt;code&gt;172.16.4.0/24&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Create UKS-vNET-Spoke1 &amp;amp; UKS-vNET-Spoke2&lt;/h3&gt;
&lt;p&gt;Create the networks spoke networks first but not the firewall vNET, we'll do that after with the FW Appliance; There's nothing special about the Spokes at this stage, here is Spoke 1&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-03-SpokevNet1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Create First vNet" src="/files/2020/08/AZEGFW-03-SpokevNet1.png" title="Create First vNet"&gt;&lt;/a&gt;
&lt;a href="/files/2020/08/AZEGFW-03-SpokevNet2.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Add A Subnet" src="/files/2020/08/AZEGFW-03-SpokevNet2.png" title="Add A Subnet"&gt;&lt;/a&gt;
&lt;a href="/files/2020/08/AZEGFW-03-SpokevNet3.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Disable Security Settings" src="/files/2020/08/AZEGFW-03-SpokevNet3.png" title="Disable Security Settings"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Repeat for Spoke2.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After both vNets are built, if you want to use Custom DNS make that change...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-03-SpokevNet4-DNS.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Update DNS" src="/files/2020/08/AZEGFW-03-SpokevNet4-DNS.png" title="Update DNS"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Step 2 - Create the Firewall&lt;/h2&gt;
&lt;p&gt;The firewall build takes a little time, let's kick that off! &lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-04-CreateFW1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Create FW" src="/files/2020/08/AZEGFW-04-CreateFW1.png" title="Create FW"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Under the firewall settings, we're going to now define the vNET... notice how the subnet has a special (reserved) name; we also need to create and assign a public IP.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-04-CreateFW2.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Settings" src="/files/2020/08/AZEGFW-04-CreateFW2.png" title="FW Settings"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Whilst you're waiting for the deployment...&lt;/p&gt;
&lt;h3&gt;Setup Logging&lt;/h3&gt;
&lt;p&gt;By default you don't get firewall logs, we need to switch that on. Before you start you need a Log Analytics workspace, go and create that.&lt;/p&gt;
&lt;h3&gt;Create Log Analytics workspace&lt;/h3&gt;
&lt;p&gt;This is how you access or visualise the FW logs, if you're using the eval/free subscription like my screenshots you'll need to select &lt;em&gt;pay-as-you-go&lt;/em&gt; pricing, I've not been charged anything 😬&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-05-CreateLAW1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Log Workspace Settings" src="/files/2020/08/AZEGFW-05-CreateLAW1.png" title="Log Workspace Settings"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Setup Diagnostics&lt;/h4&gt;
&lt;p&gt;Back on the Firewall, if it's done, setup logging, it's under Diagnostics Settings.... &lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-06-FWDiag1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Diag Settings" src="/files/2020/08/AZEGFW-06-FWDiag1.png" title="FW Diag Settings"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add a new Diagnostics Setting.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-06-FWDiag2.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Diag Settings2 " src="/files/2020/08/AZEGFW-06-FWDiag2.png" title="FW Diag Settings 2"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Tick all the lefthand boxes, we want all them logs! On the right, setup Log Analytics to the workspace you created. At this point, don't expect to see anything under the FW logs section, not only do we not have any traffic yet but it can take ~10mins before any hits appear in the logs.&lt;/p&gt;
&lt;h3&gt;Create some Rules&lt;/h3&gt;
&lt;p&gt;We're ready at this point to create some rules, we're only going to work with &lt;em&gt;Add network rule collection&lt;/em&gt; rules.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-07-Rules1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Rules 1 " src="/files/2020/08/AZEGFW-07-Rules1.png" title="FW Rules 1"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is where we start and are aiming for, so click &lt;em&gt;add network rule collection&lt;/em&gt; and fill in these details...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name: Basic-Networking&lt;/li&gt;
&lt;li&gt;Priority: 100&lt;/li&gt;
&lt;li&gt;Action: Allow&lt;/li&gt;
&lt;li&gt;Rule 1: &lt;ul&gt;
&lt;li&gt;Name: DNS&lt;/li&gt;
&lt;li&gt;Protocol: TCP &amp;amp; UDP&lt;/li&gt;
&lt;li&gt;Source Type: IP Address&lt;/li&gt;
&lt;li&gt;Source: 172.16.0.0/12&lt;/li&gt;
&lt;li&gt;Destination Type: IP Address&lt;/li&gt;
&lt;li&gt;Destination Address: 208.67.222.222, 208.67.220.220&lt;/li&gt;
&lt;li&gt;Destination Ports:&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rule 2:&lt;ul&gt;
&lt;li&gt;Name: NTP&lt;/li&gt;
&lt;li&gt;Protocol: UDP&lt;/li&gt;
&lt;li&gt;Source Type: IP Address&lt;/li&gt;
&lt;li&gt;Source: 172.16.0.0/12&lt;/li&gt;
&lt;li&gt;Destination Type: IP Address&lt;/li&gt;
&lt;li&gt;Destination Address: *&lt;/li&gt;
&lt;li&gt;Destination Ports: 123&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-07-Rules2.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Rules 2 " src="/files/2020/08/AZEGFW-07-Rules2.png" title="FW Rules 2"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We want a nice and simple policy to test basic functionality; repeat the process for the following rules...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name: HTTP-HTTPS&lt;/li&gt;
&lt;li&gt;Priority: 1000&lt;/li&gt;
&lt;li&gt;Action: Allow&lt;/li&gt;
&lt;li&gt;Rule 1: &lt;ul&gt;
&lt;li&gt;Name: HTTP&lt;/li&gt;
&lt;li&gt;Protocol: TCP&lt;/li&gt;
&lt;li&gt;Source Type: IP Address&lt;/li&gt;
&lt;li&gt;Source: 172.16.0.0/12&lt;/li&gt;
&lt;li&gt;Destination Type: IP Address&lt;/li&gt;
&lt;li&gt;Destination Address: *&lt;/li&gt;
&lt;li&gt;Destination Ports: 80&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rule 2:&lt;ul&gt;
&lt;li&gt;Name: HTTPS&lt;/li&gt;
&lt;li&gt;Protocol: TCP&lt;/li&gt;
&lt;li&gt;Source Type: IP Address&lt;/li&gt;
&lt;li&gt;Source: 172.16.0.0/12&lt;/li&gt;
&lt;li&gt;Destination Type: IP Address&lt;/li&gt;
&lt;li&gt;Destination Address: *&lt;/li&gt;
&lt;li&gt;Destination Ports: 443&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name: Default-Deny&lt;/li&gt;
&lt;li&gt;Priority: 65000&lt;/li&gt;
&lt;li&gt;Action: Deny&lt;/li&gt;
&lt;li&gt;Rule 1: &lt;ul&gt;
&lt;li&gt;Name: Deny&lt;/li&gt;
&lt;li&gt;Protocol: Any&lt;/li&gt;
&lt;li&gt;Source Type: IP Address&lt;/li&gt;
&lt;li&gt;Source: *&lt;/li&gt;
&lt;li&gt;Destination Type: IP Address&lt;/li&gt;
&lt;li&gt;Destination Address: *&lt;/li&gt;
&lt;li&gt;Destination Ports: *&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should end up with something like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-07-Rules3.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Rules 3 " src="/files/2020/08/AZEGFW-07-Rules3.png" title="FW Rules 3"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Azure &amp;amp; ICMP&lt;/h4&gt;
&lt;p&gt;Ok, a bit of an Azure quirk here! There's a few google hits of people complaining that you cannot "ping out" from Azure to the Internet, but if you want to be able to ping between spokes you can do that... weirdly tho, restricting the rule by IP/Subnet doesn't work, you have to setup an "any" rule 😒&lt;/p&gt;
&lt;p&gt;If you want one, create a rule using these settings...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name: ICMP&lt;/li&gt;
&lt;li&gt;Priority: 101&lt;/li&gt;
&lt;li&gt;Action: Allow&lt;/li&gt;
&lt;li&gt;Rule 1: &lt;ul&gt;
&lt;li&gt;Name: ICMP&lt;/li&gt;
&lt;li&gt;Protocol: Any&lt;/li&gt;
&lt;li&gt;Source Type: IP Address&lt;/li&gt;
&lt;li&gt;Source: *&lt;/li&gt;
&lt;li&gt;Destination Type: IP Address&lt;/li&gt;
&lt;li&gt;Destination Address: *&lt;/li&gt;
&lt;li&gt;Destination Ports: *&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Step 3 Peering&lt;/h2&gt;
&lt;p&gt;Now we're onto some good stuff! You have 3x Virtual networks, and they're isolated from each other, our target is to route these via our firewall, we do this by setting up peering. We need two peering configs:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Peering on UKS-FW-vNET1 to UKS-vNET-Spoke1&lt;/li&gt;
&lt;li&gt;Peering on UKS-FW-vNET1 to UKS-vNET-Spoke2&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In new versions of the GUI (&lt;em&gt;you'll not some differences between what you see and the official documentation&lt;/em&gt;) this will create Peering back the other way, I guess this had to be done manually before!&lt;/p&gt;
&lt;p&gt;Navigate to the vNET: &lt;code&gt;UKS-FW-vNET1&lt;/code&gt; and click &lt;em&gt;Add Peering&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-08-AddPeering1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="vNET Peering!" src="/files/2020/08/AZEGFW-08-AddPeering1.png" title="Peering"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Take note of the bottom &lt;strong&gt;Enabled&lt;/strong&gt; if that's not on, then Spoke 2 won't be able to speak to Spoke 1. If your vNET has an onward connect to a VPN gateway then you'll need to tick the bottom box.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Repeat for Spoke2.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;Step 4 Create Some Routes&lt;/h2&gt;
&lt;p&gt;We need 2x routes, I reckon we could probably get away with bundling it together as one, but this feels cleaner and I know it works! 😝&lt;/p&gt;
&lt;p&gt;The plan is to setup a default route for UKS-Spoke1-Subnet1/2 to the Firewall, we don't need static routes back the other way, that's sorted by the peering, these static routes give us Internet access and Spoke-to-Spoke connectivity.&lt;/p&gt;
&lt;p&gt;Create a new Route Table: UKS-Route-Spoke1-to-Hub&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-09-CreateRouteTable1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Create Route Table" src="/files/2020/08/AZEGFW-09-CreateRouteTable1.png" title="Routing"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For the next step, you need to pop back to the firewall and grab the private IP... in my example it's &lt;code&gt;172.16.0.4&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-09-CreateRouteTable2-FWIP.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="FW Private IP" src="/files/2020/08/AZEGFW-09-CreateRouteTable2-FWIP.png" title="FW Private IP"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;No go to the Route Table and add a default route, the gateway IP is going to the the private IP you just copied from the FW.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-09-CreateRouteTable3.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Add Default Route" src="/files/2020/08/AZEGFW-09-CreateRouteTable3.png" title="DF RT"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then under Subnets, associate the Spoke1 Subnet.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-09-CreateRouteTable4.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Associate Subnets" src="/files/2020/08/AZEGFW-09-CreateRouteTable4.png" title="Associate Subnets"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All that done, now &lt;strong&gt;Repeat for UKS-Route-Spoke2-to-Hub!&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;Step 5 Add some machines&lt;/h2&gt;
&lt;p&gt;Foundations laid, we have something to stand a computer on lets build a couple of test machines. We'll use a windows server as a GUI client and a linux box as a server.&lt;/p&gt;
&lt;h3&gt;Windows - Spoke 1&lt;/h3&gt;
&lt;p&gt;Build a basic Windows 2019 Server...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-10-CreateVM1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Build a VM" src="/files/2020/08/AZEGFW-10-CreateVM1.png" title="Build a VM"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Default Disk Settings is fine, but Networking settings are important, assign the server to Spoke1, Subnet1 and &lt;strong&gt;disable public IPS&lt;/strong&gt; ...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-10-CreateVM2.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="VM Networking" src="/files/2020/08/AZEGFW-10-CreateVM2.png" title="VM Networking"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Default settings for Management and advanced also fine.&lt;/p&gt;
&lt;h3&gt;Linux - Spoke 2&lt;/h3&gt;
&lt;p&gt;Build a Linux Server, pick whatever distro makes you happy; you can build a 2nd windows box if you like, but you'll have to install IIS afterwards for some sensible testing.&lt;/p&gt;
&lt;p&gt;We're basically repeating the steps from above, the networking tab is the detail to pay attention to...&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-11-CreateVM1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Build another VM" src="/files/2020/08/AZEGFW-11-CreateVM1.png" title="Build another VM"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Step 6 - Bastions, get access to the machines.&lt;/h2&gt;
&lt;p&gt;As those servers build/deploy you'll be thinking, how am I going to access them?! Well, remember we left some space in the Subnets/vNETs, we'll use &lt;a href="https://docs.microsoft.com/en-gb/azure/bastion/bastion-overview"&gt;Microsoft's Bastion solution&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Go to your VM, scroll to the bottom and select &lt;em&gt;Bastion&lt;/em&gt;, you'll notice there's a red error!&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-12-Bastion1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Bastions!" src="/files/2020/08/AZEGFW-12-Bastion1.png" title="Bastions!"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Click on &lt;em&gt;Manage Subnet Configuration&lt;/em&gt; ... you need to create a subnet called &lt;code&gt;AzureBastionSubnet&lt;/code&gt; ← That's a special/reserved name. Bastion's only need a small &lt;code&gt;/27&lt;/code&gt; subnet.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-12-Bastion2.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="AzureBastionSubnet" src="/files/2020/08/AZEGFW-12-Bastion2.png" title="AzureBastionSubnet"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once the subnet has been created you can then click the create button with no errors. Repeat for Spoke 2.&lt;/p&gt;
&lt;h2&gt;Test&lt;/h2&gt;
&lt;p&gt;Finally! After all that setup, we're ready to log into a server. Connect to your linux box first (&lt;em&gt;Using the Bastion Option&lt;/em&gt;), install apache &amp;amp; start it.&lt;/p&gt;
&lt;p&gt;Now connect to your Windows box:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;open Internet Explorer you should be able to browse the web. &lt;a href="https://knowledge.autodesk.com/search-result/caas/sfdcarticles/sfdcarticles/Disable-IE-Enhanced-Security-on-Windows-Server.html"&gt;Disable Enhanced Security&lt;/a&gt; if you want/need to! (Note: That's why I'm using Umbrella as a compensating control)&lt;/li&gt;
&lt;li&gt;Now connect to your linux box, that should work to&lt;/li&gt;
&lt;li&gt;Open a Command Prompt, if you created an ICMP rule, ping should work. If you are pining from the linux box, remember windows servers come with host based firewalls, you'll need a rule there to allow ICMP as well.&lt;/li&gt;
&lt;li&gt;Finally, download putty and try to SSH to your linux box, that should fail!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;(&lt;em&gt;No Screenshots here, I'm sure you can figure that out&lt;/em&gt; 😅)&lt;/p&gt;
&lt;h3&gt;Check the firewall logs!&lt;/h3&gt;
&lt;p&gt;If all your tests went as designed, you'll need to filter the firewall logs to see them as any Internet traffic will be filling up the logs.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2020/08/AZEGFW-13-FW-Logs1.png"&gt;&lt;img style="display: block;margin-left: auto;margin-right: auto;max-width: 90%;" alt="Internal FW Traffic" src="/files/2020/08/AZEGFW-13-FW-Logs1.png" title="FW Logs!"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;END&lt;/h2&gt;
&lt;p&gt;I hope this is useful to someone, it took me a little while and &lt;a href="https://twitter.com/linickx/status/1294934305014153216"&gt;some twitter frustration&lt;/a&gt; to get there, but I'm pleased with the result! If I can find the time, I'd like to re-create this in powershell and automate all the things!&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://docs.microsoft.com/en-us/azure/firewall/overview&lt;/li&gt;
&lt;li&gt;https://docs.microsoft.com/en-us/azure/firewall-manager/secure-hybrid-network&lt;/li&gt;
&lt;li&gt;https://docs.microsoft.com/en-us/azure/firewall/logs-and-metrics&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Wed, 19 Aug 2020 11:49:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2020-08-19:example-hub--spoke-azure-firewall</guid><category>Security</category><category>Azure</category><category>Firewall</category></item><item><title>Is your firewall Team from Venus?</title><link>https://www.linickx.com/is-your-firewall-team-from-venus</link><description>&lt;p&gt;Something a little different for my site; this post is a soft-skill article. In job listing, or development plans its really common for &lt;em&gt;Technical&lt;/em&gt; roles to include a soft skills component and I had kinda assumed it was &lt;em&gt;filler content&lt;/em&gt;, how hard is it to talk to people?! A couple of years ago I moved from Consultancy into an Internal Operational role, and now, ok I get it, it's that old saying &lt;em&gt;Men from Mars, Women from Venus&lt;/em&gt; but with like 7 Layers of OSI complication!&lt;/p&gt;
&lt;p&gt;I have something like 15years experience working with firewalls in large enterprise, it's a tricky topic, if you cannot communicate your requirements to the firewall team the chances are you application/solutions/service just isn't going to work, after all as &lt;a href="http://blog.dilbert.com"&gt;Scott Adams&lt;/a&gt; has portrayed in &lt;a href="http://dilbert.com"&gt;Dilbert&lt;/a&gt;, everyone blames the firewall.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://dilbert.com/strip/2013-04-07"&gt;&lt;img alt="Blame the Firewall" src="/files/2020/02/fwblame.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Firewalls are everywhere, and even though the security industry likes to argue that they are becoming less and less effective I'm confident they're not going away any time soon, so here are my tips:&lt;/p&gt;
&lt;h2&gt;1. Do not forward (&lt;em&gt;copy/paste&lt;/em&gt;) vendor documentation&lt;/h2&gt;
&lt;p&gt;If I had a &lt;code&gt;£$&lt;/code&gt; for every time I get forwarded &lt;a href="https://support.microsoft.com/en-gb/kb/832017"&gt;this Microsoft document&lt;/a&gt; I'd be a millionaire, forwarding the documentation verbatim is the quickest way to get yourself at the bottom of someones's todo list or land you in the SLA trap where the minimum gets done on your ticket to keep the timer green.&lt;/p&gt;
&lt;p&gt;Communication requires consideration, throwing a document you haven't read at another team is showing you don't value their time/effort&lt;/p&gt;
&lt;p&gt;Remember:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Everyone is busy! The simplest and most complete requests will be implemented quickest, all operations teams have this issue, it is &lt;strong&gt;not&lt;/strong&gt; unique to firewalls.&lt;/li&gt;
&lt;li&gt;The firewall team do not know anything about your application/solution/service, but are accountable for the security; help them to help you, reduce friction by having information up front.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;You&lt;/em&gt; are making the request for &lt;em&gt;Your Application&lt;/em&gt;, &lt;em&gt;You&lt;/em&gt; should take the time to &lt;em&gt;read and understand the documentation&lt;/em&gt; so that you can present the firewall change accurately and make it is simple as possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. Presentation &lt;em&gt;is&lt;/em&gt; everything&lt;/h2&gt;
&lt;p&gt;Always format your communication for your audience, powerpoint for Execs, spreadsheets for finance, for firewalls it's tables.&lt;/p&gt;
&lt;p&gt;Large organisation will/probably/maybe have a template to follow for change requests, don't deviate from that, seriously if your firewall team has a template use it! Arguing yours is better is futile, firewalls form part of a compliance chain, auditors tick boxes your rockstar form won't tick the box; if you think you can improve the process or add value, speak to the Security Officer.&lt;/p&gt;
&lt;p&gt;Formal documentation such as High Level (HLD) or Low Level Designs (LLD) might be a bit more fluid, here are some hints to make it easy to read and understood. &lt;/p&gt;
&lt;p&gt;Arrows like &lt;code&gt;-&amp;gt;&lt;/code&gt; should not be used in formal documentation, unless in a flow diagram, don't do it, from my experience I know it leads to mistakes. Something like &lt;code&gt;10.1.1.1 -&amp;gt; 192.168.1.1 on port 22&lt;/code&gt; is fine for an email or instant message but &lt;em&gt;for documentation use a table&lt;/em&gt; (or spreadsheet):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Source Name | Source IP    | Destination Name | Destination IP | Service Name | Protocol | Port | Comment
------------|--------------|------------------|----------------|--------------|----------|------|---------
VLAN11      | 10.10.0.0/24 | WebServer01      | 192.168.168.1  | HTTPS        | TCP      | 443  | Intranet
AdminPC     | 10.1.0.1     | WebServer01      | 192.168.168.1  | SSH          | TCP      | 22   | Admin Access
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use the above table format, give IP addresses names (&lt;em&gt;use the FQDN if possible&lt;/em&gt;), the FW team will instantly recognise what needs to be done; a table like this is both simple to read and complete and will put you top of anyone's todo list.&lt;/p&gt;
&lt;p&gt;If you have a large design document, I recommend the firewall table (&lt;em&gt;communications matrix&lt;/em&gt;) being a summary/appendix of all the required flows as picking rules from disparate sections will only lead to tears.&lt;/p&gt;
&lt;h2&gt;3. Direction, know which way to go&lt;/h2&gt;
&lt;p&gt;On a firewall direction is really, &lt;em&gt;really&lt;/em&gt; important. Your communication needs to demonstrate you know which way traffic is going and what your expectations are of the firewall.&lt;/p&gt;
&lt;p&gt;Firewalls process traffic as it arrives, from a source IP to a destination IP. Your request needs to show which IP addresses are the client (&lt;em&gt;source&lt;/em&gt;) and which IP address are the server (&lt;em&gt;destination&lt;/em&gt;)... &lt;em&gt;DO NOT&lt;/em&gt; bung in both directions to be "safe" when you don't need it, it just shows that you don't know what you are requesting, it's a common red flag for rule approvers/implementer.&lt;/p&gt;
&lt;p&gt;For example, A laptop accessing a web site on HTTPS, needs &lt;code&gt;TCP/443&lt;/code&gt; to the server (&lt;em&gt;web site&lt;/em&gt;) only. You do not need &lt;code&gt;TCP/443&lt;/code&gt; from the server (&lt;em&gt;web site&lt;/em&gt;) to the client (&lt;em&gt;laptop&lt;/em&gt;). Take time when digesting the vendor documentation to understand the direction of traffic flow. &lt;/p&gt;
&lt;p&gt;Modern Firewall are smart when it comes to TCP and common applications; unless your traffic is media (&lt;em&gt;voice/video&lt;/em&gt;) you typically don't need to worry about the random high port source, focus your effort on the destination port, get the direction right and your app will work.&lt;/p&gt;
&lt;p&gt;(Media traffic is the devil, ask the firewall team for their recommendations prior to submitting your request)&lt;/p&gt;
&lt;h2&gt;4. Choose Secure&lt;/h2&gt;
&lt;p&gt;Most vendor documentation includes protocol choices, HTTP vs HTTPS for example. As the Firewall Team are responsible/accountable for security, you'll make friends with the security teams if you pick the secure protocol, forming strong relationships with other teams is a valuable skill. &lt;/p&gt;
&lt;p&gt;If you are unclear, secure in this instance is encrypted. So:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTPS (&lt;em&gt;not HTTP&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;SSH (&lt;em&gt;not Telnet&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;FTPs (&lt;em&gt;FTP with SSL is better than plain old FTP&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;LDAPS (&lt;em&gt;LDAP with SSL is better than plain old LDAP&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;etc, etc.. if in doubt pick "&lt;em&gt;s&lt;/em&gt;" &lt;code&gt;;-)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks to the dangers of Privacy/GDPR most organisations are moving to a &lt;em&gt;Secure by Design&lt;/em&gt; motto, the firewall team are tasked to help enforce that.&lt;/p&gt;
&lt;h2&gt;5. Firewalls are everywhere&lt;/h2&gt;
&lt;p&gt;In a large enterprise there is going to be more than one firewall. Some organisations will add a column to their request tables to record which flow (&lt;em&gt;rule&lt;/em&gt;) belongs to which firewall others will want a table per firewall.&lt;/p&gt;
&lt;p&gt;If your environment is large/complicated, typically you'll find different firewalls for &lt;em&gt;management&lt;/em&gt;, production traffic or testing. Keep the communication flowing with the firewall team to find out what you need to know/do before submitting a 100 rules, it'll save you all time!&lt;/p&gt;
&lt;h2&gt;Some firewall language&lt;/h2&gt;
&lt;p&gt;To finish, here is some further firewall language to help you on your way:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Security Policy&lt;/code&gt; - A document that tells the firewall guy what he can and cannot allow through the firewall&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Firewall Policy&lt;/code&gt; - The complete set of rules implemented on a single firewall&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Firewall Rule&lt;/code&gt; - A line in the FW policy that contains, source, destination, service. The exact content of the line may vary by vendor.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Flow&lt;/code&gt; - Firewall Flow / Network Flow / Traffic flow. All used interchangeably, it means the path taken from the source to the destination, a flow might touch one or many firewalls&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Communications Matrix&lt;/code&gt; - All of the rules required for an application or service that need to be implemented into an existing firewall policy &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;/End&lt;/h2&gt;
&lt;p&gt;Hopefully this is of help to someone, comments via twitter are welcomed; would you like to see more of this kind of thing?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Sun, 02 Feb 2020 20:26:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2020-02-02:is-your-firewall-team-from-venus</guid><category>Security</category><category>Firewall</category><category>blog</category></item><item><title>Multi-Context HTTPS backups of Cisco ASA Script</title><link>https://www.linickx.com/multi-context-https-backups-of-cisco-asa-script</link><description>&lt;p&gt;If you look in the Cisco forums for scripts to backup ASAs you'll find various SSH / Expect , complicated examples... not sure why since &lt;a href="https://www.linickx.com/https-backups-of-cisco-asa"&gt;in 2006 I showed it can be done with a single wget command&lt;/a&gt; ;-)&lt;/p&gt;
&lt;p&gt;Recently I needed something that would support Multi-Context firewalls, so I pimped my one line command into the &lt;a href="#below"&gt;below&lt;/a&gt; shell script.&lt;/p&gt;
&lt;p&gt;Copy/paste into a new file as &lt;code&gt;backup_cisco_asa.sh&lt;/code&gt; then &lt;code&gt;chmod 700&lt;/code&gt; the file as necessary. &lt;/p&gt;
&lt;p&gt;Run the file with no options &lt;code&gt;./backup_cisco_asa.sh&lt;/code&gt; and it'll ask you for IP address, username and password to make the connection.&lt;/p&gt;
&lt;p&gt;For this to work the ASA needs appropriate HTTP statements (&lt;em&gt;i.e. allow ASDM access from where you are running the script&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;The file supports in-line backup of a single device such as &lt;code&gt;./backup_cisco_asa.sh 10.10.10.10&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Multi-context support is via an environment variable or a config file &lt;code&gt;~/.asa_config&lt;/code&gt;. You must set an array containing entries for each context you want to backup. e.g.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ASA_CONTEXTS=( 
 &amp;quot;172.31.9.10:system&amp;quot;
 &amp;quot;172.31.9.10:admin&amp;quot;
 &amp;quot;172.31.9.10:Edge&amp;quot;
 &amp;quot;172.31.2.254:system&amp;quot;
 &amp;quot;172.31.2.254:admin&amp;quot;
 &amp;quot;172.31.2.254:Core&amp;quot; )
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you're feeling &lt;em&gt;insecure&lt;/em&gt; you can also save your username/password variables into the &lt;code&gt;~/.asa_config&lt;/code&gt; as &lt;code&gt;ASA_UID&lt;/code&gt; and &lt;code&gt;ASA_PW&lt;/code&gt; respectively (&lt;em&gt;or as environment variables&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;Given that the script is a bash shell script I assume that SCP isn't required (&lt;em&gt;because you are probably already on your linux SSH/SCP server running the script&lt;/em&gt;) but to keep the &lt;em&gt;router team&lt;/em&gt; happy you might need to copy the files up via TFTP, this can be set with the &lt;code&gt;ASA_TFTP_IP&lt;/code&gt; variable in &lt;code&gt;~/.asa_config&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;By default the backup files will be saved to &lt;code&gt;./&lt;/code&gt; (&lt;em&gt;i.e. where ever you run the script from&lt;/em&gt;) and you can change that with the &lt;code&gt;ASA_FILEPATH&lt;/code&gt; variable.&lt;/p&gt;
&lt;p&gt;&lt;a name="below"&gt; &lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;backup_cisco_asa.sh&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash

# Nick Bettison - LINICKX.com - 2015 - v1
# Bash Shell Scipt for backing up Cisco ASA's via HTTPS (i.e. ASDM)
# 
# Read the file comments, you can setup a config file ~/.asa_config to store variables.
# ASA_UID &amp;amp; ASA_PW for credentials (if you're feeling insecure)
# ASA_CONTEXTS for multi-context support
# and ASA_TFTP_IP for copying the files via TFTP (for insecure router boys)
#
# Tested on.
# Cisco Adaptive Security Appliance Software Version 9.2(3)4 &amp;lt;context&amp;gt;
# Device Manager Version 7.4(2)

# Timestamp for file names
TIMESTAMP=`date &amp;quot;+%Y%m%d-%H%M%S&amp;quot;`

# Allow single ASA IP address to be passed from CLI
# e.g ./backup_cisco_asa.sh 10.10.10.10
if [ -n &amp;quot;$1&amp;quot; ]
    then
    ASA_IP=&amp;quot;$1&amp;quot;
fi

# Check for Curl
type curl &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || { echo &amp;gt;&amp;amp;2 &amp;quot;I require curl but it's not installed.  Aborting.&amp;quot;; exit 1; }

# Read Variables from a config file (if it exits)
# The config file can be used for storing multi-context configurations... and for the insecure username/password ;-)
if [ -e ~/.asa_config ]
then
  . ~/.asa_config
fi

# Default File Path
if [ -z &amp;quot;$ASA_FILEPATH&amp;quot; ]
    then
    ASA_FILEPATH=&amp;quot;./&amp;quot;
fi

# Check for UID/PW Variables - Ask if not found
if [ -z &amp;quot;$ASA_UID&amp;quot; ]
        then
        read -p &amp;quot;ASA Username:&amp;quot; ASA_UID
fi
if [ -z &amp;quot;$ASA_PW&amp;quot; ]
        then
        read -s -p &amp;quot;ASA Password:&amp;quot; ASA_PW
        echo
fi

# Check to see if single or multi-context mode.
if [ -z &amp;quot;$ASA_CONTEXTS&amp;quot; ]
        then
        if [ -z &amp;quot;$ASA_IP&amp;quot; ]
                then
                read -p &amp;quot;ASA IP Address:&amp;quot; ASA_IP
        fi

        ASA_tFILE=&amp;quot;$ASA_FILEPATH.$TIMESTAMP.asaconfig.txt&amp;quot;

        # Download the &amp;quot;show run&amp;quot; via the unofficial CLI.
        curl -s -k -o $ASA_tFILE -u $ASA_UID:$ASA_PW &amp;quot;https://$ASA_IP/admin/exec/show%20running-config%20asdm/show%20running-config&amp;quot;

        if [ -e $ASA_tFILE ]
            then
            # Look for hostname in config file
            ASA_HOSTNAME=`grep ^hostname $ASA_tFILE | awk '{print $2}'`
            # rename the temp file to something sensible.
            mv $ASA_tFILE &amp;quot;$ASA_FILEPATH$TIMESTAMP.$ASA_HOSTNAME.txt&amp;quot;
            # Setup an array for TFTP later.
            ASA_FILES=(&amp;quot;${ASA_FILES[@]}&amp;quot; &amp;quot;$ASA_FILEPATH$TIMESTAMP.$ASA_HOSTNAME.txt&amp;quot;)
            # Done.
            echo &amp;quot;DONE: $ASA_FILEPATH$TIMESTAMP.$ASA_HOSTNAME.txt&amp;quot;
        else
            echo &amp;quot;FAILED: $ASA_IP&amp;quot;
            exit 1
        fi
else
    # Example ASA_CONTEXTS array:
    # 172.31.9.10 is the admin context IP, admin &amp;amp; Edge are the names of the two contexts to backup.
    # 172.31.2.254 is the admin context IP, admin &amp;amp; Core are the names of the two contexts to backup.
    # &amp;quot;system is obviously the system context&amp;quot;
    # ASA_CONTEXTS=( 
    #     &amp;quot;172.31.9.10:system&amp;quot;
    #     &amp;quot;172.31.9.10:admin&amp;quot;
    #     &amp;quot;172.31.9.10:Edge&amp;quot;
    #     &amp;quot;172.31.2.254:system&amp;quot;
    #     &amp;quot;172.31.2.254:admin&amp;quot;
    #     &amp;quot;172.31.2.254:Core&amp;quot; )

    # Loop through the array
    for firewall in ${ASA_CONTEXTS[@]} ; do
         ASA_IP=${firewall%%:*}
         ASA_CONTEXT=${firewall##*:}

         # Feedback on progress
         printf &amp;quot;Connecting to %s for %s \n&amp;quot; $ASA_IP $ASA_CONTEXT
         # Filename
         ASA_FILE=&amp;quot;$ASA_FILEPATH$TIMESTAMP.$ASA_IP.$ASA_CONTEXT.txt&amp;quot;

         # Download the CONTEXT &amp;quot;show run&amp;quot; via the unofficial API.
         curl -s -k -o $ASA_FILE -u $ASA_UID:$ASA_PW &amp;quot;https://$ASA_IP/admin/exec/changeto%20context%20$ASA_CONTEXT/show%20running-config/show%20running-config%20asdm&amp;quot;

         if [ -e $ASA_FILE ]
             then
             # Setup an array for TFTP later.
             ASA_FILES=(&amp;quot;${ASA_FILES[@]}&amp;quot; &amp;quot;$ASA_FILE&amp;quot;)
             # Done!
             echo &amp;quot;DONE: $ASA_FILE&amp;quot;
         else
             echo &amp;quot;FAILED: $ASA_IP&amp;quot;
         fi
     done
fi

# Optional Backup to insecure tftp - you know, to keep the router boys happy!
if [ -n &amp;quot;$ASA_TFTP_IP&amp;quot; ]
    then
    # Check for TFTP binary
    type tftp &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || { echo &amp;gt;&amp;amp;2 &amp;quot;tftp client not installed.  Aborting.&amp;quot;; exit 1; }
    type wc &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || { echo &amp;gt;&amp;amp;2 &amp;quot;wc not installed (needed for counting stuff).  Aborting.&amp;quot;; exit 1; }
    type awk &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || { echo &amp;gt;&amp;amp;2 &amp;quot;awk not installed.... seriously?!?!  Aborting.&amp;quot;; exit 1; }

    # Loop through array
    for file in ${ASA_FILES[@]} ; do
        LOCAL_FILE=$file
        # backup separator
        OIFS=$IFS
        # Change separator to /
        IFS='/'
        # Split the filename from the path
        AWK_POSITION=`echo $file | wc -w`
        REMOTE_FILE=`echo $file | awk -v w=$AWK_POSITION '{print $w}'`
        # restore separator
        IFS=$OIFS
        # TFTP the file.
        tftp -v $ASA_TFTP_IP -c put $LOCAL_FILE $REMOTE_FILE
    done
fi
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Tue, 28 Jul 2015 16:04:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2015-07-28:multi-context-https-backups-of-cisco-asa-script</guid><category>Cisco</category><category>Security</category><category>ASA</category><category>Firewall</category></item><item><title>Cisco ASA SYSLOG config for Tufin SecureTrack</title><link>https://www.linickx.com/cisco-asa-syslog-config-for-tufin-securetrack</link><description>&lt;p&gt;I'm sure there's a very good reason that the Tufin Secure Track User
Guide (R14-1) has 8 pages of screenshots instead of including these 10
lines of config; I just don't yet know what the reason is :)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;logging enable
logging timestamp
logging facility 23
logging message 111008 level  notifications
logging device-id  hostname 
logging list securetrack message 111008
logging list securetrack message 106100
logging list securetrack message 106023
logging trap securetrack
logging host inside 1.2.3.4
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Replace 1.2.3.4 with the IP address of your ST server.&lt;/em&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Mon, 02 Jun 2014 17:27:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2014-06-02:cisco-asa-syslog-config-for-tufin-securetrack</guid><category>asa</category><category>Cisco</category><category>firewall</category><category>SecureTrack</category><category>Tufin</category></item><item><title>CheckPoint: "Encryption Failure: according to the policy the packet should not have been decrypted."</title><link>https://www.linickx.com/checkpoint-encryption-failure-according-to-the-policy-the-packet-should-not-have-been-decrypted</link><description>&lt;p&gt;The &lt;a href="https://supportcenter.checkpoint.com/supportcenter/LoginRedirect.jsp?toURL=eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk21571%20"&gt;checkpoint sk
article&lt;/a&gt;
isn't that helpful... what it should say is... If you have your
encryption domain set as "&lt;em&gt;defined by topology&lt;/em&gt;", then check your
topology!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Mon, 19 Nov 2012 15:59:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2012-11-19:checkpoint-encryption-failure-according-to-the-policy-the-packet-should-not-have-been-decrypted</guid><category>checkpoint</category><category>firewall</category><category>Security</category><category>vpn</category></item><item><title>password-less ssh login to JunOS</title><link>https://www.linickx.com/password-less-ssh-login-to-junos</link><description>&lt;p&gt;&lt;a href="https://www.linickx.com/files/2012/01/junos_login.png"&gt;&lt;img alt="" src="https://www.linickx.com/files/2012/01/junos_login.png" title="junos_login" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Juniper (JunOS) SRX's support ssh public key authentication.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nick&amp;gt; show configuration system login | display set 
set system login user nick uid 2001
set system login user nick class super-user
set system login user nick authentication ssh-rsa "PASTE_KEY"
nick&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No-one likes to type passwords!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Tue, 17 Jan 2012 13:35:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2012-01-17:password-less-ssh-login-to-junos</guid><category>firewall</category><category>id_rsa</category><category>Juniper</category><category>JunOS</category><category>Security</category><category>ssh</category></item><item><title>Cisco ASA Firewalls and IP Ranges in ACLS</title><link>https://www.linickx.com/cisco-asa-firewalls-and-ip-ranges-in-acls</link><description>&lt;p&gt;I've google'd and I cannot find a way of creating a firewall range style
object in an ASA, you know the kind of thing whereby you want to allow
IP addresses 192.168.1.10 thru 192.168.1.20 in an ACL.&lt;/p&gt;
&lt;p&gt;In my frustration I have given up and created a shell script which
converts a CSV into an ASA output, simply create a two column CSV with
Col A containing your starting IP and Col B containing you end IP.&lt;/p&gt;
&lt;p&gt;The script is a recursive loop so should support large outputs such as
10.1.2.10 to 10.2.1.20 howvere I'm not actually sure you'd want that in
your firewall config but I wrote the computability for the fun it!&lt;/p&gt;
&lt;p&gt;Have fun, click "more" below if you can't see the script!&lt;/p&gt;
&lt;!--more--&gt;

&lt;pre&gt;&lt;code&gt;#!/bin.bash

# Commas separated VAR....
IFS=","
while read name firstip lastip
# Loop around CSV
do

# Split up our first ip into it's octects
firstipfirstoctect=$(echo $firstip | awk -F "." '{print $1}')
firstipsecondoctect=$(echo $firstip | awk -F "." '{print $2}')
firstipthirdoctect=$(echo $firstip | awk -F "." '{print $3}')
firstipforthoctect=$(echo $firstip | awk -F "." '{print $4}')

# Split up our last IP into it's ocects
lastipfirstoctect=$(echo $lastip | awk -F "." '{print $1}')
lastipsecondoctect=$(echo $lastip | awk -F "." '{print $2}')
lastipthirdoctect=$(echo $lastip | awk -F "." '{print $3}')
lastipforthoctect=$(echo $lastip | awk -F "." '{print $4}')

    # Re-set BASH
    unset IFS

    # Echo out the object GROUP name
    echo "object-group network $name"

    # Loop through 1st Octect
    for a in `seq $firstipfirstoctect $lastipfirstoctect`;
    do
        # test to see if we need to print the whole range
        if [ $firstipfirstoctect -lt $lastipfirstoctect ]
        then
            firstipsecondoctectCOUNTER="0"
            lastipsecondoctectCOUNTER="255"
        fi

        # first IP might not be 1
        if [ $a -eq $firstipfirstoctect ]
        then
            firstipsecondoctectCOUNTER=$firstipsecondoctect
        fi

        # last IP might not be 255
        if [ $a -eq $lastipfirstoctect ]
        then
            lastipsecondoctectCOUNTER=$lastipsecondoctect
        fi

            # Loop through 2nd Octect
            for b in `seq $firstipsecondoctect $lastipsecondoctect`;
            do

                # Same tests as before except, next octect.
                if [ $firstipsecondoctect -lt $lastipsecondoctect ]
                then
                    firstipthirdoctectCOUNTER="0"
                    lastipthirdoctectCOUNTER="255"
                fi

                if [ $b -eq $firstipsecondoctect ]
                then
                    firstipthirdoctectCOUNTER=$firstipthirdoctect
                fi

                if [ $b -eq $lastipsecondoctect ]
                then
                    lastipthirdoctectCOUNTER=$lastipthirdoctect
                fi

                    # Loop through 3rd Octect
                    for c in `seq $firstipthirdoctectCOUNTER $lastipthirdoctectCOUNTER`;
                    do

                        # copy / paste / tweak
                        if [ $firstipthirdoctect -lt $lastipthirdoctect ]
                        then
                            firstipforthoctectCOUNTER="0"
                            lastipforthoctectCOUNTER="255"
                        fi

                        if [ $c -eq $firstipthirdoctect ]
                        then
                            firstipforthoctectCOUNTER=$firstipforthoctect
                        fi

                        if [ $c -eq $lastipthirdoctect ]
                        then
                            lastipforthoctectCOUNTER=$lastipforthoctect
                        fi

                            # final octect... echo result.
                            for d in `seq $firstipforthoctectCOUNTER $lastipforthoctectCOUNTER`;
                            do
                                echo " network-object $a.$b.$c.$d  255.255.255.255"
                            done

                    done
            done
    done

done&amp;lt;./FirewallRanges.csv
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Fri, 29 Jul 2011 15:05:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-07-29:cisco-asa-firewalls-and-ip-ranges-in-acls</guid><category>asa</category><category>bash</category><category>Cisco</category><category>firewall</category><category>script</category><category>Security</category></item><item><title>Cisco ASA - First steps to a Check Point Style Policy</title><link>https://www.linickx.com/cisco-asa-first-steps-to-a-check-point-style-policy</link><description>&lt;p&gt;I've just spotted this in the Cisco &lt;a href="http://www.cisco.com/en/US/docs/security/asa/asa83/release/notes/asarn83.html"&gt;ASA 8.3 release
notes&lt;/a&gt;...&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;You can now configure access rules that are applied globally, as well
as access rules that are applied to an interface. If the configuration
specifies both a global access policy and interface-specific access
policies, the interface-specific policies are evaluated before the
global policy.&lt;/p&gt;
&lt;p&gt;The following command was modified: access-group global&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For users/companies which have migrated from Check Point to Cisco
(&lt;em&gt;usually to save on licensing fees&lt;/em&gt;), getting their head around a new
interface level policy rather than a system (&lt;em&gt;global&lt;/em&gt;) level is usually
a bit of a challenge.&lt;/p&gt;
&lt;p&gt;I'm looking forward to seeing if this really helps with policy
migrations!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Wed, 01 Dec 2010 10:14:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2010-12-01:cisco-asa-first-steps-to-a-check-point-style-policy</guid><category>asa</category><category>Blog</category><category>Cisco</category><category>firewall</category><category>Security</category></item><item><title>Thoughts on Firewalling</title><link>https://www.linickx.com/thoughts-on-firewalling</link><description>&lt;p&gt;Firewalls will always be a key ingredient to network security, but not
all firewalls are equal. Recently I've been forced into documenting how
I decide &amp;amp; think about firewall rules...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Strict Firewalling&lt;/strong&gt;&lt;br /&gt;
IMO Strict Firewalling is the traditional way to implement your traffic
policies (&lt;em&gt;ACLS&lt;/em&gt;), each rule should be as tight as possible... the idea
of "any" should not be used at all and ranges should be kept at a
minimum; hosts better than subnets, source and destination IPs
restricted, specific TCP ports (&lt;em&gt;not ranges&lt;/em&gt;) used.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Service Led Firewalling&lt;/strong&gt;&lt;br /&gt;
A term &lt;em&gt;I think&lt;/em&gt; I made up, Service Led Fierwalling is where you relax
the ACL/policy at the source... to host a DNS Zone you need to allow
"&lt;em&gt;anyone&lt;/em&gt;" to perform lookups so Strict Firewalling cannot be applied
here but you do know the destination and the service so both of these
should be defined/restricted as appropriate... you see what I mean here
the policy is defined by the "&lt;em&gt;service&lt;/em&gt;" provided.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Open Firewalling&lt;/strong&gt;&lt;br /&gt;
Possibly a contradiction in terms but bare with me; there are some
instances whereby implementing a firewall provides little benefit, one
example I've seen was a customer's security officer wanted an internal
firewall &lt;em&gt;(i.e. no internet connection&lt;/em&gt;) in front of their Microsoft
file server, in order for AD &amp;amp; MS clients to work properly all the MS
ports had to be opened... so server guys continuously complained, what
exactly is the firewall doing? What is Open Firewalling? It's the
process of implementing a black list followed by a white list, rather
than the traditional permit then drop processing that a firewall does;
I'd create a rule that Drops Prohibited applications (&lt;em&gt;such as P2P or
unencrypted protocols&lt;/em&gt;) and then create a policy permitting all ports
from legitimate IP ranges.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;When would I use these?&lt;/strong&gt;&lt;br /&gt;
Your firewall should be broken into zones, each zone meets both
security policy and business requirements, you should then apply a
firewalling technique to each zone. For example it's not uncommon to
have a back-end database which should only ever be accessed by the front
end application, therefore it could be in a zone protected by Strict
Firewalling; public services such as websites/email servers require
flexibility on their source thus require service led firewalling.
Occasionally your business or application requirements suggest that
firewalling impedes things, using open firewalling to "clean" traffic
compromises "security people wanting firewalls" and any historical
business/application issues... the firewall is there perhaps protecting
against syn-flood attacks &amp;amp; as previously suggested blocking prohibited
apps yet the business doesn't see any traditional firewall headaches.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;I don't agree you fool!&lt;/strong&gt;&lt;br /&gt;
That's your choice, there's no correct answer to security, the business
you work in and the security policy mandated from senior management
direct what you do, these are just my approaches :-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Tue, 08 Jun 2010 07:16:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2010-06-08:thoughts-on-firewalling</guid><category>firewall</category><category>Security</category></item></channel></rss>