For some time there have been plenty of examples of backing up Palo Alto Firewalls with curl commands (extracting the files using the XML API) however that may not sit well with some Windows administrators who want to use PowerShell. As such I’ve put together the BackupPANNGFWConfig repo on GitHub which contains the scripts to get ahold of the API keys needed and then to perform the backups for a series of firewalls.
To get the scripts drop by the link below and for the configuration see the screenshot sequences in this post. You will need a basic understanding of Palo Alto Firewalls, PowerShell and Windows Server to work through these steps.
Super important note, this script is configured to use a TLS1.2 connection to the firewall as well as only allow connections to a firewall with a trusted security certificate – if you jump on the web management interface of the firewalls from the server that you are running the script from you should see the ‘secure’ padlock icon in the address bar.
In this new blog post series I’ll be looking at (normally a selection of 3) cool articles, news and other blog posts that I find interesting during the day. For this week we have PowerShell tricks, a detailed article on securing the Windows Firewall and an (old but very interesting) write up on the woes of network administrators when everything goes wrong.
PowerShell tricks: Splatting
New to me (always learning!) this trick allows you to populate the parameters for a PowerShell cmdlet in a table (makes for much neater formatting) to then pass into the cmdlet as a single object.
Endpoint Isolation with the Windows Firewall
The Windows Firewall may seem like a bit of a beast from time to time but this article makes some great points on how to build out a set of secure policies that can apply to pretty much any environment.
All systems down
A true disaster story – quite old (2003) but really worth a read to see what lessons you can take home.
Having recently changed from using PowerShell ISE to VS Code I’m still discovering all the super awesome new features of it (be sure to get a copy of the Keyboard shortcuts from this page – https://code.visualstudio.com/docs/getstarted/keybindings). To get started I’ve changed the default new file language to PowerShell (not that you can’t change it to anything else though!).
To do this follow the short guide in the screenshots adding in the line shown in the gist below.
Thanks to the organising committee of the (Oxford and Cambridge) College IT Conference 2018 held at the RAF Museum (Hendon) for the invite to talk about PowerShell and Server Core! As promised the video from the presentation is now up on YouTube; in addition the slides as PowerPoint and PDF can be seen below.
Presentation (PowerPoint) (28.5 MiB, 634 hits)
Presentation (PDF) (4.9 MiB, 600 hits)
Microsoft have published this blog post – https://cloudblogs.microsoft.com/windowsserver/2018/03/29/windows-server-semi-annual-channel-update which clarifies the difference between the Long-Term Servicing Channel (Server 2016/2019/so on) against the Semi-Annual Channel. Do have a read!
With thanks to the 50 staff from across the University for attending please see below the links to the videos and PowerPoints of the day!
Direct link to Playlist – https://www.youtube.com/watch?list=PLRxbdlgJzwyjAf820T0u4GpP0E01a9LEX&v=u-GVJ_0VuRM
Slides as PowerPoint
1 Intro (4.3 MiB, 751 hits)
2 MDT (85.2 MiB, 845 hits)
3 PowerShell (27.5 MiB, 757 hits)
4 PRTG Network Monitor (47.5 MiB, 755 hits)
5 OpenVAS (32.9 MiB, 635 hits)
6 WSUS and Chocolatey (60.3 MiB, 727 hits)
7 NPS and VLANs (10.7 MiB, 900 hits)
Slides as PDF
1 Intro (2.0 MiB, 757 hits)
2 MDT (2.2 MiB, 973 hits)
3 PowerShell (1.8 MiB, 1,278 hits)
4 PRTG Network Monitor (3.2 MiB, 843 hits)
5 OpenVAS (2.3 MiB, 827 hits)
6 WSUS and Chocolatey (2.9 MiB, 990 hits)
7 NPS and VLANs (1.4 MiB, 880 hits)
Stay tuned over the coming days for the scripts that are mentioned through the video which will be linked to from this post.
A little bit of fun today with Milestone XProtect (in our case the express version) today; with the goal of improving our documentation I wanted to somehow obtain a list of all of the hardware devices (and to some degree the cameras) including there names, MAC addresses and IP addresses from our XProtect server.
Lone behold the configuration.xml file typically stored at “C:\ProgramData\Milestone\Milestone Surveillance\configuration.xml” held just the information I wanted; a little bit of PowerShell later and I had CSVs with the information in a human readable form.
To do the same on your server follow the guide using the Export-MilestoneConfig.ps1 script show below.
Following on from the previous post (A Windows SysAdmin installs and uses OpenVAS – End to end guide – Simple Beginnings) in this post we’ll be using PowerShell, OpenVAS and the OMP (Open Management Protocol from Greenbone) to create a Target (a machine/device) to conduct some Pen Testing against, create a Task to scan the target and then generate a report.
The final step is quite possibly the most important though; it’s worth pointing out (hopefully the obvious) that you could have the most amazing Pen Testing software package on the planet but unless you then absorb the reports and take action to Mitigate/Resolve/Eliminate the risks identified it’s all just a horrible waste of CPU cycles.
A quick note – this guide is shown as only a small example of how you can get started with OpenVAS, stay tuned for more in depth guides!
In this first stage we will download the OMP client for Windows (from http://docs.greenbone.net/GSM-Manual/gos-4/en/tools.html#omp), get it into the right place on our computer as well as create a omp.config file (you can download an example from below) which will provide settings and credentials to the OMP client.
Example OMP File (hosted on GitHub – https://gist.github.com/jamesfed/4ed9be7de2adb83d1d442cc06ea1dbeb).
In addition to follow through with this guide you should download the .ps1 file below which contains the PowerShell code for the steps shown in the screenshots.
OpenVAS-Simple-Example.ps1 (hosted on GitHub – https://gist.github.com/jamesfed/6a5c6634abc12c180f125e25c2764d1f).
Creating a Target
Creating and kicking off a Task
Exporting the Report
Reading the Report
To discover more about the omp.exe tool take a look here – http://docs.greenbone.net/GSM-Manual/gos-4/en/omp.html#access-with-omp.
In the next post of this series I’ll be covering how we can take these simple beginnings and start to build something more in depth through OMP and PowerShell.
In this release we have…
- Get-SympaLogin (to login and get a session cookie – the result of which is used with all other functions)
- Get-SympaMailingListMember (get the members of a list or list(s))
- Add-SympaMailingListMember (add a member(s) to a list)
- Remove-SympaMailingListMember (removes a member(s) from a list)
- Test-SympaMailingListMember (checks to see if someone is a Subscriber, Owner or Editor of a list)
- Sync-SympaMailingList (based on the contents of a reference CSV makes changes to the membership of a list)
- How a CSV storing credentials might look (samplecredsfile.csv)
- How a CSV that is used to Add/Remove members in bulk to/from a single list (samplememberslist.csv)
- How a CSV that is used with the Sync- function would look (samplesynclist.csv)
Super Awesome Features
- Credentials can be stored in a CSV to avoid them being typed in as part of a wider script
- Pipeline support for members in lists
How to get it
The PowerShell Gallery is the best route to get your hands on the Module, see this link – https://www.powershellgallery.com/packages/PSSympa for the full details in short though you should only need to run the following command at your PowerShell prompt (assuming you are running a recent version of PowerShell) to install the module on your PC.
Install-Module -Name PSSympa
One of my favourite features of PowerShell is the Invoke-RestMethod cmdlet which (among a great many other things) can download the data from an RSS feed. One application I’ve found for this is to stay on top of security bulletins from organisations like Adobe and Drupal.
However just downloading the data from the feed and kicking it out in an email isn’t quite good enough for my needs thus the script below gets data from a CSV which contains the URL to the feed as well as some extra details to inject into any email notification (e.g. a link to the guide on how to deploy Adobe Updates).
In my production environment this script creates tickets on a FreskDesk helpdesk to log and manage any new update notifications. In the attached example below the script just fires off email notifications.
Have a look at the screenshot sequence below for more info!
Get-Rss (4.0 KiB, 648 hits)
Update 09/05/2017 – v0.2 – Now handles XML and Arrays in the link and title objects (good for reddit and blogspot!)
So this post is a more a reminder to me than anything else but…having recently come across the Microsoft TechNet article ‘Keyboard Shortcuts for the Windows PowerShell ISE’ (https://msdn.microsoft.com/powershell/scripting/core-powershell/ise/keyboard-shortcuts-for-the-windows-powershell-ise) I thought it necessary to highlight the two keyboard shortcuts….
Ctrl + J – brings up a list of code snippet templates (e.g. try-catch-finally and do-until)
Ctrl + M – expand or collapse braces
See the screenshots below for a demo and do make sure you try them yourself!