Not today...

Filed under Snippet...

comments

Snippet

Bash base64 padding

Disclaimer: I am not 100% percent sure of my formula. It works every time I use it but I may have misunderstood some concepts. Take this article with a grain of salt. It happens that sometimes I have to process some base64 encoded strings which are not padded correctly (here is the wikipedia explanation of base64 padding). When using the base64 -d command I end up getting the following error: base64: invalid input and a non zero exit code. Read More...

Tagged bash

comments

Snippet

Install custom certificate with mkcert

Following my previous post about generating a custom root certificate and a PKI. I will share today a small snippet to install your self made certificate on your laptop (or fleet) to be used by the system or the browsers. It works on OSX, Linux and Windows by using a nice hidden feature of mkcert. Following the documentation, we can see that we can install a certificate from a custom location. Read More...

Tagged bash , admin

comments

Snippet

Terraform PKI

Once upon a time, I tried to setup an infrastructure using Terraform and Docker. Spoiler alert: I reevaluated my setup to go for a Kubernetes approach which is easier and more robust. However, this experiment gave me the opportunity to better understand a really important part of a self hosted infrastructure: how to set up a PKI. Disclaimer: I may not use the proper terms or be sloppy on some concepts. Read More...

Tagged terraform

comments

Snippet

Viper Multi Config

This post will explain how to overload configurations in Golang using viper and cobra libraries. The use case may be a niche one, but I find this to be an easy to understand and pretty clear way to do configuration merge. The problem and the expectation I am deploying most of my application on Kubernetes nowadays (I also moved my personal infrastructure to it a few weeks ago). This solution come with a big tooling ecosystem and a really opiniated way to deploy. Read More...

Tagged golang , dev , cli

comments

Snippet

KVM with Docker bridge

This post will explain how to use the docker bridge as a KVM bridge. In this post I will use the Qemu command line to manage my VMs. There is a lot of ways to connect a VM to the internet. The most common one is via network address translation (NAT). This method has a few down side, the main one being that you need to explicitely configure port forwarding for your VM services to be reachable from the host. Read More...

Tagged admin , cli

comments

Snippet

Socat, Telnet and Unix sockets

Once in a while I use telnet, mostly to check if a port is open (the infamous telnet localhost 22) and sometimes to send a random http request. However, telnet has a few caveats which are: not able to read from stdin not able to deal with https not able to handle unix sockets Those limitations are pushing me towards the use of the socat utility. Here I will show a few situations in which I am now using socat. Read More...

Tagged cli , admin , bash

comments

Snippet

Terraform retrieve sensible data

Another post on Terraform. Here to share a little snippet to retrieve some data from your Terraform state. When you are dealing with some Terraform resources or writing modules you may encounter the sensitive keyword/value (here is a bit of doc). This is handy to avoid leaking some data, but from time to time you may want to extract one of those. Code For this article let’s imagine I am creating an aws_iam_user for another team to access some specific resources. Read More...

Tagged cli , terraform

comments

Snippet

The wild kubectl logs issue

A quick post to present one of my finding during my Kubernetes journey. It may help people since it took me some time to find this out. I am currently using Kubernetes a lot for my job. I am part of the infrastructure team and need to debug some setups. I am using kubectl logs extensively and I found a few interesting options I’d like to share. Most of the time you will have multiple containers handling requests and you want to see what is happening in all of them. Read More...

Tagged kubernetes , admin , cli

comments

Snippet

Golang SSH tunneling

I already did an article around Golang and SSH previously, since it is a huge part of my current work. Today, I will share a small snippet which can be quite handy when automating stuff. This is how to perform a SSH tunnel using Golang. I will not explain what it is or what it is useful for, if you need more details please check the doc. In this tutorial, I will use the official SSH library from Google. Read More...

Tagged dev , golang

comments

Snippet

RSA OAEP in Go and Openssl equivalent

From time to time you write some code to deal with data that will be stored somewhere on a drive. When debugging it may be nice to have “shell” commands to mimic code and help understanding what is going on. When it comes to encryption the swiss army knife you will most probably have in your shell environment is openssl. But reading and understanding the documentation can sometimes be “challenging”. Read More...

Tagged golang , bash