Add labs
This commit is contained in:
5
04-mosquitto/lab03/config/mosquitto.conf
Normal file
5
04-mosquitto/lab03/config/mosquitto.conf
Normal file
@ -0,0 +1,5 @@
|
||||
listener 1883
|
||||
|
||||
allow_anonymous false
|
||||
password_file /mosquitto/config/users.txt
|
||||
sys_interval 10
|
||||
2
04-mosquitto/lab03/config/users.txt
Normal file
2
04-mosquitto/lab03/config/users.txt
Normal file
@ -0,0 +1,2 @@
|
||||
thomas:$7$101$+0sf4wma3qzDFw6R$H+lLmGLzo1Ex5rXxZqWxuEFCV7bSsAehEwTJ6XULFberEhwug/EC8aSWtiI4xScYQ2u/0sZ3xCg0rTRaMb5ITg==
|
||||
admin:$7$101$S9wXlrBPl3PFz+9y$l3/GP/FjklfQ2inTxBf4FfLvFR3r5yF6G6ZSRDFRwAklzltZ+xhUWM83PKQjxy2ZFYYmHxMoKs4q1+IMrXL6NA==
|
||||
14
04-mosquitto/lab03/cyberchef/chef.txt
Normal file
14
04-mosquitto/lab03/cyberchef/chef.txt
Normal file
@ -0,0 +1,14 @@
|
||||
Fork('\\n','\\n',false)
|
||||
Register('^([^:]+)',true,false,false)
|
||||
Find_/_Replace({'option':'Regex','string':'^[^:]+:'},'',false,false,false,false)
|
||||
Register('(.*)',true,false,false)
|
||||
Pseudo-Random_Number_Generator(12,'Hex')
|
||||
Register('(.*)',true,false,false)
|
||||
From_Hex('Auto')
|
||||
To_Base64('A-Za-z0-9+/=')
|
||||
Register('([\\s\\S]*)',true,false,false)
|
||||
Find_/_Replace({'option':'Regex','string':'.*'},'$R1',false,false,false,false)
|
||||
Derive_PBKDF2_key({'option':'Latin1','string':'$R1'},512,101,'SHA512',{'option':'Hex','string':'$R2'})
|
||||
From_Hex('Auto')
|
||||
To_Base64('A-Za-z0-9+/=')
|
||||
Find_/_Replace({'option':'Regex','string':'.*'},'$R0:$$7$$101$$$R3$$$&',false,false,false,false)
|
||||
30
04-mosquitto/lab03/cyberchef/receipt.json
Normal file
30
04-mosquitto/lab03/cyberchef/receipt.json
Normal file
@ -0,0 +1,30 @@
|
||||
[
|
||||
{ "op": "Fork",
|
||||
"args": ["\\n", "\\n", false] },
|
||||
{ "op": "Register",
|
||||
"args": ["^([^:]+)", true, false, false] },
|
||||
{ "op": "Find / Replace",
|
||||
"args": [{ "option": "Regex", "string": "^[^:]+:" }, "", false, false, false, false] },
|
||||
{ "op": "Register",
|
||||
"args": ["(.*)", true, false, false] },
|
||||
{ "op": "Pseudo-Random Number Generator",
|
||||
"args": [12, "Hex"] },
|
||||
{ "op": "Register",
|
||||
"args": ["(.*)", true, false, false] },
|
||||
{ "op": "From Hex",
|
||||
"args": ["Auto"] },
|
||||
{ "op": "To Base64",
|
||||
"args": ["A-Za-z0-9+/="] },
|
||||
{ "op": "Register",
|
||||
"args": ["([\\s\\S]*)", true, false, false] },
|
||||
{ "op": "Find / Replace",
|
||||
"args": [{ "option": "Regex", "string": ".*" }, "$R1", false, false, false, false] },
|
||||
{ "op": "Derive PBKDF2 key",
|
||||
"args": [{ "option": "Latin1", "string": "$R1" }, 512, 101, "SHA512", { "option": "Hex", "string": "$R2" }] },
|
||||
{ "op": "From Hex",
|
||||
"args": ["Auto"] },
|
||||
{ "op": "To Base64",
|
||||
"args": ["A-Za-z0-9+/="] },
|
||||
{ "op": "Find / Replace",
|
||||
"args": [{ "option": "Regex", "string": ".*" }, "$R0:$$7$$101$$$R3$$$&", false, false, false, false] }
|
||||
]
|
||||
39
04-mosquitto/lab03/lab.txt
Normal file
39
04-mosquitto/lab03/lab.txt
Normal file
@ -0,0 +1,39 @@
|
||||
= Mosquitto Authentifizierung
|
||||
|
||||
Konfigurieren Sie Mosquitto, so dass nur authentifizierte Clients zugreifen dürfen.
|
||||
|
||||
|
||||
listener 1883
|
||||
|
||||
allow_anonymous false
|
||||
password_file /mosquitto/config/users.txt
|
||||
|
||||
|
||||
|
||||
|
||||
Erzeugen Sie eine Passwortdatei mit mehreren Nutzern.
|
||||
Sie können `mosquitto_passwd` benutzen:
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto sh
|
||||
# mosquitto_passwd -b -c users.txt thomas geheim
|
||||
# mosquitto_passwd -b users.txt admin secret
|
||||
# cat users.txt
|
||||
|
||||
|
||||
Für CyberChef befindet sich ein Rezept im Unterordner `CyberChef` oder
|
||||
der folgende Link kann genutzt werden:
|
||||
"https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn','%5C%5Cn',false)Register('%5E(%5B%5E:%5D%2B)',true,false,false)Find_/_Replace(%7B'option':'Regex','string':'%5E%5B%5E:%5D%2B:'%7D,'',false,false,false,false)Register('(.*)',true,false,false)Pseudo-Random_Number_Generator(12,'Hex')Register('(.*)',true,false,false)From_Hex('Auto')To_Base64('A-Za-z0-9%2B/%3D')Register('(%5B%5C%5Cs%5C%5CS%5D*)',true,false,false)Find_/_Replace(%7B'option':'Regex','string':'.*'%7D,'$R1',false,false,false,false)Derive_PBKDF2_key(%7B'option':'Latin1','string':'$R1'%7D,512,101,'SHA512',%7B'option':'Hex','string':'$R2'%7D)From_Hex('Auto')To_Base64('A-Za-z0-9%2B/%3D')Find_/_Replace(%7B'option':'Regex','string':'.*'%7D,'$R0:$$7$$101$$$R3$$$%26',false,false,false,false)"
|
||||
|
||||
Das Inputformat ist dabei: "user:klartextpasswort"
|
||||
|
||||
|
||||
|
||||
Testen Sie, ob der Zugriff funktioniert
|
||||
|
||||
|
||||
$ docker run --rm -it --init --net host -v $PWD/config:/mosquitto/config eclipse-mosquitto
|
||||
|
||||
$ docker run --rm -it --init --net host eclipse-mosquitto \
|
||||
mosquitto_sub -V 5 --topic "demotopic" \
|
||||
--username admin -P secret -W 2 --debug
|
||||
|
||||
Reference in New Issue
Block a user