016.txt - gopherhole - My gopherhole source code.
 (HTM) git clone git://jay.scot/gopherhole
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       016.txt (2759B)
       ---
            1 [jay.scot]
            2 [016]
            3 
            4 
            5 --[ Messing with pkg_info and ditching password-store
            6 
            7 
            8 This week has been a tinkering one where I haven't been doing anything
            9 very productive. It has been so long since I properly used C, so I am
           10 working my way through a book on C programming as a refresher. I was
           11 recommended a game, Tales of Maj'Eyal [0], on IRC [1] and I have been
           12 hooked on that most of the day! As a sidenote, I am pleasantly surprised
           13 with the games available on OpenBSD so far.
           14 
           15 
           16 I did notice at the beginning of the week that bash somehow ended up
           17 installed on my system, since I use ksh and never installed it directly
           18 it must be a package dependency. I managed to track it down to the
           19 password-store [2] utility.
           20 
           21 
           22         $ pkg_info -R bash
           23 
           24 
           25 Looking at the package dependencies it also requires a few other
           26 packages I never use.
           27 
           28 
           29         $ pkg_info -f password-store | grep @depend
           30 
           31         @depend converters/base64:base64-*:base64-1.5p0
           32         @depend devel/git,-main:git-*:git-2.37.3
           33         @depend graphics/libqrencode:libqrencode-*:libqrencode-4.1.1
           34         @depend misc/gnugetopt:gnugetopt-*:gnugetopt-1.1.6p2
           35         @depend security/gnupg:gnupg->=2.2.23p1:gnupg-2.2.39
           36         @depend shells/bash:bash-*:bash-5.1.16
           37         @depend sysutils/colortree:colortree-*:colortree-1.8.0
           38         @depend x11/xclip:xclip-*:xclip-0.13p1
           39 
           40 
           41 While I use some of these, all the extras have an estimated file size of
           42 just over 100MB in total. This seems a bit excessive for my usecase and
           43 is something that I basically use as front end to GPG.
           44 
           45 
           46         $ pkg_info -s password-store bash libqrencode colortree gnugetopt
           47 
           48 
           49 I use pass in a few applications such as fdm and senpai, the rest of the
           50 time it's just for website logins, so I really don't need all the
           51 features that pass provides. I just wrote a script that uses my current
           52 pass folder of GPG encrypted files to send these to dmenu. For the
           53 applications, I just added a flag that outputs the pass to stdout
           54 instead.
           55 
           56 
           57         #!/bin/sh
           58         # pass.sh
           59 
           60         if [ "$1" = '-c' ]; then
           61                 [ -f "$2" ] && gpg -q --decrypt "$2" | head -n1 | tr -d '\n'
           62                 exit 0
           63         fi
           64 
           65         password=$(find "${PASSWORD_STORE_DIR}" -type f -name '*.gpg' |
           66                 sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "Pass:")
           67 
           68         [ -n "$password" ] &&
           69                 gpg -q --decrypt "${PASSWORD_STORE_DIR}/$password.gpg" |
           70                 head -n1 | tr -d '\n' | xclip
           71 
           72 
           73 In DWM I just added a keybind for the pass.sh script and for
           74 applications I just pass in the -c flag, so for fdm I just do this:
           75 
           76 
           77         $imap_pass = $(pass.sh -c ~/.pass/myimappass.gpg)
           78 
           79 
           80 100MB of packages replaced by a few lines of shell script, nice! If
           81 I ever need to update the passwords or generate a new one I can just use
           82 GPG like normal.
           83 
           84 
           85         $ openssl rand -base64 32 | gpg -e -o ~/.pass/mynewpass.gpg
           86 
           87 
           88 0. https://te4.org/
           89 1. irc.libera.chat #openbsd_gaming
           90 2. https://www.passwordstore.org/
           91 
           92 
           93 .EOF