1. Organisatorisches

  • Vortragender: Klaus Knopper

  • Datum: 26.9.-28.9.2022

  • Ort: Sperlhof, Windischgarsten

2. Anbindung an RPi über Serial Port

  • siehe Skript.pdf, S. 81

  • Mike’s PBX Cookbook - Mac’s and serial TTY’s

  • zu kaufen bei amazon

  • Installation:

    • Man braucht keine Treiber

    • Man muss keine Software installieren

    • es reicht das Programm screen

    • Man sucht im /dev-Verzeichnis nach einem cu.-Port

      ❯ l
      total 13
      dr-xr-xr-x   4 root    wheel           5.9K Sep 14 19:53 .
      drwxr-xr-x  20 root    wheel           640B Aug 24 10:59 ..
      crw-rw-rw-   1 root    wheel     0x1d000000 Sep 14 19:53 aes_0
      crw-------   1 root    wheel     0x16000001 Sep 20 21:41 afsc_type5
      brw-------   1 root    operator   0x2000000 Sep 26 09:31 apfs-raw-device.2.0
      crw-------   1 root    wheel      0xb000000 Sep 14 19:53 auditpipe
      crw-r--r--   1 root    wheel      0xa000003 Sep 14 19:53 auditsessions
      crw-------   1 root    wheel     0x1f000000 Sep 14 19:53 autofs
      crw-------   1 root    wheel     0x23000000 Sep 14 19:53 autofs_control
      crw-rw-rw-   1 root    wheel     0x2200010c Sep 14 19:53 autofs_homedirmounter
      crw-rw-rw-   1 root    wheel     0x2100010c Sep 14 19:53 autofs_notrigger
      crw-rw-rw-   1 root    wheel     0x2000b278 Sep 14 19:53 autofs_nowait
      crw-------   1 root    wheel     0x17000000 Sep 14 19:53 bpf0
      crw-------   1 root    wheel     0x17000001 Sep 26 09:30 bpf1
      crw-------   1 root    wheel     0x17000002 Sep 26 09:23 bpf2
      crw-------   1 root    wheel     0x17000003 Sep 14 19:53 bpf3
      crw-------   1 stuetz  staff              0 Sep 16 14:18 console
      crw-rw-rw-   1 root    wheel      0x9000003 Sep 14 19:53 cu.Bluetooth-Incoming-Port
      crw-rw-rw-   1 root    wheel      0x9000001 Sep 14 19:53 cu.BoseRevolveIISoundLink
      crw-rw-rw-   1 root    wheel      0x9000005 Sep 26 10:41 cu.usbserial-1210
      brw-r-----   1 root    operator   0x1000000 Sep 14 19:53 disk0
      brw-r-----   1 root    operator   0x1000001 Sep 14 19:53 disk0s1
      brw-r-----   1 root    operator   0x1000002 Sep 14 19:53 disk0s2
      brw-r-----   1 root    operator   0x1000003 Sep 14 19:53 disk0s3
      brw-r-----   1 root    operator   0x1000004 Sep 14 19:53 disk1
      brw-r-----   1 root    operator   0x1000005 Sep 14 19:53 disk1s1
      brw-r-----   1 root    operator   0x1000006 Sep 14 19:53 disk1s2
      brw-r-----   1 root    operator   0x1000007 Sep 14 19:53 disk1s3
      brw-r-----   1 root    operator   0x1000008 Sep 14 19:53 disk1s4
      brw-r-----   1 root    operator   0x1000009 Sep 14 19:53 disk2
      brw-r-----   1 root    operator   0x100000a Sep 14 19:53 disk2s1
      ...
  • Hier sieht man den Port cu.usbserial-1210

  • Daher verwendet man

    screen cu.usbserial-1210 115200`

2.1. Pin-Belegung

rpi pins serial port
Das rote Kabel wurde entfernt, da dieses die Stromversorgung ist und den RPi zerstören würde
Farbe Pin Rpi

schwarz

GND

weiß

GPIO 14 (TXD)

grün

GPIO 15 (RD)

gpio pinout diagram
Figure 1. Quelle: GPIO and the 40-pin Header
Details

2.2. USB-Port Einstellungen auslesen

lsusb -v | less

3. PGP

3.1. Download eines Zertifikats

  • Greift man auf eine Website zu, deren Zertifikat man nicht hat, dann kann man diese downloaden und im Browser hinterlegen

potential security risk 1
potential security risk 2
potential security risk 3
potential security risk 4
  • PEM (chain) downloaden

3.2. Importieren eines Zertifikats

import certificates 1

import certificates 2

import certificates 3

import certificates 4

  • Leider funktioniert es beim Mozilla nicht, da diese self-signed-certificates nicht akzeptiert.

4. GPG Key erzeugen

  • GPG wird eher zur Punkt-zur-Punkt Verschlüsselung verwendet

  • ansonsten ehe SSL (siehe Skript S.83ff)

gpg --full-generate-key
  • Grundsätzlich default-Werte auswählen

  • allerdings sollte man ein expire date eingeben

  • Die Schlüssel sind im Verzeichnis .gnupg

pi@raspberrypi:~ $ gpg --full-generate-key
gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
  (14) Existing key from card
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072)
Requested keysize is 3072 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: Thomas Stuetz
Email address: thomas.stuetz@nomail.com
Comment:
You selected this USER-ID:
    "Thomas Stuetz <thomas.stuetz@nomail.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: /home/pi/.gnupg/trustdb.gpg: trustdb created
gpg: key E473811AF29114BC marked as ultimately trusted
gpg: directory '/home/pi/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/home/pi/.gnupg/openpgp-revocs.d/75FF34D512D4F5262531BB32E473811AF29114BC.rev'
public and secret key created and signed.

pub   rsa3072 2022-09-26 [SC]
      75FF34D512D4F5262531BB32E473811AF29114BC
uid                      Thomas Stuetz <thomas.stuetz@nomail.com>
sub   rsa3072 2022-09-26 [E]

4.1. Ansehen des private keys

gpg --export-secret-keys -a
output
-----BEGIN PGP PRIVATE KEY BLOCK-----

lQWGBGMxn8wBDADhUJzfDBWaXl/UXC16NpC3PTIBxdqfdjNoV+lv0oH699Vk2jse
d00byp8dyW4hEdDGkcIQD9l8BWwl90J/PC2MKYSYWIvNbRoMpXhJJT5KjopcQFAk
...
f29zLrpRTfsgH3bfdpyhbtquqZVjRlKAXVRtdmeteuVQ75i3A9GYviIY5dmSPpn0
8SSeltYaead94dCVZwN8V590xZ/aUgVg42JkaCsoSmxqMnO5ClvXPcYwSnabsx+z
M0hf55MI4jFjbDgl4c2y3qmcqy9oGBWS1+ORRWJerz9exyEgiyY=
=XiIE
-----END PGP PRIVATE KEY BLOCK-----
  • -a für Ausgabe als ASCII-Text

4.2. Import eines pgp keys

gpg --import < datei.txt

oder

gpg --import
  • mit Copy-Paste Key einfügen

4.3. Auflisten aller keys

gpg --list-keys
output
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
/home/pi/.gnupg/pubring.kbx
---------------------------
pub   rsa3072 2022-09-26 [SC]
      75FF34D512D4F5262531BB32E473811AF29114BC
uid           [ultimate] Thomas Stuetz <thomas.stuetz@nomail.com>
sub   rsa3072 2022-09-26 [E]

4.4. Public Key auf Keyserver hochladen

siehe Skript
gpg --keyserver ...

4.5. Datei verschlüsseln

  • Skript S.84

gpg --encrypt -a -r thomas.stuetz@nomail.com hallo.txt
  • man braucht die Passphrase nicht, da mit dem Public Key verschlüsselt wird

  • eine Datei hallo.txt.asc wird erstellt

cat hallo.txt.asc
-----BEGIN PGP MESSAGE-----

hQGMA0OH9tFlXeihAQv/QmSXb6nqilkKr8sJADpaxVNBbji0CdXG6Jz62oGlEb36
TA1CKEF+sd9hak0mvitBv4vkFosFtV8M8cqoOPz/etiLpxf/totjRzifLpxuOpdy
FDKSXULTWZ171eqG63jZTmvNb392Lr87HyFKAUXhL7TSvz/c8226ahkEEg9Hykkc
knGQ5fJ08zpKLf0zFgQB6tIXAKJhvB5dIxPkoAvUbFsNUeaxVpW9sH+NhDexfPLg
szulTtmqCX5RxQAoOKV51qeubccfhluWKxzRyChNf5PQlWptlJOSr+9pso/mCtxK
/QkRsGLa1Cy6CK7dSxomV92OgCoMaPk2LQ8GKp0Q8PkgEzlTHQp7txyrOKWltuQz
gSWo7VMyY1UIRic9G0p6jcXua15jKT4Wgk6GKnQVjTMsIP91kXDHq6EqT/kS3hZ6
XTjZIlhP0OJOV6OAJWE/bRt/2ewvr6qZiZ7Ef9m6YUoeVEaY1HgaYhQBJUmAGwja
gddbIF+uzDFS7ixzYAfb0sAzAQpuSklFevNjsmt20N53dEknJEZfGGD7C3m3Vbe3
nab55HF3ag5j/YCkAJtxwOCGpwuL/4mFTke6VtFkflVTJ0IExGAMXP2v9i2unmnz
pP3kWZxl9iONk5vnU5N4aDwcV1sVIOCJ7jZqUD3woehEkPgoiBpFZn7ncBg5RXsV
yui4yMdEm3rwtsTJzqtUpdsBu+jKAcTJudRCgNWNOsb6WhsEs0Wf7GHhK7XSMFTF
RCcbbjgOwmu2LvAWpgb+Qeb6uczSkzn421P4zZw2F0u3XTL6D44rdCaDzJygP/K6
+14TvIuJ3QYNDW/MsuFIVA80jdpS
=R11z
-----END PGP MESSAGE-----
gpg --decrypt -o hallo-neu.txt hallo.txt.asc
  • Passphrase eingeben

  • mit cat hallo-neu.txt ansehen

4.6. Trust Level

  • es gibt mehrere Trust-Level

    • Ultimate bedeutet, dass ich ihm voll vertraue und dass

5. OpenSSL

  • Skript S. 85ff

openssl req -new -x509 -days 365 -nodes -out ssl.cert -keyout ssl.key
output mit Eingabe der Parameter
...............+++++
.............+++++
writing new private key to 'ssl.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:AT
State or Province Name (full name) [Some-State]:Oberösterreich
Locality Name (eg, city) []:Windischgarsten
Organization Name (eg, company) [Internet Widgits Pty Ltd]:High Security Class
Organizational Unit Name (eg, section) []:IT Kurs
Common Name (e.g. server FQDN or YOUR name) []:Thomas Stütz
Email Address []:thomas.stuetz@nomail.com
ls -l ssl*
output
-rw-r--r-- 1 pi pi 1554 Sep 26 16:47 ssl.cert
-rw------- 1 pi pi 1704 Sep 26 16:45 ssl.key
Skript S. 86
openssl x509 -text -in ssl.cert
output
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            13:59:5a:22:0d:a3:79:7a:ee:3c:01:95:8f:2f:40:09:0a:22:aa:2e
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C = AT, ST = Ober\C3\83\C2\B6sterreich, L = Windischgarsten, O = High Security Class, OU = IT Kurs, CN = Thomas St\C3\83\C2\BCtz, emailAddress = thomas.stuetz@nomail.com
        Validity
            Not Before: Sep 26 14:47:08 2022 GMT
            Not After : Sep 26 14:47:08 2023 GMT
        Subject: C = AT, ST = Ober\C3\83\C2\B6sterreich, L = Windischgarsten, O = High Security Class, OU = IT Kurs, CN = Thomas St\C3\83\C2\BCtz, emailAddress = thomas.stuetz@nomail.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (2048 bit)
                Modulus:
                    00:d9:a9:58:12:63:ef:3e:6b:ea:ec:c3:3a:50:a4:
                    b0:ee:ba:9f:35:95:ed:6a:46:73:44:55:95:39:52:
                    8f:67:17:75:5f:95:c9:46:d0:a7:43:16:ff:22:b0:
                    88:f3:f7:52:3a:52:0c:d4:49:4d:53:a4:df:00:ca:
                    2c:d0:23:56:97:be:32:9a:89:05:1c:85:cb:34:f8:
                    18:f7:e3:b9:97:1c:5c:81:bc:d5:b6:53:b5:b2:14:
                    e9:b8:2f:75:f2:19:5f:91:a4:06:8f:af:d4:3c:0e:
                    3f:10:37:6c:28:21:77:5d:8c:d7:a8:05:53:6b:b0:
                    2e:fe:d0:fe:01:09:29:57:82:14:7c:a7:de:d5:6e:
                    82:f3:11:82:0d:1b:5a:90:80:b9:72:f7:69:72:2c:
                    da:5f:c9:3b:e9:78:e6:e6:78:ea:a6:df:3c:f7:d2:
                    1e:35:7d:73:d0:20:f9:5a:7f:c2:22:b9:8a:5f:f3:
                    ee:d3:08:ce:b8:c1:36:3b:fe:ba:a8:ea:dd:1d:2e:
                    35:e6:ac:78:81:b0:ae:4c:76:da:04:50:84:1b:3c:
                    5f:4f:46:ea:94:3a:db:8f:23:5c:7b:4c:53:72:d1:
                    6b:dd:6c:e8:cb:eb:cb:a0:f6:d2:49:95:e2:1a:33:
                    3d:98:70:cd:7c:a0:43:6f:d2:6e:9c:0d:c8:f6:88:
                    20:7f
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                6D:07:E2:E5:86:10:CF:A4:5A:E5:E2:71:13:52:E5:AB:A4:FF:40:38
            X509v3 Authority Key Identifier:
                keyid:6D:07:E2:E5:86:10:CF:A4:5A:E5:E2:71:13:52:E5:AB:A4:FF:40:38

            X509v3 Basic Constraints: critical
                CA:TRUE
    Signature Algorithm: sha256WithRSAEncryption
         ab:f4:ca:1e:7c:7a:1d:f9:7c:96:12:82:1c:cc:46:6c:80:fb:
         ef:61:81:b0:34:b1:fc:91:30:67:f5:e3:60:62:2e:67:33:3f:
         51:82:03:31:43:9c:fc:15:72:ad:15:1f:37:86:ce:64:e0:14:
         e2:ab:9a:6e:4a:21:5c:d0:f0:50:a3:6c:62:22:21:b0:ea:6f:
         7d:3c:2b:58:03:28:e0:05:b1:7b:83:1f:f6:70:29:12:a8:84:
         49:14:5f:32:63:2d:12:0a:7f:0a:02:72:1c:59:49:dc:cc:98:
         c7:84:9d:8a:76:c4:d6:e2:45:ca:6e:56:a0:9f:a7:d5:43:3d:
         49:fc:d9:46:3c:64:94:b2:19:ed:96:4e:d3:c4:1f:fd:05:9d:
         43:9f:d4:9f:10:ad:53:69:f6:d1:44:78:7a:60:0a:90:a6:d7:
         f4:af:85:3a:4c:86:fc:4d:e2:47:bf:e6:85:7e:61:fb:1b:48:
         da:52:97:69:0b:cc:9e:3a:58:75:78:24:d9:b4:e2:d4:77:92:
         fc:99:b7:60:b5:a0:27:fc:11:c8:0d:20:94:16:c9:7a:fb:0e:
         4e:8c:58:95:84:dc:b6:6d:65:34:b7:7f:a5:2f:63:fe:b4:df:
         17:d0:c4:f6:55:c0:0e:b8:45:97:24:66:05:31:83:77:73:0a:
         9f:08:fa:9f
-----BEGIN CERTIFICATE-----
MIIETzCCAzegAwIBAgIUE1laIg2jeXruPAGVjy9ACQoiqi4wDQYJKoZIhvcNAQEL
BQAwgbYxCzAJBgNVBAYTAkFUMRowGAYDVQQIDBFPYmVyw4PCtnN0ZXJyZWljaDEY
MBYGA1UEBwwPV2luZGlzY2hnYXJzdGVuMRwwGgYDVQQKDBNIaWdoIFNlY3VyaXR5
IENsYXNzMRAwDgYDVQQLDAdJVCBLdXJzMRgwFgYDVQQDDA9UaG9tYXMgU3TDg8K8
dHoxJzAlBgkqhkiG9w0BCQEWGHRob21hcy5zdHVldHpAbm9tYWlsLmNvbTAeFw0y
MjA5MjYxNDQ3MDhaFw0yMzA5MjYxNDQ3MDhaMIG2MQswCQYDVQQGEwJBVDEaMBgG
A1UECAwRT2JlcsODwrZzdGVycmVpY2gxGDAWBgNVBAcMD1dpbmRpc2NoZ2Fyc3Rl
bjEcMBoGA1UECgwTSGlnaCBTZWN1cml0eSBDbGFzczEQMA4GA1UECwwHSVQgS3Vy
czEYMBYGA1UEAwwPVGhvbWFzIFN0w4PCvHR6MScwJQYJKoZIhvcNAQkBFhh0aG9t
YXMuc3R1ZXR6QG5vbWFpbC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQDZqVgSY+8+a+rswzpQpLDuup81le1qRnNEVZU5Uo9nF3VflclG0KdDFv8i
sIjz91I6UgzUSU1TpN8AyizQI1aXvjKaiQUchcs0+Bj347mXHFyBvNW2U7WyFOm4
L3XyGV+RpAaPr9Q8Dj8QN2woIXddjNeoBVNrsC7+0P4BCSlXghR8p97VboLzEYIN
G1qQgLly92lyLNpfyTvpeObmeOqm3zz30h41fXPQIPlaf8IiuYpf8+7TCM64wTY7
/rqo6t0dLjXmrHiBsK5MdtoEUIQbPF9PRuqUOtuPI1x7TFNy0WvdbOjL68ug9tJJ
leIaMz2YcM18oENv0m6cDcj2iCB/AgMBAAGjUzBRMB0GA1UdDgQWBBRtB+LlhhDP
pFrl4nETUuWrpP9AODAfBgNVHSMEGDAWgBRtB+LlhhDPpFrl4nETUuWrpP9AODAP
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCr9MoefHod+XyWEoIc
zEZsgPvvYYGwNLH8kTBn9eNgYi5nMz9RggMxQ5z8FXKtFR83hs5k4BTiq5puSiFc
0PBQo2xiIiGw6m99PCtYAyjgBbF7gx/2cCkSqIRJFF8yYy0SCn8KAnIcWUnczJjH
hJ2KdsTW4kXKblagn6fVQz1J/NlGPGSUshntlk7TxB/9BZ1Dn9SfEK1TafbRRHh6
YAqQptf0r4U6TIb8TeJHv+aFfmH7G0jaUpdpC8yeOlh1eCTZtOLUd5L8mbdgtaAn
/BHIDSCUFsl6+w5OjFiVhNy2bWU0t3+lL2P+tN8X0MT2VcAOuEWXJGYFMYN3cwqf
CPqf
-----END CERTIFICATE-----
openssl help
openssl pkcs12 -export -out datei.p12 -inkey ssl.key -in ssl.cert -name "Thomas Stuetz"
output
Enter Export Password:
Verifying - Enter Export Password:
  • ein .p12 - File wird erstellt

  • Damit kann

ls -l
output
total 24
-rw------- 1 pi pi 2792 Sep 26 16:58 datei.p12
-rw-r--r-- 1 pi pi  226 Sep 26 15:16 hallo.txt
-rw-r--r-- 1 pi pi 1554 Sep 26 16:47 ssl.cert
-rw------- 1 pi pi 1704 Sep 26 16:45 ssl.key
-rwxr-xr-x 1 pi pi  226 Sep 26 05:53 startopenvas.sh
-rw-r--r-- 1 pi pi  935 Sep 26 15:14 startopenvas.sh.asc
Infos über beliebige Server
openssl s_client -connect 10.0.0.13:443

oder zB

openssl s_client -connect ebay.de:443

5.1. Mini-Webserver mit openssl

sudo openssl s_server -key www.key -cert www.cert -accept 443 -WWW

-WWW …​ damit man die Files aus dem aktuellen Verzeichnis downloaden kann

wenn man Port über 1000 verwendet, braucht man kein sudo
openssl s_server -key www.key -cert www.cert -accept 4430 -WWW
Aufruf mit
https://10.0.0.223/hallo.txt

5.2. Festplatten verschlüsseln

echo brot | sha256sum
output
4806a20d20d69c39e66a16c588e84e6fa79c73bc040f93f70fa56dc962fb7bd4  -

5.3. cryptsetup

sudo apt install cryptsetup
dm crypt
  • Das Laufwerk muss dann noch gemounted werden.

Skript.pdf S.23ff
dd if=/dev/zero of=crypt.img bs=1M count=100

hexedit crypt.img

sudo cryptsetup open crypt.img geheim --type plain
  • Man muss hier das Passwort eingeben

    • Gibt man das falsche Passwort ein, ist es dm-crypt egal, es versucht einfach die Daten mit den Schlüssel zu entschlüsseln (was natürlich nicht gelingt)

ls -l /dev/mapper/geheim
Laufwerk mounten
sudo mount /dev/geheim /mnt
schreibbar mounten
sudo mount -o uid=1000,umask=000 /dev/geheim /mnt

ls -l /mnt

5.4. Exkurs scrcpy

sudo apt install scrcopy
  • über apk an Handy per Kabel anschließen

Handy Screen auf Desktop mirroren
scrcpy

5.5. Speichern von Passwörtern

5.6. Exkurs: Sokrates Passwort auslesen

  • einfach beim Passwort - Feld den type von password auf text ändern.

sokrates hacken

5.7. Angriffspunkte bei Festplatten-Verschlüsselung

  • Folien.pdf S.36ff

  • Skript.pdf S.26

5.7.1. Intrusion detection tools for Linux

  • Root Kit Hunter

  • Tiger

    • mit mehreren Tools

sudo apt install tiger

5.8. Backup und Archivierung

  • Backup …​ aktueller Stand

  • Archivierung …​ Backup zu einem gewissen Zeitpunkt

  • rsnapshot

  • borgbackup (!)

5.9. Recover von gelöschten Dateien

  • Folien.pdf S.42

  • testdisk

  • Photorec

  • beide Programme sind im Paket testdisk enthalten

5.10. Sicheres Löschen

5.10.1. DiskDump dd

  • Skript.pdf S.28

dd if=/dev/urandom of=/dev/sdb oflag=sync,direct bs=1M status=progress
  • /dev/urandom …​ Zufallszahlengenerator, sehr ressourcenintensiv

  • of=/dev/sdb …​ der gesamte (hier:) USB-Stick wird formatiert (mit allen Partitionen)

5.10.2. wipe

  • mehrfaches Überschreiben

5.10.3. Ansehen der Partitionen

  • lsblk steht für "list block devices" und dient dazu, verfügbare Block devices in Baumdarstellung aufzulisten und Informationen zu diesen anzuzeigen. Es liest hierzu das sysfs-Dateisystem ein.

  • Es ist vergleichbar mit blkid, welches aber nur für Geräte funktioniert, auf denen eine gültige Partitionstabelle existiert. lsblk hingegen listet auch Geräte auf, wenn diese über keine gültige Partitionstabelle verfügen.

  • Block Device …​ Abbildung eines physikalischen Datenträgers unter Linux

lsblk
output
pi@raspberrypi:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0 14.8G  0 disk
|-mmcblk0p1 179:1    0  256M  0 part /boot
`-mmcblk0p2 179:2    0 14.6G  0 part /

