Skip to content

Instantly share code, notes, and snippets.

View rohan-molloy's full-sized avatar

Rohan rohan-molloy

View GitHub Profile
rohan-molloy /
Last active May 23, 2024 07:32
This tutorial will look at how network namespaces can be defined in systemd service unit definitions

Network Isolation of Services with Systemd

Network namespaces are an important component of containerization in Linux. A network namespace (netns) allows a running process to see different network interfaces, routes, and firewall rules from the rest of the system. There are a number of use cases for network namespaces, such as running multiple servers, testing/staging environments and providing isolation of services.

Creating a Network Namepsace

We begin by creating a generic systemd service for creating a named network namespace. I add the following to /usr/lib/systemd/system/netns@.service. In systemd, the @ mean the service takes a parameter which is passed to the unit via %i. E.g, we can run sudo systemctl start netns@webserver.service.


2023-09-27T10:52:26.802Z In(05) host-3241276 Using kernel build system.
2023-09-27T10:52:26.802Z In(05) host-3241276 /tmp/modconfig-MRgyG5/vmnet-only/bridge.c: In function ‘VNetBridgeSendLargePacket’:
2023-09-27T10:52:26.802Z In(05) host-3241276 /tmp/modconfig-MRgyG5/vmnet-only/bridge.c:1413:11: error: implicit declaration of function ‘skb_gso_segment’; did you mean ‘tcp_gso_segment’? [-Werror=implicit-function-declaration]
2023-09-27T10:52:26.802Z In(05) host-3241276  1413 |    segs = skb_gso_segment(skb, 0);
2023-09-27T10:52:26.802Z In(05) host-3241276       |           ^~~~~~~~~~~~~~~
2023-09-27T10:52:26.802Z In(05) host-3241276       |           tcp_gso_segment
2023-09-27T10:52:26.802Z In(05) host-3241276 /tmp/modconfig-MRgyG5/vmnet-only/bridge.c:1413:9: warning: assignment to ‘struct sk_buff *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
2023-09-27T10:52:26.802Z In(05) host-3241276  1413 |    segs = skb_gso_segment(skb, 0);
rohan-molloy / unbound.conf
Last active January 4, 2024 00:44
Working unbound over TLS server; self-hosted. Does NOT answer UDP or unencrypted requests.
# d899b42486eb805b8e432c5758568db487c6bcfc067d6ca7e1292a5a66d66de6 unbound.conf
# Listen on tcp 443,853
# Allow from anywhere
access-control: allow
access-control: ::0/0 allow

ICMPv6 Firewall Rules

Allow in ICMP messages (highly recommended)

ip6tables -A INPUT   -p ipv6-icmp -m icmp6 --icmpv6-type 128 \
-m --comment Permit-EchoRequest   -j ACCEPT

ip6tables -A INPUT   -p ipv6-icmp -m icmp6 --icmpv6-type 129 \
-m --comment Permit-EchoReply     -j ACCEPT
import requests
import os
import uuid
import hashlib
def download_file_hash(url, extension='txt'):
response = requests.get(url)
if response.status_code == 200:
sha256hash = hashlib.sha256(response.content).hexdigest()
filename = f'{sha256hash}.{extension}'
with open(filename, 'wb') as file:
rohan-molloy /
Created August 15, 2022 09:24
How to stop teams starting at logon

Disable Teams Autostart

  1. Create the file C:\Windows\System32\GroupPolicy\User\Scripts\Logon\disableteams.cmd with the following contents
%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -File %WINDIR%\System32\GroupPolicy\User\Scripts\Logon\disableteams.ps1
  1. Create the file C:\Windows\System32\GroupPolicy\User\Scripts\Logon\disableteams.ps1 with the following contents
$entry = $null -eq (Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Run)."com.squirrel.Teams.Teams"
if ( !$entry ) {
rohan-molloy / vmware-onthehub-downloads.yml
Last active July 13, 2022 15:29
Public Downloads for Various VMWare Products from OnTheHub.Com. License keys are requied
name: 'VMware NSX for vSphere'
serial: null
- ''
name: 'VMware vRealize Suite 7 Enterprise'
serial: null
# Variables
# Create the network namespace
echo "Creating ${NETNS}" 1>&2
rohan-molloy /
Created May 13, 2022 08:08
Download standalone docker cli
export DOCKERVERSION=20.10.5
curl -fsSLO${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
rohan-molloy / Installing VMWare Workstation 16 on Fedora
Created February 27, 2021 05:55
Installing VMWare Workstation 16 on Fedora 33