Getting started with Ansible

Hey there! 👋 In this blog post I’ll be writing about Ansible. I’ve been using it for a little while now and I’d like to share my experience with it and share some knowledge for others starting out! :slight_smile: Let’s begin! 🚀 What is Ansible? Ansible is an open-source automation tool which can be used to automate the management and configuration of servers and other devices. Written in Python, Ansible is agentless and connects over SSH. Some common use-cases for Ansible include (but are not limited to): ...

March 5, 2023 · 6 min · 1245 words · Daniel Brennand

PowerShell: Storing Credentials Securely

Recently I’ve been working on several PowerShell scripts that require credentials to access REST APIs. In this blog post, I will showcase two approaches for storing credentials securely for use in PowerShell scripts. Encrypted Password File 🔒 The encrypted password file leverages the Windows Data Protection API (DPAPI) to encrypt the password as a System.Security.SecureString: $Credentials = Get-Credential $Credentials.Password System.Security.SecureString $Credentials.Password | ConvertFrom-SecureString 01000000d08c9ddf0115d1118c7a00c04fc297eb01000000f5ab85d7ee9da048ae4ae797ee7eaf0a000000000200000000001066000000010000200000008c4a03d2f0731e0e7661d695fda8b441eaff31e75724931f31374a0c8292b636000000000e800000000200002000000028da885828bd627480178382ce9a1b477819e7703546ce41819d37f4e63d33ba20000000ab2c4401635ec24db9f20071e18dea0b79ce16ba38b5503ec9937b7fbc849dcf40000000155053a793c210998ef7317b0161e7344c2174b904b527c0cf24e7bbf2243b99e936df3ab67bc9e285a1be33aed37c7604fb07f5d0c44ceb7d6334ca30b0a610 By default DPAPI uses the current user context to generate an encryption key. This encryption key is then used to encrypt the PSCredential.Password property as a System.Security.SecureString (as shown above). It is possible to provide your own encryption key, but I won’t be covering that in this post. If you want to read more on this, check out Travis Gan’s blog 1. ...

December 22, 2022 · 5 min · 932 words · Daniel Brennand

Using Git Hooks to lint PowerShell

Hi there! 👋 Recently I discovered Git Hooks. Git Hooks provide a way of running custom scripts when a certain git action occurs. In this post, I want to share a pre-commit Git Hook I’ve written to lint PowerShell code using the PSScriptAnalyzer module. What is a Linter? 🕵️‍♂️ A linter analyses code to identify common errors, bugs and stylistic issues. Their aim is to improve code quality. Linters perform static analysis meaning they check code without executing it. Some well known linters for other languages include ESLint and Pylint. ...

April 24, 2022 · 3 min · 562 words · Daniel Brennand

Use youtube-dl to download a streamed video

Hi there! 👋 In this blog post, I will show you how to download a streamed video from a website using youtube-dl. Background Recently I needed to download a streamed video from a website for archival purposes. Full disclaimer, the service had already been paid for and I wanted to keep the video which was set to expire after a specific date. Investigation 🔍 At first there was no obvious way to download the video. Investigating the HTTP traffic in the browser, I could see that the video was being streamed with each part being progressively downloaded. ...

December 19, 2021 · 3 min · 463 words · Daniel Brennand

Interacting with the ECS S3 API using the aws-sdk/client-s3 package

Recently at work, a customer raised a ticket about programmatically interacting with UKCloud’s Cloud Storage service. UKCloud’s Cloud Storage service is an object storage solution based on Dell EMC Elastic Cloud Storage (ECS). Access is via a RESTful API, which also provides support for Amazon’s S3 API. UKCloud: Getting Started Guide for Cloud Storage 1 This ticket was interesting as the customer was using the @aws-sdk/client-s3 JavaScript package to upload images to the service. Prior to this ticket, I hadn’t used this package before or have much experience with S3 object storage and programmatically interacting with it. In this blog post, I want to share my learnings and provide a couple of examples in Node.js for interacting with UKCloud’s Cloud Storage service using this package. ...

December 7, 2021 · 6 min · 1201 words · Daniel Brennand

Using Cloudflare as a Dynamic DNS (DDNS) provider

Hey there! 👋 In this blog post, I will be showing you how to use Cloudflare as a Dynamic DNS (DDNS) provider. What is DDNS? Dynamic DNS (DDNS) is a service that keeps the Domain Name System (DNS) updated with a web property’s correct IP address. Cloudflare glossary: Dynamic DNS 1 Essentially, DDNS allows you to automatically update your domain’s DNS records when a change is detected to your home’s public IP address. ...

September 16, 2021 · 4 min · 842 words · Daniel Brennand

Create a blog for free using GitHub Pages and Hugo

Welcome 👋 In this blog post, I will be showing you how to create a blog for free using GitHub Pages and Hugo. I will walk you through the process of creating the GitHub repository (where your blog will live), creating your Hugo site, adding a theme to your blog 🎨, creating your first blog post and automating the publishing process! What is GitHub Pages and Hugo? GitHub Pages allows you to create a website which is hosted directly from a repository on GitHub. ...

July 28, 2021 · 5 min · 890 words · Daniel Brennand

UK COVID-19 stats application

Hi! 👋 I had some free time recently so I decided to develop something which was relevant to current worldwide situation. The ongoing Coronavirus (COVID-19) pandemic. This is going to be a short blog post about the application, its aims and the process of deploying it to Azure App Service. Aims I had three aims that I wanted to achieve: I wanted to develop an application which was simple. I wanted to show data about how the COVID-19 pandemic is developing in the UK. ...

September 30, 2020 · 3 min · 623 words · Daniel Brennand

Using Caddy v2's reverse proxy feature with a domain managed with Cloudflare!

Caddy version 2.0.0 released on May 4th 2020. Caddy brands itself as “The Ultimate Server” with functionality including a web server, reverse proxy, automatic certificate renewal, automatic HTTPS and more! I have to say, it’s pretty awesome! 👍 This blog post will show you how to use the Caddy v2 reverse proxy feature with a domain managed with Cloudflare. So, lets jump in! 😄 Caddyfile Caddy uses a Caddyfile for it’s configuration. Two main Caddyfile concepts to understand are blocks and directives. ...

July 21, 2020 · 4 min · 818 words · Daniel Brennand