Compare commits

..

10 commits
new ... main

Author SHA1 Message Date
4a555dc180
add tnoe, begin home node rewrite 2024-11-22 14:06:33 +01:00
44e490cf46 Update pi-purple/README.md 2024-11-03 03:08:28 +01:00
43cdf9e89f Add tudbutde/README.md 2024-10-26 01:22:35 +02:00
e4ff0363e1 Add pi/tbot.sh 2024-10-26 01:16:48 +02:00
9f3afeaff7 Add pi/wifi 2024-10-26 01:14:17 +02:00
35f5e36888 Add pi/README.md 2024-10-26 01:12:18 +02:00
564fabcd35 Update pi-purple/README.md 2024-10-26 01:05:44 +02:00
641ee9513d Add pi-purple/autorun 2024-10-26 01:04:25 +02:00
9f13fe242d Add pi-purple/README.md 2024-10-26 01:03:21 +02:00
797506ee44 Add autorun.service 2024-10-26 00:59:15 +02:00
20 changed files with 715 additions and 300 deletions

1
.gitignore vendored
View file

@ -1 +0,0 @@
*.local

9
autorun.service Normal file
View file

@ -0,0 +1,9 @@
[Unit]
Description=Autorun service
[Service]
ExecStart=/autorun
Restart=Always
[Install]
WantedBy=multi-user.target

37
init.sh
View file

@ -1,37 +0,0 @@
#!/bin/sh
echo "> Importing signer"
gpg --import signer.pub
gpg --edit-key tudbut@tudbut.de "trust" "quit"
echo done
echo "> Setting up peers"
echo -n "This node: TudbuT.infra."
read name
echo "TudbuT.infra.$name" > name.local
echo -n "Router is TudbuT.infra.router.main? [Y/n] "
read yn
if [ "$yn" != "n" ] ; then
echo "TudbuT.infra.router.main" > router.local
else
echo -n "Router: TudbuT.infra."
read router
echo "TudbuT.infra.$router" > router.local
fi
echo -n "Router lives at domain: "
read domain
echo "$domain" > router.ip.local
echo "All set."
echo "> Setting up GPG"
gpg --gen-key
echo "Please sign:"
gpg --export -a "TudbuT.infra.$name"
echo -n "Enter to confirm"
read
echo "Please give me the signed key:"
gpg --import
echo "Thank you!"
echo "> Done."

22
pi-purple/README.md Normal file
View file

@ -0,0 +1,22 @@
# pi-Purple
This is the host for the following services:
- forge (port 200:http and 222:ssh)
- fedi (port 4000:http->44404)
- matrix (port 6167)
- pad (port 1942)
## Iterations
1. Pi 5 with Raspbian, SD card
2. Pi 5 with Archlinuxarm, NVME drive (current)
## Users
- root -> no services
- tudbut -> ssh login
- git -> forgejo
- git-run -> forgejo-runner
- akkoma -> akkoma
- conduit -> matrix-conduit
- pad -> hedgedoc

