barrow blog

a chronicle of all the shenanigans we here in the barrow system get up to

KeePass Tips and Tricks

March 29, 2020 — ~barrow

KeePass is a neat password manager that's completely local. This is good for security, because you have total control over your password database.

One big issue with keepass is that, well, it's local! Unlike most major password managers, there's no cloud to sync with. This is great for security, but bad for actually using the password manager! Super complicated passwords aren't any good if you have to send them to your phone in plain-text!

Keepass actually has a solution to this. Your password database can be synchronized with other files both locally and remotely. I want my database sync'd between my (android) phone and my PC, so i have a copy of it in my google drive. One database at $HOME/Documents/Passwords.kdbx (I'm on windows, deal with it) and another file at $GOOGLEDRIVE/Passwords.kdbx.

As long as i have "google backup and sync" running on my pc, it's as simple as (in keypass) File -> Synchronize -> Synchronize With File($GOOGLEDRIVE/Passwords.kdbx).

The major problem is that this is a manual process, so what usually happens is:

  • I need a password on my phone
  • I open up keepass2android
  • The password isn't there
  • I have to go over to my pc
  • Open Keepass on pc
  • Sync with $GOOGLEDRIVE/Passwords.kdbx
  • Click synchronize in keepass2android
  • Re-authenticate with fingerprint
  • Find the password

This is, to put it bluntly, really dumb! Surely there's some way to automatically synchronize the databases, right?

Turns out, keepass has a trigger system for automating these sorts of actions. Great! I'll just set a trigger for event "database saved", with action "synchronize with file." Then i'll just save my file aaand... it's stuck in a loop.

Turns out, when keepass synchronizes with another database file, it first saves the current file. So the call stack (if you will) looks something like:

  • Save Database
  • TRIGGER EVENT DETECTED!!! Synchronize database!
    • Save current database
    • TRIGGER EVENT DETECTED!!! Synchronize database!
      • Save current database
      • TRIGGER EVENT DETECTED!!! Synchronize database!

You can see where this is going. I struggled with this for quite a while. Eventually, I did find the solution! Warning: it's dumb.

My trigger is named "GDrive Sync".
It triggers on "Saved Database file", as long as the file path contains "Documents"
(otherwise it would trigger while saving the file in drive)
It executes three actions, one after another:

  • Change trigger on/off state
    • Trigger Name: GDrive Sync
    • New State: off
  • Synchronize active database with file
    • Path: $GOOGLEDRIVE/Passwords.kdbx
  • Change trigger on/off state
    • Trigger Name: GDrive Sync
    • New State: on

It's really dumb, right? but it works!! Every time i save my password database, it's synchronized with google drive!

Idk how to end this lol, bye ^w^

tags:

Weechat Commands

March 27, 2020 — ~barrow

I keep having to search for a usable list of weechat commands and keybinds.
This probably won't be that, but at least it'll help me! ^w^

This list will be updated as i find more useful things!

Basics

  • PGUP/PGDN
    • Scrolls the current buffer.
  • ALT-NUMBER
    • Switches to numbered buffer.
  • ALT-A
    • Switches to a buffer with activity.
  • /close
    • Closes the current buffer.

Channels

  • /join #CHANNEL
    • Joins a channel
    • Adds a new buffer if one does not already exist.
  • /part #CHANNEL
    • Parts from a channel.
    • Does not close the channel's buffer.

Buffers

  • CTRL-X
    • Switches between grouped buffers.
  • ALT-X
    • Toggles group mode between "merge all grouped buffers" and "only show selected".
    • Changes setting per-group.
  • /buffer move NUMBER
    • Moves the current buffer (or buffer group) to the given position.
  • /buffer merge NUMBER
    • Merges the current buffer with the given numbered buffer to form a buffer group.
  • /buffer unmerge
    • Moves the current buffer out of a buffer group.

Private Messages

  • /query USERNAME MESSAGE
    • Sends a PM to the given user.
    • Opens a new buffer if one does not exist.

Notifications

  • /set weechat.look.buffer_notify_default
    • Sets the notification level for all buffers.
    • Options are:
      • none: no notifications
      • highlight: mentions and DMs
      • message: all messages
      • all: all messages + all IRC events (user join/user part/user quit/etc)

tags: reference, weechat

SSH Agent Fowarding SLAPS

March 25, 2020 — ~barrow

I just moved from ctrl-c.club, and in preparation i decided to learn how to use scp. (I was going to learn rsync, but whatever lol) Turns out, it's really simple! It's just like cp except you add user@host: in front of either of the file options!

Now, ctrl-c.club handles auth similarly to ~team. Password auth is disabled in favor of pubkey auth. The problem is that i'm copying between two servers.

So, my options seem to be:

  • Copy my ssh private key for ctrl-c.club to ~team so i can login from here
    (bad idea)

  • Make a new ssh key on ~team and add it to my authorized-keys on ctrl-c
    (better idea but still a pain)

  • Use scp from my client with the -3 option, something like scp -3 barrow@ctrl-c.club:.vimrc barrow@tilde.team:.vimrc
    (not only would this be a pain, but i don't even know if i could get it working, since my client is windows and i'm using putty scp)

It was at this moment i finally discovered pageant.
Pageant is the ssh authentication agent built in to putty. Normally when connecting to a server with pubkey auth in putty, it asks you for the password to your private key. Pageant handles this for you. You type in your password once when you load in the key, and it automatically authenticates you. This is cool! It makes auth way quicker and simpler!! But, can this help with my cross-server scp problem?

Actually, yes! See, the geniuses who designed ssh (probably dealing with a similar problem) had the idea for SSH Agent Forwarding. This means that an ssh auth agent running on the client can be used on the server the client is connected to! All I had to do was change one option in putty (Connection -> SSH -> Auth -> Authentication Parameters -> Allow Agent Forwarding). With that option enabled for my connection to ~team, I could simply run scp barrow@ctrl-c.club:.vimrc ~/.vimrc! Pageant (on my client) automatically handled the authentication for the connection!

This is super cool!! I love these sorts of simple things that just work. More and more today it seems like software is designed to make money, but it doesn't have to be! Software can be designed for people, and personally, I think it should.

In any case, I'm hyped to be on ~team, and can't wait to see what shenanigans i get up to! ^_^