dot

packages and services management
Log | Files | Refs | README

commit a2b9378349ea44921e7596abcb767d7344d211a0
parent adfe1a31e44f60bac11a0c70e2b51232fe2e0d6c
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun,  2 Dec 2018 14:01:20 +0100

wrap up the agent scripts and services

Diffstat:
Abin/gpg-export | 6++++++
Dbin/gpg-httpfile-wkd | 24------------------------
Abin/gpg-import | 8++++++++
Abin/gpg-wkd-httpfile | 24++++++++++++++++++++++++
Mbin/service-restart | 10++++++++--
Mbin/service-status | 2+-
As6/dirmngr/josuah/env/USER | 1+
As6/dirmngr/root/env/USER | 1+
Ds6/dirmngr/run | 4----
As6/dirmngr/x/run | 15+++++++++++++++
As6/dirmngr/x/type | 1+
Ms6/gpg-agent/x/run | 5+++--
As6/host/t470s/contents | 8++++++++
13 files changed, 76 insertions(+), 33 deletions(-)

diff --git a/bin/gpg-export b/bin/gpg-export @@ -0,0 +1,6 @@ +#!/bin/sh -ex + +cd "$HOME/.gnupg" +cp -r "private-keys-v1.d" "/mnt/key/gpg" +gpg --export >"/mnt/key/gpg/pubring.gpg" +gpg --export-ownertrust >"/mnt/key/gpg/trustdb.txt" diff --git a/bin/gpg-httpfile-wkd b/bin/gpg-httpfile-wkd @@ -1,24 +0,0 @@ -#!/usr/bin/env execlineb - -importas -D /var/www/plain wkd WKD - -forbacktickx -n -d "\n" x { - pipeline { gpg -k --with-wkd } - sed -rn "/^uid / { s/.*<([^>]*)>/\\1/; N; s/\\n//; s/@[^@]*$//; s/ +/ / p; }" -} -importas x x - -backtick -n x { heredoc 0 $x sed "s/ .*$//" } -importas mail x - -backtick -n x { heredoc 0 $x sed -r "s/^[^@]*@([^ ]+).*$/\\1/" } -importas domain x - -backtick -n x { heredoc 0 $x sed "s/^.* //" } -importas hash x - -if { mkdir -p ${wkd}/${domain}/:well-known/openpgpkey/hu } -if { touch ${wkd}/${domain}/:well-known/openpgpkey/hu/policy } - -redirfd -w 1 ${wkd}/${domain}/:well-known/openpgpkey/hu/${hash} -gpg --export ${mail} diff --git a/bin/gpg-import b/bin/gpg-import @@ -0,0 +1,8 @@ +#!/bin/sh -ex + +mkdir -p -m 0700 "$HOME/.gnupg" + +cp -r /mnt/key/gpg/private-keys-v1.d/ "$HOME/.gnupg" +gpg --import /mnt/key/gpg/pubring.kbx +gpg --import-ownertrust </mnt/key/gpg/trustdb.txt + diff --git a/bin/gpg-wkd-httpfile b/bin/gpg-wkd-httpfile @@ -0,0 +1,24 @@ +#!/usr/bin/env execlineb + +importas -D /var/www/plain wkd WKD + +forbacktickx -n -d "\n" x { + pipeline { gpg -k --with-wkd } + sed -rn "/^uid / { s/.*<([^>]*)>/\\1/; N; s/\\n//; s/@[^@]*$//; s/ +/ / p; }" +} +importas x x + +backtick -n x { heredoc 0 $x sed "s/ .*$//" } +importas mail x + +backtick -n x { heredoc 0 $x sed -r "s/^[^@]*@([^ ]+).*$/\\1/" } +importas domain x + +backtick -n x { heredoc 0 $x sed "s/^.* //" } +importas hash x + +if { mkdir -p ${wkd}/${domain}/:well-known/openpgpkey/hu } +if { touch ${wkd}/${domain}/:well-known/openpgpkey/policy } + +redirfd -w 1 ${wkd}/${domain}/:well-known/openpgpkey/hu/${hash} +gpg --export ${mail} diff --git a/bin/service-restart b/bin/service-restart @@ -1,5 +1,11 @@ #!/usr/bin/env execlineb elgetpositionals -P 1 -if { service-stop $@ } -if { service-start $@ } +backtick x { + pipeline { s6-rc -l /var/s6/.s6-rc/live list $@ } + grep -v ,log +} +importas -ns -d "\n" sv x + +if { service-stop ${sv} } +if { service-start ${sv} } diff --git a/bin/service-status b/bin/service-status @@ -11,7 +11,7 @@ forbacktickx x { } importas -n -d "\n" sv x -if { heredoc 0 ${sv} sed -r "s/([^,]*),?(.*)/ \033[1m\\1\033[m (\\2)/" } +if { heredoc 0 ${sv} sed -r "s/([^,]*),?(.*)/ \033[1m\\1\033[m (\\2)/; s/\\(\\)/(x)/" } if { printf " " } if { s6-svstat /run/s6/${sv} } if { printf "\n" } diff --git a/s6/dirmngr/josuah/env/USER b/s6/dirmngr/josuah/env/USER @@ -0,0 +1 @@ +josuah diff --git a/s6/dirmngr/root/env/USER b/s6/dirmngr/root/env/USER @@ -0,0 +1 @@ +root diff --git a/s6/dirmngr/run b/s6/dirmngr/run @@ -1,4 +0,0 @@ -#!/usr/bin/env execlineb -fdmove -c 2 1 - -dirmngr --supervised diff --git a/s6/dirmngr/x/run b/s6/dirmngr/x/run @@ -0,0 +1,15 @@ +#!/usr/bin/env execlineb +fdmove -c 2 1 +s6-envdir env +multisubstitute { + importas USER USER +} + +backtick -n HOME { homeof ${USER} } +importas HOME HOME + +s6-setuidgid ${USER} + +s6-ipcserver-socketbinder -d -a 0700 "${HOME}/.gnupg/S.dirmngr" +fdmove -c 3 0 +dirmngr -vv --supervised diff --git a/s6/dirmngr/x/type b/s6/dirmngr/x/type @@ -0,0 +1 @@ +longrun diff --git a/s6/gpg-agent/x/run b/s6/gpg-agent/x/run @@ -5,10 +5,11 @@ multisubstitute { importas USER USER } -backtick -n x { homeof ${USER} } -importas HOME x +backtick -n HOME { homeof ${USER} } +importas HOME HOME s6-setuidgid ${USER} + s6-ipcserver-socketbinder -d -a 0700 "${HOME}/.gnupg/S.gpg-agent" fdmove -c 3 0 gpg-agent -vv --supervised diff --git a/s6/host/t470s/contents b/s6/host/t470s/contents @@ -0,0 +1,8 @@ +dirmngr,josuah +dirmngr,root +gpg-agent,josuah +gpg-agent,root +qmail-send +ssh-agent,josuah +ssh-agent,root +tinysshd