Generate self-signed TLS certificates – ECDSA edition
TL;DR:openssl ecparam -name secp521r1 -genkey -noout -out server.key openssl req -new -x509 -key server.key -out server.crt -days 730 Longer version First line generates an eliptic curve key, using the...
View ArticleAWS Encryption types
This post is mainly about SSE – Server Side Encryption. It was hard for me to understand, got quite confused along the way. The fact that the documentation on it is somewhat spread over several...
View ArticlePython module search order (Ansible 2.1 on El Capitan error)
Upgraded Ansible to version 2.1 on OS X El Capitan. First run, I get this error: AttributeError: 'EntryPoint' object has no attribute 'resolve' Googling for it, it seems like the cause is setuptools...
View Articleemrer – Python script to create EMR clusters as code
Emrer is a Python script that reads a YAML file and starts an EMR cluster as specified in that file. The main advantage over other EMR automation solutions is that it will take care of uploading the...
View Articletcpdump – dump raw packets to file while also following on screen
The following will create a dump of raw network packets to a file, while continuously reading that file and displaying the packets on screen in human-readable format:/bin/sh -c "tcpdump -i any -w...
View ArticleAWS permissions – restrict access to S3 bucket based on IP
A bucket policy that will deny access to anyone not coming from the specified IP addresses. Used in combination with IAM groups that allow access to S3, the net result will be that users will be...
View ArticleAWS permissions – monitoring services
AWS permissions intended for a group containing users that will monitor the environment, but should not have access to data and are not allowed to make any changes. Should allow members to check the...
View ArticleAWS permissions – own MFA
AWS IAM permissions to allow users to set up MFA devices for themselves. ${aws:username} restricts access to the logged on user only. “iam:ListUsers” allows them to navigate to their own user in...
View ArticleAWS permissions – S3
A set of permissions to be used on Amazon Web Services Simple Storage Service (AWS S3) buckets. Each of them should be attached to a different group. The set imitates the Unix permissions model (rwx),...
View ArticlePython library for managing AWS logs
In Amazon Web Services it’s possible to enable logging for the whole VPC (CloudTrail) or for various services provided by Amazon, like S3. These logs get stored in S3 buckets. They are generated every...
View ArticleInject strings on an already open TCP/IP connection using gdb
Had a situation at $WORK where network connections were just hanging there, open, with no activity. So I needed to send something, whatever, on the open connection, just to see how it behaves. TL;DR:...
View ArticleEnable VirtualBox guest additions features in X
In order to take advantage of shared clipboard, seamless integration and drag&drop features of VirtualBox two things are needed. First, the guest additions need to be installed, pretty...
View ArticleMonitor AWS VPN from Python
Short demo script in Python that monitors the VPN tunnels in Amazon Web Services. It queries the current state every 1.5 seconds in a loop and if the state changes it writes the new state to a log...
View ArticleBackup files on Google Drive using Google Apps Script
My ideea was to set up a script running on Google’s servers that would automatically get files from my site and back them up on Google Drive. I would have gotten a free off-site backup. Unsurprisingly,...
View ArticleShell script to backup WordPress, site and database
I’ve been using this shell script to backup my WordPress site and database for a while. There is nothing WordPress-specific in it though, the script can be used for anything that uses a database. It...
View ArticleNFS mount from a Linux server returns ‘permission denied’
… but everything is set up properly. Check if there is anything under /proc/fs/nfsd/. If there isn’t, run # mount -t nfsd nfsd /proc/nfs/nfsd Apparently it happens when NFS support has been compiled...
View ArticleContinuous rsync script
A shell script that keeps running rsync in a loop until a file is created to stop it. Obviously not the right way to do such things, but good enough for a quickie. #!/bin/sh while : do if [ -f...
View ArticleEnable VNC on virtualbox-ose >=4.2
If you have: % VBoxManage list extpacks Extension Packs: 1 Pack no. 0: VNC Version: 4.2.6_OSE Revision: 82870 Edition: Description: VNC plugin module VRDE Module: VBoxVNC Usable: true Why unusable:...
View ArticleRedirect top level domain in nginx
How to redirect something like “www.example.org” to “www.example.com“, or “longer.subdomain.example.org” to “longer.subdomain.example.com” with a rewrite rule in nginx.conf: server { listen 80;...
View ArticleBuilding a package repository for FreeBSD with poudriere and pkgng
Overview This post covers building a server that will be used to update both ports and the base system on FreeBSD backend servers that don’t have access to the Internet. For ports it will use poudriere...
View Article