SSH hardening

Often I am unhappy with the default settings of the SSH daemon. Not that they provide a security threat to the systems but you can make it even more difficult for an attacker to get access to a system. In addition to the default settings I always enable the following:

Deferring functions for "on entry" actions

I decided to learn Go because it seems an interesting and easy to learn low-level programming language. There are several free online resources to learn the language, such as The Go Tour, but I decided to Go for the book "The Go Programming Language" (GOPL) by Alan Donovan and Brian Kernighan. In the book, there are some code examples that I find particularly elegant. Here, I want to record some of these examples for future reference -- while having the chance to add some additional comments on the code for myself.