random musings from 改造
OpenBSD - veb's, vport's and vlan's
openbsd - veb’s, vport’s and vlan’s
Inspired by a question on reddit from someone who wanted to create another wireless network for guests to the house, here’s a short how-to on how I’ve got things set up at home.
My main router/firewall is an OpenBSD box, with multiple nics. A few of those nics’ connect to some Wireless AP’s, running OpenWRT. The OpenWRT AP’s run a few different SSID’s for things, for example I’ve got one for guests to the house, one for the AV kit, one for the IoT devices…
….dotfiles
.dotfiles
On the old site I used to keep some of my .dotfiles for configuration of stuff, so I could easily grab them and reuse them on every new box I touched, and also so others can find some reference material. Here’s the modern equivalents of what I’ve got.
.tmux.conf
Of all the things I can’t live without, tmux is one of the top ones. This config broadly remaps the ctrl+b
behavior to react to ctrl+a
and changes the theme to my favourite one….
AWS and SMS
Code to get stuff done quickly using the AWS golang SDK is often surprisingly easy.
For example, sending an SMS is as easy as the following….
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sns"
)
func main() {
sess := session.Must(session.NewSession())
svc := sns.New(sess)
params := &sns.PublishInput{
Message: aws.String("Some Message Here"),
PhoneNumber: aws.String("+44000000000"),
}
_, _ = svc.Publish(params)
}
Custom Freebsd Images (13.1) on Oracle Cloud ARM64
This is a rather terse guide to doing this. I’m assuming you already know what you’re doing with FreeBSD and are comfortable building your own systems from source. If not, go do that now and comeback here….
Download the diff from here.
If that file is not found, it’s probably been updated. You can find the current version on this page.
Apply the diff in /usr/src
with
git apply -p0 D34746.diff
Next up you can do a bit of customising to the image. Edit the file '/usr/src/release/tools/oci.conf'
and change how you see fit, be sure to increase the disk image size so that everything will fit in it. I’d also recommend changing the username to one that you’d like to use.
Cloudfront and index.html files
CloudFront is not a Web Server.
It’s easy to think of Cloudfront as a web server - indeed once it’s set up it pretty much works as one, but behind the scenes it’s really just another interface to an S3 bucket, which itself you think looks like a filesystem, because it kinda pretends it is…
The problem comes, after you’re used to hitting /some-location/ and the webserver automagically knows to server you index.html (even though you never see this in the location bar of your browswer). Then you’ll be a little surprised to find that you don’t get served an index.html file at all - nor do you get a 404 error. What you actually get is a cryptic cloudfront access denied error message.
…Golang Highlighting
Playing with hugo.
This should be some pretty formatted gocode ….
package main
import (
"crypto/rand"
"log"
"math/big"
"net"
"time"
)
type foo struct {
name string
}
func main() {
var i int
time.Sleep(5 * time.Millisecond)
}
Moving to AWS
Well, Moved actually…
History.
Many many years ago, kaizo.org was hosted the ony way you could host your own stuff, on physical hardware in a datacentre.
Specifically, c0ke.kaizo.org was a physical Sun Microsystems SparcStation 10 which was hosted up at the excellent Legend Internet in Leeds. This was circa 2000 when all this was in place, and it served well until virtual machines bacame the next big thing. We retired c0ke because frankly, it was an absolute pain in the arse - if something when wrong it required a car journey from London or Oxford, all the way to leeds, to give it some love.
…