14 Commits

Author SHA1 Message Date
e623d7f21a ed25519 support
My attempt to get ed25519 support for the doors in the script.
Please check function and syntax!
2020-05-21 20:11:56 +02:00
8856ba9cf4 New repo; Howto config 2020-05-21 12:12:28 +02:00
7326d8f70d Bugfix for invalid keys-check 2016-03-31 16:00:53 +02:00
fe2b275779 Fix for missing LF 2015-07-17 19:34:22 +02:00
m
a3add44c29 Allow keys greater than 4096 bit 2015-04-13 17:11:53 +02:00
7d38b27c05 Abhängigkeiten 2015-04-05 17:47:26 +02:00
c1de357149 Abhängigkeiten 2015-04-05 17:39:43 +02:00
10516d232f Abhängigkeiten 2015-04-05 17:38:38 +02:00
e0dc1222ed Abhängigkeiten 2015-04-05 17:34:26 +02:00
4b7406b60a Abhängigkeiten 2015-04-05 17:32:41 +02:00
7d1df01a3e Abhängigkeiten 2015-04-05 17:30:35 +02:00
1f7515a0ed Schüsselformate 2015-04-05 17:20:41 +02:00
a4539fae1d Schüsselformate 2015-04-05 17:09:34 +02:00
ef06d24202 Schüsselupdate 2015-04-05 16:57:27 +02:00
2 changed files with 91 additions and 6 deletions

View File

@ -2,6 +2,87 @@
Das Schließsystem läuft auf einem RaspberryPi mit der Erweiterungsplatine "PiFaceDigitalIO".
##Software##
###Installation###
<code>apt-get install python-pifacedigitalio </code>
Um das Paket zu installieren muss die */etc/apt/sources.list* angepasst werden.
<code>deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi</code>
<code>deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi</code>
Wer apt-get benutzt, kann den Raspbian Pubkey zum keyring hinzufügen.
<code>wget http://archive.raspbian.org/raspbian.public.key -O - | sudo apt-key add -</code>
###Dateiliste###
Der Deamon besteht aus folgenden Dateien.
* foodoor
* foodoord
* foodoord.conf
* foodoord_initd
* 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
<pre><code>foodoor-update-keydb
</code></pre>
Aktualisiert die die Schlüssel auf der Tür und baut die *Authorized_Keys* für die User *open* und *close*. Keys die nicht dem OpenSSH-Format mit 4096 bit entsprechen, werden ignoriert. Wenn das Script von Hand aufgerufen wird, werden die betroffenen Keys angezeigt. Über einen Cronjob werden die Keys alle **5 Min aktualisiert**.
###Schlüsselformate###
Der foodoord akzeptiert nur Pub-Keys im *OpenSSH2-Format*. Keys lassen sich unter anderem mit OpenSSH oder PuTTygen erzeugen.
###OpenSSH####
####Keys generieren####
* Mit <code>ssh-keygen -b 4096 </code> lassen sich Keys generieren.
* <code>ssh-add $Pfad_zum_Key</code> fügt den Key dem ssh-Agent hinzu. Die Option <code>ssh-add -l</code> zeigt geladene Keys an.
* <code>ssh-kegen -l -f $Pfad_zum_Key </code> gibt den Fingerprint und andere Informationen zurück.
####Keys konvertieren(PuTTy>OpenSSH):####
* <code>ssh-keygen -i $Pfad_zum_Key > $Pfad_neuer_Pfad.pub</code> liest ssh2-kompatible Keys(RFC 4716) ein und speichert diese im OpenSSH-Format.
###PuTTy###
Da die Tür nur Keys im OpenSSH-Format verträgt, dürfen auch mit Putty nur OpenSSH-Keys genutzt werden.
###Keys generieren (OpenSSH-Format mit PuttyGen):###
1. PuTTYgen öffnen
2. Unten "Number of Bits in a generated Key:" 4096 eintippen
3. "Generate" klicken um Key zu generieren
4. Nach dem generieren oben im Menu "Conversions" > "Export OpenSSH-Key"
5. Speichern
Es ist zu beachten, dass Putty den PrivateKey im Putty-Format benötigt! Das heißt, falls der generierte Key vor dem Export nicht gespeichert wurde, muss der private Key noch konvertiert werden, siehe nächster Punkt!
###Keys konvertieren(OpenSSH>PuTTy):###
1. PuTTYgen öffnen
2. "Load" drücken
3. OpenSSH-Key auswählen
4. "Save Private-Key" drücken
5. Speichern
##Hardware
### Input:
* ssh-login
* Klingel
@ -10,4 +91,4 @@ Das Schließsystem läuft auf einem RaspberryPi mit der Erweiterungsplatine "PiF
### Output:
* Status LEDs
* Summer
* Keymatic
* Keymatic

View File

@ -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,15 +22,19 @@ 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) -ne "4096" ]; then
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
printf "command=\"/usr/sbin/foodoor ${action}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding " >> ${outfile}
cat "${keyfile}" >> ${outfile}
echo >> ${outfile}
done
install -d -o ${action} -g nogroup -m 0700 /var/lib/foodoor/${action}/.ssh
install -b -S .last -o ${action} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${action}/.ssh/authorized_keys