5.11. Image von Disk

cp /dev/dvd image.iso
  • eher langsam (byte für byte wird kopiert - 1:1-Kopie)

  • für schnelles kopieren wird partclone verwendet (nur die belegten Sektoren werden kopiert)

    • keine 1:1-Kopie, dafür schneller

    • gesamte Disk kann damit nicht kopiert werden, da die Partitionstabelle nicht mitkopiert wird - nur partitionsweise

5.12. Kopieren von Datenträgern

zB USB-Sticks

dd if=/dev/sda of=/dev/sdb
cp /dev/sda /dev/sdb
  • beide Befehle bewirken dasselbe

6. ESB32 flashen mit Tasmota

./flash.sh tasmota-DE.bin
  • Die Taste "flash" drücken

    • Der Chip wird in den Flash-Modus versetzt

6.1. OBI-Socket

7. Bildschirm auf Website spiegeln

  • vnc-server am Rechner

    • X11VNC für RPi

      x11vnc -shared -viwonly -loop -forever --noxdamage -nopw
  • in der html-Seite ein js-script (novnc) einbinden

8. Website downloaden

wget -mirror

9. OpenVAS Security Scanner

  • skript.pdf S.91

#!/bin/bash
#docker run --rm -v /tmp/:/reports/:rw pensivesecurity/rpi-scanner:latest \
#       python3 -u scan.py "10.0.0.0/24" --debug --update \
#       --format="PDF" --output rpi-openvas-report.pdf --profile="Full and fast"

# Hinweis: --update dauert sehr lange, um openvas und alle Plugins zu aktualisieren
# daher besser raus nehmen

docker run --rm -v /tmp/:/reports/:rw pensivesecurity/rpi-scanner:latest \
       python3 -u scan.py "10.0.0.0/24" --debug \
       --format="PDF" --output rpi-openvas-report.pdf --profile="Full and fast"

10. Einbruch (Netzwerk) und Datendiebstahl

skript.pdf S. 92

11. Firewall

skript S.40ff

12. VPN _ Virtual Private Network

  • Skript S.51ff

  • vtun

    • apt install vtun

    • Server muss im Internet stehen

    • Der Schlüssel wird per ssh auf den Client übertragen

  • wireguard

    • Kernel muss passen (kernel modul muss enthalten sein)

13. Ethercap