Compare commits
3 Commits
debian
...
LukasLenCP
Author | SHA1 | Date | |
---|---|---|---|
e623d7f21a | |||
8856ba9cf4
|
|||
7326d8f70d |
13
README.md
13
README.md
@ -29,6 +29,19 @@ Der Deamon besteht aus folgenden Dateien.
|
||||
* foodoor-ssh-wrapper
|
||||
* foodoor-update-keydb
|
||||
|
||||
Zusätzlich sollte für das git-repo eine Config angelegt werden:
|
||||
|
||||
/root/.ssh/config
|
||||
```
|
||||
Host git.chaospott.de
|
||||
User git
|
||||
Port 2222
|
||||
IdentityFile ~/.ssh/id_chaospott
|
||||
```
|
||||
|
||||
Das IdentityFile ist der Deploy-SSH-Key, der im [Repo](https://git.chaospott.de/Chaospott/foodoor-keys) hinterlegt ist.
|
||||
|
||||
|
||||
##Schüssel
|
||||
|
||||
###Schlüsselupdate
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
@ -9,7 +9,7 @@ dest=/var/run/foodoor-keys
|
||||
if [ ! -e "${dest}/.git/config" ]
|
||||
then
|
||||
#echo "Repo does not exist, trying to clone..."
|
||||
( cd /var/run && git clone --quiet --single-branch --depth=1 luftschleuse@nordstern.chaospott.de:/home/luftschleuse/foodoor-keys "${dest}" )
|
||||
( cd /var/run && git clone --quiet --single-branch --depth=1 ssh://git.chaospott.de/Chaospott/foodoor-keys.git "${dest}" )
|
||||
else
|
||||
#echo "Repo exists, updating..."
|
||||
( cd "${dest}" && git fetch --quiet && git merge --quiet origin/master master )
|
||||
@ -22,10 +22,13 @@ do
|
||||
find "${dest}/keys" -name '*.pub' | sort | \
|
||||
while read keyfile
|
||||
do
|
||||
valid_key=$(ssh-keygen -l -f ${keyfile})
|
||||
if [ "$?" -eq "0" ]; then
|
||||
if [ $(echo "${valid_key}" | cut -d" " -f1) -lt "4096" ]; then
|
||||
echo "Size of key ${keyfile} is less than 4096. Not adding it to key database." >&2
|
||||
ssh-keygen -l -f ${keyfile} &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
key_length=`ssh-keygen -l -f ${keyfile} | cut -d" " -f1`
|
||||
if ssh-keygen -l -f id_ed25519.pub| cut -d" " -f4 == "(ED25519)"; then
|
||||
key_length += 3840
|
||||
if [ ${key_length} -lt 4096 ]; then
|
||||
echo "Key size of key ${keyfile} not equal to 4096. Not adding it to key database." >&2
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
Reference in New Issue
Block a user