Debian Codegraph @

docs/dev/logs/2020-10-29.org

raw
1 * The scanner, 2020-10-29, Hacking Villa Diesbach
2 ** Motivation
3 - The purpose of cdist is to ensure systems are in a configured state
4 - If systems reboot into a clean (think: netboot) state they are
5 stuck in an unconfigured mode
6 - We can either trigger *from* those machines
7 - this is what cdist trigger is for
8 - Or we can regulary *scan* for machines
9 - This method does not need any modification to standard OS
10 ** How it works
11 - cdist scan uses the all nodes multicast group ff02::1
12 - It sends a ping packet there in regular intervals
13 - This even works in non-IPv6 networks, as all operating systems
14 are IPv6 capable and usually IPv6 enabled by default
15 - Link local is always accessible!
16 - cdist scan receives an answer from all alive hosts
17 - These results are stored in ~/.cdist/scan/${hostip}
18 - We record the last_seen date ~/.cdist/scan/${hostip}/last_seen
19 - After a host is detected, cdist *can* try to configure it
20 - It saves the result (+/- logging needs to be defined) in
21 ~/.cdist/scan/${hostip}/{config, install}_result
22 - If logging is saved: maybe in ~/.cdist/scan/${hostip}/{config, install}_log
23 - Final naming TBD
24 ** Benefits from the scanning approach
25 - We know when a host is alive/dead
26 - We can use standard OS w/o trigger customisation
27 - Only requirement: we can ssh into it
28 - Can make use f.i. of Alpine Linux w/ ssh keys feeding in
29 - We can trigger regular reconfiguration
30 - If alive && last_config_time > 1d -> reconfigure
31 - Data can be exported to f.i. prometheus
32 - Record when configured (successfully)
33 - Record when seen
34 - Enables configurations in stateless environments
35 ** Sample output v2020-10-29
36 23:14] bridge:~% sudo cdist scan -b -I wlan0 -vv
37 VERBOSE: cdist: version 6.8.0-36-g91d99bf0
38 VERBOSE: scan: Host fe80::21d:72ff:fe86:46b is alive
39 VERBOSE: scan: Host fe80::ce2d:e0ff:fed4:2611 is alive
40 VERBOSE: scan: Host fe80::21b:fcff:feee:f4c1 is alive
41 VERBOSE: scan: Host fe80::e2ff:f7ff:fe00:20e6 is alive
42 VERBOSE: scan: Host fe80::20d:b9ff:fe49:ac11 is alive
43 VERBOSE: scan: Host fe80::9e93:4eff:fe6c:c1f4 is alive
44 VERBOSE: scan: Host fe80::ce32:e5ff:fe79:7ea7 is alive
45 VERBOSE: scan: Host fe80::219:d2ff:feb2:2e12 is alive
46 VERBOSE: scan: Host fe80::d66d:6dff:fe33:e00 is alive
47 VERBOSE: scan: Host fe80::21b:fcff:feee:f446 is alive
48 VERBOSE: scan: Host fe80::21b:fcff:feee:f4b1 is alive
49 VERBOSE: scan: Host fe80::20d:b9ff:fe4c:547d is alive
50 VERBOSE: scan: Host fe80::bad8:12ff:fe65:313d is alive
51 VERBOSE: scan: Host fe80::42b0:34ff:fe6f:f6f0 is alive
52 VERBOSE: scan: Host fe80::ba69:f4ff:fec5:6041 is alive
53 VERBOSE: scan: Host fe80::f29f:c2ff:fe7c:275e is alive
54 VERBOSE: scan: Host fe80::ba69:f4ff:fec5:8db7 is alive
55 VERBOSE: scan: Host fe80::42b0:34ff:fe6f:f863 is alive
56 VERBOSE: scan: Host fe80::21b:fcff:feee:f4bc is alive
57 ** Better usage -> saving the env
58 sudo -E cdist scan -b -I wlan0 -vv
59 ** TODO Implement actual configuration step
60 - Also serves as a nice PoC
61 - Might need to escape literal IPv6 addresses for scp
62 ** TODO Define how to map link local address to something useful
63 - via reverse DNS?
64 - via link local in manifest?
65 ** TODO define ignorehosts?