fix: use set-sshkey binary to rollout sshkeys

This commit is contained in:
Markus Pesch 2020-09-03 15:51:25 +02:00
parent 0c615b9138
commit 002d3c4644
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 41 additions and 27 deletions

View File

@ -1,6 +1,6 @@
*
!*.sh
!*.install
!.gitignore
!authorized_keys
!Makefile
!PKGBUILD

View File

@ -1,11 +1,32 @@
# Maintainer: Markus Pesch <markus.pesch@cryptic.systems>
pkgname=cs-dev-sshkeys
pkgver=0.1.0
pkgrel=1
pkgdesc='Register the development ssh keys in /root/.ssh/authorized_keys'
pkgver=0.2.0
pkgrel=0
pkgdesc='Register development ssh keys in /root/.ssh/authorized_keys'
arch=('any')
url=https://git.cryptic.systems/volker.raschek/PKGBUILDs/any/cs-dev-sshkys
url=https://git.cryptic.systems/volker.raschek/set-sshkeys
license=('Apache 2.0')
depends=('openssh')
install=${pkgname}.install
makedepends=('git' 'go' 'make')
source=(
"https://git.cryptic.systems/volker.raschek/set-sshkeys/archive/v${pkgver}.tar.gz"
"local://authorized_keys"
)
sha512sums=(
"20f237a92d40ae0324ec5e6c4226965148ef8aef3c2cd41279d2278f93353b3f93d6e8cf1cc4fe9b9abe6dc7d9588e60d0a6a983bd7c6ff9ede000925b91479f"
"SKIP"
)
build() {
GOBIN=${HOME}/go/bin
PATH=${GOBIN}:${PATH}
make --directory ${srcdir}/set-sshkeys bin/tmp/set-sshkeys VERSION=${pkgver}
}
package() {
install -D --mode 644 ${srcdir}/authorized_keys ${pkgdir}/etc/set-sshkeys/authorized_keys
install -D --mode 4755 ${srcdir}/set-sshkeys/bin/tmp/set-sshkeys ${pkgdir}/usr/bin/set-sshkeys
install -D --mode 644 ${srcdir}/set-sshkeys/LICENSE ${pkgdir}/usr/share/licenses/set-sshkeys/LICENSE
}

View File

@ -0,0 +1,3 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPOydCxv9/tAV7AdS2HsUIEu547Z5qUJnWYwiO7rI9YL markus@markus-pc
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJUTcUBb+55jRY9TkpLgm8K/8nJfEXyjEX8zljdCCRpi markus@markus-nb
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFo3dc6H1FtVuliB70QY21+7Hsuheqq5ldfgGWg+QLXJ root@ares

View File

@ -1,25 +1,15 @@
post_install(){
cat >> root/.ssh/authorized_keys <<EOF
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPOydCxv9/tAV7AdS2HsUIEu547Z5qUJnWYwiO7rI9YL markus@markus-pc
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJUTcUBb+55jRY9TkpLgm8K/8nJfEXyjEX8zljdCCRpi markus@markus-nb
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFo3dc6H1FtVuliB70QY21+7Hsuheqq5ldfgGWg+QLXJ root@ares
EOF
/usr/bin/set-sshkeys
}
# post_update(){
# sed --in-place \
# --regexp-extended '/^ssh-ed25519 .* (markus@markus-pc|markus@markus-nb|root@ares)$/d' \
# root/.ssh/authorized_keys
# cat >> root/.ssh/authorized_keys <<EOF
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPOydCxv9/tAV7AdS2HsUIEu547Z5qUJnWYwiO7rI9YL markus@markus-pc
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJUTcUBb+55jRY9TkpLgm8K/8nJfEXyjEX8zljdCCRpi markus@markus-nb
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFo3dc6H1FtVuliB70QY21+7Hsuheqq5ldfgGWg+QLXJ root@ares
# EOF
# }
post_remove(){
sed --in-place \
--regexp-extended '/^ssh-ed25519 .* (markus@markus-pc|markus@markus-nb|root@ares)$/d' \
root/.ssh/authorized_keys
pre_upgrade(){
/usr/bin/set-sshkeys --remove
}
post_upgrade(){
/usr/bin/set-sshkeys
}
pre_remove(){
/usr/bin/set-sshkeys --remove
}