16
pi-purple/autorun Normal file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# revpfw3 thread
(
while true; do revpfw3 client tudbut.de 222 localhost 22 _____ ; sleep 5 ; done & disown
while true; do revpfw3 client tudbut.de 200 localhost 8200 _____ ; sleep 5 ; done & disown
while true; do revpfw3 client tudbut.de 6167 localhost 6167 _____ ; sleep 5 ; done & disown
while true; do revpfw3 client tudbut.de 44404 localhost 4000 _____ ; sleep 5 ; done & disown
) > /var/log/autorun.revpfw3.log 2>&1 & disown
sudo chmod a+rw /var/run/docker.sock
for dir in /home/git-run/*/ ; do
sudo -u git-run bash -c "cd $dir; while true ; do forgejo-runner daemon > log 2>&1 ; done" & disown
done
while true; do sleep 60; done

18
pi/README.md Normal file
View file

@ -0,0 +1,18 @@
# TudbuT-Pi
This is the host for the following services:
- data.tudbut.de (port 80:http->81)
- irc (port 6667:irc)
- irc bot (no ports)
## Iterations
1. Pi 3 B+ with Raspbian (wifi.service) ??
2. Pi 3 B with Raspbian (wifi.service)
2. (PLANNED) Pi 3 B with Archlinuxarm (autorun.service)
## Users
- root -> ssh login, irc bot
- www-data -> nginx for data.tudbut.de
- ircd -> inspircd

55
pi/homemgmt.spl Normal file
View file

@ -0,0 +1,55 @@
"#time.spl" import
"home node management" =program-name
def remote, revpfwkey
"revpfw.spl" import
"network.spl" import
"tudbut.de" =remote
"REVPFWKEY" env:get =revpfwkey
func panic-handler { |
}
func main { exitcode | with args ;
"management system starting up." println
"init revpfw subsystem" println
&revpfw-watcher fork
1000 time:sleep;
"init ircbot subsystem" println
&ircbot-watcher fork
1000 time:sleep;
"init network monitor subsystem" println
&network-monitor fork
1000 time:sleep;
}
func watcher { | with statevar update delay ;
while { statevar call =>? [ ^ok &pop ] } {
def sa time:unixms =sa
update call
delay (time:unixms sa -) - dup 0 lt if { pop 0 } time:sleep;
}
:sjson<0> panic
}
func revpfw-watcher { |
[ ^ok ^down ] =revpfw-state
&revpfw-state &revpfw-update watcher<1000>
}
func ircbot-watcher { |
"ircbot -> service disabled" println
1 stop
[ ^ok ^down ] =ircbot-state
&ircbot-state &ircbot-update watcher<1000>
}
func network-monitor { |
[ ^ok ^up ] =network-state
&network-state &network-update watcher<30000>
}

98
pi/tbot.sh Normal file
View file

@ -0,0 +1,98 @@
bgpids="$$"
function msg() {
echo "PRIVMSG $@" >> /tmp/$pid.in
}
pid=$$
rm /tmp/$pid.in /tmp/$pid.out
touch /tmp/$pid.in /tmp/$pid.out
tail -f /tmp/$pid.in | telnet $@ 6667 > /tmp/$pid.out &
tnpid=$!
bgpids="$bgpids $!"
tail -f /tmp/$pid.out | (
# Receiver
while true; do
read -r line
line=$(tr -d "*" <<< "$line")
echo "$line"
IFS=' ' read -ra split <<< "$line"
msg=""
for ((i=3; i<${#split[@]}; i++)) ; do
msg="$msg ${split[$i]}"
done
msg="${msg:2}"
channel="${split[2]}"
echo GOT MSG "$msg" in "$channel"
read -ra cmd <<< "$msg"
for arg in ${cmd[@]} ; do
case "$arg" in http*)
url=$(curl -H 'Content-Type: application/json' -H 'Authorization: Bearer 801fae8344e9c65b112a2acef9bdeeec9335b297' -X POST -d "{\"long_url\":\"$arg\"}" https://api-ssl.bitly.com/v4/shorten)
url=$(sed -E "s/^.*\"link\":\"//" <<< $url | sed -E "s/\".*$//g")
msg $channel ":I shortened that URL for you: $url"
;; esac
done
case "$msg" in
"Nickname is already in use.")
if [ $channel = "URLBot" ] ; then
echo "QUIT :Stopping." >> /tmp/$pid.in
sleep 1
kill $(cat /tmp/$pid.pids) >& /dev/null &
exit 0
fi
;;
"-disconnect")
#echo "QUIT :Stopping." >> /tmp/$pid.in
#sleep 1
#kill $(cat /tmp/$pid.pids) >& /dev/null &
#exit 0
;;
-join\ *)
msg $channel :Joining "${cmd[1]}"
echo "JOIN ${cmd[1]}" >> /tmp/$pid.in
msg "${cmd[1]}" ":This is a bot to shorten URLs on IRC so console users who can't copy/paste can easily access URLs. You can make it leave using -leave, and you can make it rejoin by going to ###urlbot and typing -join #channel."
;;
"-test")
msg $channel 'OK!'
;;
"-sandwich")
msg $channel 'Spaghetti'
;;
"-leave")
if [ "$channel" = '###urlbot' ]; then
msg $channel ':I will not leave the ###urlbot channel.'
else
msg $channel ':Goodbye.'
echo "PART $channel" >> /tmp/$pid.in
fi
;;
"URLBot")
msg $channel ":URLBot commands - They also work in /msg, but the bot won't respond that way."
msg $channel ':-join <channel> : Makes the bot join a channel'
msg $channel ':-test : Makes the bot reply "OK!"'
msg $channel ':-leave : Makes the bot leave this channel'
;;
esac
done
) &
bgpids="$bgpids $!"
(
while kill -0 $pid $tnpid >& /dev/null; do
sleep 20
echo "PONG $@" >> /tmp/$pid.in
done
echo "QUIT Stopping." >> /tmp/$pid.in
sleep 1
kill $(cat /tmp/$pid.pids) >& /dev/null &
exit 0
) &
bgpids="$bgpids $!"
echo "$bgpids" > /tmp/$pid.pids
sleep 2
echo "USER URLBot * * ." >> /tmp/$pid.in
echo "NICK URLBot" >> /tmp/$pid.in
sleep 2
echo "JOIN ###urlbot" >> /tmp/$pid.in
while true; do sleep 1; done

124
pi/wifi Normal file
View file

@ -0,0 +1,124 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: wificonn
# Required-Start: wpa_supplicant dhclient
# Required-Stop: wpa_supplicant dhclient
# Default-Start: 0 1 2 3 4 5 6
# Default-Stop:
# Short-Description: Start wificonn
# Description: Start wificonn
### END INIT INFO
# -> /etc/init.d/wifi
# to be replaced by architecture similar to pi-purple
# wificonn STARTER
case "$1" in
"start")
# Ensure junk from previous instances is gone!
sleep 10
killall revpfw3 ssh
kill -0 $(cat /etc/serverpid) && sleep 60 && exit 20
echo -n "$$" > /etc/serverpid
# Start a thread to make sure the internet connectivity is NEVER lost!
(
OFF=0
while true; do
# Wait 0.5 minutes
sleep 300
if killall -0 revpfw3 > /dev/null 2>&1 ; then
OFF=0
else
if [[ $OFF = 1 ]] ; then
reboot
fi
#OFF=1
fi
done
) &
echo -n " $!" >> /etc/serverpid
(
OFF=0
while true; do
# Wait 0.5 minutes
sleep 300
if ping -c 1 tudbut.de > /dev/null 2>&1 ; then
OFF=0
else
if [[ $OFF = 1 ]] ; then
reboot
fi
OFF=1
fi
done
) &
echo -n " $!" >> /etc/serverpid
# no dont do that
## # Start wificonn service
## /bin/wificonn
# start dhclient instead
#(cd $(cat /etc/server_dir); while true; do java -jar $(cat /etc/server_jar); done) &
# Wait 5 seconds
sleep 5
# Start a thread to make sure the important portfws are running
(
while true ; do
echo Starting remote revpfw
echo "echo STARTING; killall revpfw3 && echo KILLED; sleep 2" | ssh -o StrictHostKeyChecking=no root@tudbut.de
#echo "cd server ; revpfw3 server 25565 _____ & echo STARTED MCS" | ssh -o StrictHostKeyChecking=no root@tudbut.de &
echo "cd server ; revpfw3 server 23 _____ & echo STARTED SSH" | ssh -o StrictHostKeyChecking=no root@tudbut.de &
echo "cd server ; revpfw3 server 81 _____ & echo STARTED WEB" | ssh -o StrictHostKeyChecking=no root@tudbut.de &
echo "cd server ; revpfw3 server 6667 _____ & echo STARTED IRC" | ssh -o StrictHostKeyChecking=no root@tudbut.de &
echo Wait 5 seconds for the portfw servers to start up
sleep 5
echo Connect to portfw servers
#revpfw3 client tudbut.de 25565 localhost 25565 _____ &
#PID1="$!"
PID1=1
revpfw3 client tudbut.de 23 localhost 22 _____ &
PID2="$!"
revpfw3 client tudbut.de 81 localhost 80 _____ &
PID3="$!"
revpfw3 client tudbut.de 6667 localhost 6667 _____ &
PID4="$!"
echo Wait 3 seconds for the connections to form
sleep 3
echo Start the IRC bots
ircbots
echo Wait 0.5 seconds for the IRC bots to start up
sleep 0.5
# Ensure all services are running
while kill -0 $PID1 && kill -0 $PID2 && kill -0 $PID3 && kill -0 $PID4 ; do
# Wait 1 second to not stress CPU too much
sleep 1
done
# Wait 1 second
sleep 1
kill $PID2 $PID3 $PID4 # $PID1
done
) &
echo -n " $!" >> /etc/serverpid
# bash -c 'cd ~www/cooking && python3 -m http.server 6003' &
# while true; do revpfw3 client 8b8t.xyz 6003 localhost 6003 _____ ; sleep 3 ; done &
#sleep 30
#discordirc
while true; do sleep 10; done
;;
"stop")
killall revpfw3
# Wait 2 seconds
sleep 1
kill $(cat /etc/serverpid)
sleep 5
killall -9 revpfw3
kill -9 $(cat /etc/serverpid)
killall /etc/init.d/wifi
;;
esac & disown

View file

@ -1,5 +0,0 @@
#!/bin/sh
name=$(cat name.local)
echo key
gpg --export -a "$name"

View file

@ -1,20 +0,0 @@
#!/bin/sh
read todo
if [ "$todo" = "" ] ; then
exit
fi
if [ "$todo" = "push" ] ; then
read filename
cat > "$filename"
exit
fi
if [ "$todo" = "exec" ] ; then
read command
exec bash -c "$command"
fi
echo "invalid command: $todo"

View file

@ -1,6 +0,0 @@
#!/bin/bash
data="$(bash verify.sh)"
c=$?
if [ $c != 0 ] ; then exit $c ; fi
bash read-msg.sh <<< "$data" || exit 1

View file

@ -1,5 +0,0 @@
#!/bin/sh
name=$(cat name.local)
echo data
gpg --local-user "$name" --sign -a

View file

@ -1,195 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBGOoOXcBDADSxtI1k1sUmbLOW7mxpFqS9lX6Sp+kZF10Hxf6eACKNz3q9YZJ
cYajTyioEiMjVCNQibg0TiTg9nmUvviqHMto4QIvWluiFFQ6KLQTmapZ88ugXHkv
IndLB/xKdGuQlqu8Q2N+vow661A5eJGzqtKdU1VvTIaNaNN7zYhAlMj1pTEuCQf/
W5Ure2xxUTEl+clL3QvA2FLbcHtHBVI+toSyKirEw2eBhGhZQOI+tNjKZ60vGs8C
AtIOQ6ZkUIEsYSFXVFo3UFnTK1VQgdS/EqlW6dCYU0+BJicea/6sksfMMZGlBh24
rmiAokbzMlPOuLcwLRms6EmB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HdVlsPxltxfaT5hlwgpmO/4Aq1zoxQdXdR
s8iJ+P6k3h5NhFsLOPB8zt7WrWUjimCialB7HHSZCUzUf/kKgLT150OQ+R0dFYKl
H8QocRbccRDrC37H7a/mI+BEKthFtECy4zzDBd2eu04seexSkgxgBAhkZmmhl3Nr
hoKLtAJNMhI9taCFKurnFS/02caVuE2BFCUHZ8fJzC3TsDzLt81dETv70AnfVXL6
Qy080xgwNBFcyhzzINeZ+YMj8rH8HV7sUiPUSHJGtn/K9vjEJzCCvog=
=/9qg
-----END PGP PUBLIC KEY BLOCK-----

21
tnoe/tnoegatherer.spl Normal file
View file

@ -0,0 +1,21 @@
"#httpserver/base.spl" import
func main { exitcode | with args ;
def server
net:http:Server:new<"::0" 4000> =server
"Started listening on ::0:4000" println
"ip a:" println
[ "ip" "a" ] command-wait;
while { 1 } {
server:accept
dup :read
dup :path println
dup :body _str println
:write-ok:write-str-body<"">:finish;
}
0
}

194
tnoe/tnoemgmt.spl Normal file
View file

@ -0,0 +1,194 @@
"#stream.spl" import
"#time.spl" import
"#json.spl" import
def state, network, connections
[ ^bring-up ] =state
"johlg" =network
6 =connections
include json:_StringyJSON in array
func panic-handler { |
catch IO {
"status" StreamTypes:file:create<1>
dup :write-exact<[ ^dead [ ^panic ] ] :sjson<0> "\n" concat :to-bytes>
:close;
} { with e ;
"fuck.";
}
}
func main { exitcode | with args ;
start-timer =>? ^ok not if {
"error " print :sjson<0> print " in state: " state:sjson<0> concat println
"error in timers" panic
}
0
}
func start-timer { result |
def sa time:unixms =sa
1 while { } {
1000 time:unixms sa - - dup 0 lt if { pop 0 } time:sleep;
time:unixms =sa
def v
timer-run
dup :sjson<0>
dup println
=v
catch IO {
"status" StreamTypes:file:create<1>
dup :write-exact<v "\n" concat :to-bytes>
:close;
} {
[ ^err "no fs access" "status" ] 3 stop
}
dup => [ ^reboot &=v ] if {
"" println
"reboot requested because " v concat "." concat println
catch IO {
"deny-reboot" read-file "no" eq not if {
"reboot denied because deny-reboot is set. need manual help"
pop [ ^err "reboot denied" ] 3 stop
}
} { pop }
catch IO {
"deny-reboot" StreamTypes:file:create<1>
dup :write-exact<"yes" :to-bytes>
:close;
} {
[ ^err "no fs access" "deny-reboot" ] 3 stop
}
while { 1 } {
fork<|
"status" StreamTypes:file:create<1>
dup :write-exact<[ ^dead v ] :sjson<0> "\n" concat :to-bytes>
:close;
catch {
[ "sudo" "reboot" ] command-wait;
} { pop }
>
5000 time:sleep;
}
}
=>? [ ^ok &pop ]
}
}
func timer-run { result |
def wait-time
device-present not if {
[ ^reboot "device not present" ]
2 stop
}
state => [ ^fix-device ] if {
fix-device
2 stop
}
state => [ ^bring-up ] if {
switch-networks =>? [ ^err "nmcli failed" ] if {
[ ^fix-device ] =state
[ ^ok state ] 3 stop
} dup => [ ^ok &pop ] if {
3 stop
}
}
is-network-up not if {
[ ^bring-up ] =state
[ ^ok state ] 2 stop
}
state => [ ^waiting &=wait-time ] if {
wait-time 0 eq if {
[ ^bring-up ] =state
[ ^ok state ] 3 stop
}
[ ^waiting wait-time 1 - ] =state
[ ^ok state ] 2 stop
}
state => [ ^connecting &=wait-time ] if {
is-network-up if {
[ ^waiting 60 20 * ] =state
catch IO {
"deny-reboot" StreamTypes:file:create<1>
dup :write-exact<"no" :to-bytes>
:close;
} {
[ ^err "no fs access" "deny-reboot" ] 4 stop
}
[ ^ok ^connected ] 3 stop
}
wait-time 0 eq if {
[ ^bring-up ] =state
[ ^ok state ] 3 stop
}
[ ^connecting wait-time -- ] =state
[ ^ok state ] 2 stop
}
[ ^err "unknown state" state ]
}
func switch-networks { result |
[ ^connecting 10 ] =state
def b
random-byte =>? [ ^ok &=b ] not if { 2 stop }
b connections % =b
def conn, hostname
network b _str concat =conn
conn "-hostname" concat read-file :replace<"\n" ""> =hostname
"connecting to " conn concat " with hostname " concat hostname concat println
[ "sudo" "hostnamectl" "set-hostname" hostname ] command-wait
[ "sudo" "nmcli" "c" "up" conn ] command-wait or
if {
[ ^err "nmcli failed" ] 2 stop
}
[ ^ok ^connected ]
}
func device-present { bool |
[ "lsusb" ] StreamTypes:cmd:create
dup :read-to-end<1024>:to-str
dup :contains<"0bda:c811"> swap:contains<"0bda:1a2b"> or swap
:close
}
func fix-device { result |
[ ^bring-up ] =state
[ "sudo" "usb_modeswitch" "-v" "0bda" "-p" "1a2b" "-K" ] command-wait;
[ ^ok ^fixing-device ]
}
func is-network-up { |
def done 0 =done
fork<| 1000 time:sleep; done not if { "ping unsuccessful" println [ "killall" "ping" ] command-wait; } >
[ "ping" "-c" "1" "1.1.1.1" ] command-wait 0 _int eq
1 =done
}
func random-byte { [result,byte] |
catch IO {
def b
"/dev/urandom" StreamTypes:file:create<0>
dup :read-one =b
:close;
[ ^ok b ]
} { with err ;
[ ^err err ]
}
}

107
tnoe/tnoescan-masscan.spl Normal file
View file

@ -0,0 +1,107 @@
"#time.spl" import
"#stream.spl" import
"#json.spl" import
include json:_StringyJSON in array
include json:_StringyJSON in str
func main { exitcode | with args ;
"scanning network " print args:2 println
def nmap
[ "sudo" "masscan" "--rate" "1000" "--ping" "--wait" "2" args:2 ] StreamTypes:cmd:create =nmap
nmap:read-to-end<1024> _str =nmap
nmap:split<"\n">:iter =nmap
def records, line
[ ] =records
while { nmap:next dup =line } {
line:readf1<"Discovered open port 0/icmp on {} {}"> => &=line if {
line awrap records swap aadd =records
2 stop
}
} pop
"IPs: " println
records:foreach<| ("IP: " print) :sjson println>
"waiting..." println
3000 time:sleep;
"grabbing MACs+Hostnames" println
def i 0 =i
def newrecords
[ ] =newrecords
def running [ 0 0 0 0 0 ] =running
while { i records:len lt } {
"task " print i println
while { running:contains<0> not } {
500 time:sleep;
}
running:find<0 awrap> i fork<| with id i ;
1 id running:set;
def done [ ] =done
def nmap, out, line, ip, hostname
[ "sudo" "nmap" "-T4" "-sn" records:get<i> ] StreamTypes:cmd:create =nmap
nmap:read-to-end<1024> _str =out
[ "sudo" "nmap" "-sn" "-Pn" records:get<i> ] StreamTypes:cmd:create =nmap
out nmap:read-to-end<1024> _str concat =nmap
func submit { | with mac ;
0 done:foreach<| ip eq if { pop 1 }> not if {
done ip awrap aadd =done
newrecords [ ip hostname mac ] awrap aadd =newrecords
}
null =ip
}
nmap:split<"\n">:iter =nmap
while { nmap:next dup =line } {
line:readf<"Nmap scan report for {} ({})"> => &=line if {
ip null eq not if {
"?" submit
}
line:0 =hostname
line:1 =ip
2 stop
}
line:readf1<"Nmap scan report for {}"> => &=ip if {
"?" =hostname
2 stop
}
line:readf1<"MAC Address: {} ({})"> => &=line if {
line submit
2 stop
}
} pop
ip null eq not hostname "?" eq not and if {
"?" submit
}
0 id running:set;
> pop pop
100 time:sleep;
i ++ =i
}
while { running:contains<1> } {
500 time:sleep;
}
newrecords:foreach<| ("Record: " print) :sjson println>
"Success rate: " print newrecords:len _float records:len _float / 100 _float * print "%" println
0
}
func min { min(a,b) | with a b ;
a
a b gt if {
pop b
}
}

32
tnoe/tnoescan.spl Normal file
View file

@ -0,0 +1,32 @@
"#stream.spl" import
"#json.spl" import
include json:_StringyJSON in array
func main { exitcode | with args ;
"scanning network " print args:2 println
def nmap
[ "sudo" "nmap" "-T5" "-sn" args:2 ] StreamTypes:cmd:create =nmap
nmap:read-to-end<1024> _str =nmap
nmap:split<"\n">:iter =nmap
def records, hostname, ip, line
[ ] =records
while { nmap:next dup =line } {
line:readf<"Nmap scan report for {} ({})"> => [ &=hostname &=ip ] if {
2 stop
} pop
line:readf1<"Nmap scan report for {}"> => &=ip if {
"?" =hostname
2 stop
} pop
line:readf1<"MAC Address: {} ({})"> => &=line if {
records [ ip hostname line ] awrap aadd =records
2 stop
} pop
} pop
records:foreach<| :sjson println>
0
}

19
tudbutde/README.md Normal file
View file

@ -0,0 +1,19 @@
# tudbutde
This is the host for the following services:
- baseband-J
- baseband-SPL (download.baseband.com.de)
- baseband-website (baseband.com.de)
- web-Tryumph (tudbut.de)
- TudbuTAPIv3 (????)
- qft helper
- caddy
## Iterations
1. IONOS VPS S (10GB disk) with ubuntu
2. IONOS VPS S+ (20GB disk) with ubuntu
## Users
- root -> all services

View file

@ -1,31 +0,0 @@
#!/bin/sh
read mode
if [ "$mode" = "key" ] ; then
output="$( (exec gpg --import > /dev/null) 2>&1 )"
if [ "$?" = 0 ] ; then
echo recv ok > /dev/stderr
else
echo recv bad > /dev/stderr
exit 1
fi
exit
fi
if [ "$mode" = "data" ] ; then
id=$!
stderr="$( (exec gpg -d > /tmp/$id.msg) 2>&1 )"
if [ $? = 0 ] && ! grep "WARNING" <<< "$stderr" > /dev/null ; then
echo recv sig ok > /dev/stderr
else
echo recv sig bad > /dev/stderr
exit 1
fi
cat /tmp/$id.msg
exit
fi