AWS Cloud metadata service abuse

A few weeks ago, I presented an internal meetup to the pentesters of my company on how they could take advantage of weak or poorly configured IaaS metadata services. The end of the presentation was backed by an interactive CTF-like workshop that I have setup based on the work from Avishay Bar from CyberArk. While some suggestions from the workshop have been merged into the master, the complete lab is available on the forked version of the original repository available on my Github account.

I made a Gentoo decal for my computer case

I made this Gentoo vinyl decal at work the this week. It’s about 17x13 cm in size and it’s about as small as I dared to make it considering the thin line in the logo.

Using Bash scripts in Linux to delete the history, cookies and cache files of Firefox, Google Chrome and Thunderbird

Fitzcarraldo
, 19/03/2020 | Source: Fitzcarraldo's Blog

The browsing data stored by Firefox, Google Chrome and Thunderbird can be deleted using the respective application’s GUI. But you can also do that using a Bash script, which could be useful if you want to delete unnecessary/unwanted files before e.g. backing up your home directory, or if you want a quick and easy way […]

My system upgrade procedure for Gentoo Linux

Fitzcarraldo
, 07/03/2020 | Source: Fitzcarraldo's Blog

Gentoo Linux is a so-called ‘rolling-release’ distribution, and each Gentoo Linux user has their own preferred sequence of steps for keeping their installation up-to-date. Below is the general procedure I use for system maintenance of my Gentoo installations, which I perform approximately weekly. 1. Update the ebuilds on the machine (see Gentoo Wiki – Project:Portage/Sync) […]

My Gentoo Linux wallpaper

I had troubles with finding a high resolution and clean wallpaper with Gentoo, so I decided to try to make my own wallpaper.

The wallpaper is available in the following three sizes:

  • 1920 x 1080 px
  • 3840 x 2160 px
  • 7680 x 4320 px

The pictures are available on Nextcloud here: https://cloud.operationtulip.com/s/Z7FmBzFdnaQWC8e.

If you want it in any other size, the sources along with instructions is available there as well. If you need any help or just want me to make it for you, just ask.

My blog has a new home and a new address

Hello and welcome to my new home! You’re probably wondering about the new domain hunden.linuxkompis.se? Well. Just keep calm—nothing is happening to my little blog—there’s not going to be any Swedish content here. I do have a Swedish blog though, but that’s over at hund.linuxkompis.se.

What is Linuxkompis anyway? It’s a Swedish project that me and a few friends are working on. If you happen to speak Swedish, like Linux and open source software I would highly recommend you checking it out!

Since I’m now hosting this website myself I also needed a proper domain for it. I thought about buying a new domain, but all the good ones are already taken and I wasn’t super thrilled about spending money on another domain. So.. Why not make use of one that I already have?

The name “hunden” is a Swedish word and it translates to “the dog”. “Hund” means dog in Swedish (and Norwegian, Danish and Germany). The name “Hunden” is also a bad pun of the two words “Hund” and “En[glish]”.

Why not just hund.linuxkompis.se? Because that’s where I have my Swedish blog. It looks just like this website, but it’s in Swedish and a lot older than this blog.

FreeBSD libretro cores

Menelkir
, 23/01/2020 | Source: Daniel Menelkir

I've made a gitlab repository with libretro cores to be used with retroarch (no, don't use the ancient one in ports, use at least this one from here). All you need to do is point core_updater_buildbot_cores_url in your ~/.config/retroarch/retroarch.cfg to "https://gitlab.com/menelkir/libretro-cores/tree/master/FreeBSD".

BTRFS filesystem full, now what?

Menelkir
, 28/12/2019 | Source: Daniel Menelkir

The mileage may vary, but I try to update this post.

Is your filesystem really full? Mis-balanced metadata and/or data chunks

Below, you'll see how to rebalance data blocks and metadata, and you are unlucky enough to get a filesystem full error before you balance, try running this first:
# btrfs balance start -musage=0 /path
# btrfs balance start -dusage=0 /path
 
A null rebalance will help in some cases, if not read on.
Also, if you are really unlucky, you might get in a no more space error that requires adding a temporary block device to your filesystem to allow balance to run. See below for details.

