6 Commits

Author SHA1 Message Date
0b34242781 v3.0.3 2022-07-13 19:18:55 +02:00
a4befbc911 Update-keydb with comments and better Algo check 2022-07-13 19:16:48 +02:00
949fc2e4fb v3.0.2 2022-07-02 15:16:15 +02:00
940af82f84 Get rid of Mac-Newlines 2022-07-02 15:06:11 +02:00
8c232699c3 Dependencies! 2022-04-16 18:32:47 +02:00
cb05047fed Script-Bugfixes, init.d 2022-04-15 18:49:40 +02:00
5 changed files with 17 additions and 10 deletions

View File

@ -1,2 +1,3 @@
#!/bin/bash #!/bin/bash
dpkg-deb --root-owner-group -b debian foodoord_3.0.0_all.deb VERSION=3.0.3
dpkg-deb --root-owner-group -b debian foodoord_${VERSION}_all.deb

View File

@ -1,5 +1,6 @@
Package: foodoord Package: foodoord
Version: 3.0 Version: 3.0.3
Maintainer: Bandie <bandie@chaospott.de> Maintainer: Bandie <bandie@chaospott.de>
Architecture: all Architecture: all
Description: Control the doors of the club, ja! Description: Control the doors of the club, ja!
Depends: dash, git, python3

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -x
echo "Creating group and users.." echo "Creating group and users.."
groupadd foodoor groupadd foodoor
useradd -M -d /var/lib/foodoor/close -G foodoor -s /bin/sh close useradd -M -d /var/lib/foodoor/close -G foodoor -s /bin/sh close
@ -6,12 +7,16 @@ useradd -M -d /var/lib/foodoor/open -G foodoor -s /bin/sh open
useradd -M -d /var/lib/foodoor/door -G foodoor -s /bin/sh door useradd -M -d /var/lib/foodoor/door -G foodoor -s /bin/sh door
echo "Chown homes" echo "Chown homes"
for u in "close open door"; do for u in close open door; do
chown ${u}:${u} ${u} groupadd ${u}
chown ${u}:${u} /var/lib/foodoor/${u}
done done
echo "Create /state" echo "Create /state"
touch /state touch /state
chgrp root:foodoor /state chown root:foodoor /state
chmod 664 /state chmod 664 /state
systemctl daemon-reload
systemctl enable foodoord
systemctl restart foodoord

View File

@ -16,7 +16,7 @@
# PATH should only include /usr/* if it runs after the mountnfs.sh script # PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="foodoor daemon" DESC="foodoor daemon"
WHERE=$(cat /etc/foodoord.conf | grep 'where' | awk -F '=' '{ print $2 }') WHERE=$(cat /etc/foodoord.conf | grep 'where' | awk -F '=' '{ print $2 }' | tr -d ' ')
NAME=foodoord_${WHERE} NAME=foodoord_${WHERE}
DAEMON=/usr/sbin/$NAME DAEMON=/usr/sbin/$NAME
#DAEMON_ARGS="--options args" #DAEMON_ARGS="--options args"

View File

@ -24,10 +24,10 @@ rm -f ${temp_outfile}
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
valid=false valid=false
keyinfo=$(ssh-keygen -l -f ${keyfile}) # The whole key information keyinfo=$(ssh-keygen -l -f ${keyfile}) # The whole key information
crypto=$(echo "${keyinfo}" | cut -d" " -f4) # Looks like "(RSA)" or "(ED25519)" crypto=$(echo "${keyinfo}" | sed 's/.*(\(.*\))/\1/') # Looks like "RSA" or "ED25519"
key_length=$(echo "${keyinfo}" | cut -d" " -f1) key_length=$(echo "${keyinfo}" | cut -d" " -f1)
if [ "${crypto}" == "(RSA)" ]; then if [ "${crypto}" == "RSA" ]; then
if [ ${key_length} -lt 4096 ]; then if [ ${key_length} -lt 4096 ]; then
echo "Key size of key ${keyfile} not equal to 4096. Not adding it to key database." >&2 echo "Key size of key ${keyfile} not equal to 4096. Not adding it to key database." >&2
@ -36,12 +36,12 @@ rm -f ${temp_outfile}
valid=true valid=true
fi fi
elif [ "${crypto}" == "(ED25519)" ]; then elif [ "${crypto}" == "ED25519" ]; then
valid=true valid=true
fi fi
if [ "$valid" = true ]; then if [ "$valid" = true ]; then
echo "command=\"/usr/sbin/foodoor \$action \",no-port-forwarding,no-X11-forwarding,no-agent-forwarding $(cat ${keyfile})" >> ${temp_outfile} echo "command=\"/usr/sbin/foodoor \$action \",no-port-forwarding,no-X11-forwarding,no-agent-forwarding $(cat ${keyfile} | sed 's/\r//g') ${keyfile}" >> ${temp_outfile}
fi fi
fi fi
done done