Pre-emptively rebalancing your filesystem

In an ideal world, btrfs would do this for you, but it does not. I personally recommend you do a rebalance weekly or nightly as part of of a btrfs scrub cron job. See the btrfs-scrub script.

Is your filesystem really full? Misbalanced metadata

Unfortunately btrfs has another failure case where the metadata space can fill up. When this happens, even though you have data space left, no new files will be writeable.
In the example below, you can see Metadata DUP 9.5GB out of 10GB. Btrfs keeps 0.5GB for itself, so in the case above, metadata is full and prevents new writes.
One suggested way is to force a full rebalance, and in the example below you can see metadata goes back down to 7.39GB after it's done. Yes, there again, it would be nice if btrfs did this on its own. It will one day (some if it is now in 3.18).
Sometimes, just using -dusage=0 is enough to rebalance metadata (this is now done automatically in 3.18 and above), but if it's not enough, you'll have to increase the number.
# btrfs fi df .
Data, single: total=800.42GiB, used=636.91GiB
System, DUP: total=8.00MiB, used=92.00KiB
System, single: total=4.00MiB, used=0.00
Metadata, DUP: total=10.00GiB, used=9.50GiB
Metadata, single: total=8.00MiB, used=0.00

legolas:/mnt/btrfs_pool2# btrfs balance start -v -dusage=0 /mnt/btrfs_pool2
Dumping filters: flags 0x1, state 0x0, force is off
DATA (flags 0x2): balancing, usage=0
Done, had to relocate 91 out of 823 chunks

legolas:/mnt/btrfs_pool2# btrfs fi df .
Data, single: total=709.01GiB, used=603.85GiB
System, DUP: total=8.00MiB, used=88.00KiB
System, single: total=4.00MiB, used=0.00
Metadata, DUP: total=10.00GiB, used=7.39GiB
Metadata, single: total=8.00MiB, used=0.00

Are you using space_cache?

Probably you've maded a massive copy like a Tb copy with features like space_cache enabled. While space_cache is nice and accelerate things up, you'll probably need to empty this cache. It's easier than you think:

# mount -o remount,clear_cache
# sync
# reboot 

My simple plain text journal

I like keeping a personal journal of what I do in life, it can be anything from every day stuff that I want future me to remember to various thoughts about anything.

The idea with my journal is that I want it to be quick and simple, even though I initially thought about other options like Jekyll and flat file-databases with one entry per file and so on. In the end I decided I don’t want to overdo it—I want to keep it as simple as possible—otherwise I would have probably not bothered with keeping a journal if it would take too much time doing it.

I decided that the best way was to use a single plain text file with Markdown formatting and then using my editor to input the text. As for the formatting, I tried a few different ways of formatting my entries before I settled with this style:

# 2019

## December

### 18 - Wednesday
Example entry.

### 19 - Thursday
Example entry.

If I for some reason ever want to convert it to something else, like HTML code or a PDF-document it would then look like this:

2019

December

18 - Wednesday

Example entry.

19 - Thursday

Example entry.

I also fold every month in Vim to keep it visually compact. Do you keep a journal of some sort? What applications are you using and how are you doing it? It would be fun hearing how other people are doing it. :)

How to fix the TrueType font rendering

I was cleaning up my configuration for ZSH the other day—which is probably a story for another time—it lead me to ‘break’ the font rendering by reverting it back to the defaults, which is if you ask me broken and hideous.

The mistake I did was to remove this line from my ~/.zshrc:

export FREETYPE_PROPERTIES="truetype:interpreter-version=35"

It’s an option that I added years ago and I didn’t even remember what it did. When I cleaned my configuration for ZSH I decided to uncomment everything that I wasn’t sure if I needed or not. I thought that if it’s something important I will notice it eventually. Which I did, but not in the way I intended.. It took me a couple of days before figuring out what broke the font rendering and this was it.

What does it even do?

A couple of years ago, FreeType decided to change the default rendering for the fonts, to something way more ugly if you ask me. They call it the “v40 TrueType” and I don’t like it at all. I prefer the older v35 method and the export enables this by default.