]> piware.de Git - talk-cockpit-auth-anywhere.git/blob - cockpit-auth-anywhere.md
More presentation
[talk-cockpit-auth-anywhere.git] / cockpit-auth-anywhere.md
1 ---
2 title: Authenticate to Cockpit from anywhere
3 subtitle:
4 author: Martin Pitt <<mpitt@redhat.com>>
5 email: mpitt@redhat.com
6 date: DevConv.CZ 2020
7 theme: Singapore
8 header-includes:
9  - \setbeameroption{show notes}
10  - \newcommand{\fullsizeimg}[1]{\makebox[\linewidth]{\includegraphics[width=\paperwidth]{#1}}}
11 ...
12
13 # Cockpit what?
14
15 - Interactive Server admin web interface
16 - Easy setup and troubleshooting for one or a few machines
17 - Included in all major distros
18
19 :::notes
20 - Conceptually: Linux session running in a web browser; technically very similar to ssh/VT/GNOME login
21 - Aimed at admins who are new to Linux, e. g. coming from the Windows world and familiar with the concepts, but not Linux terminology
22 - but also to experienced ones for infrequent tasks; not just setup, but also investigating “what is wrong with this machine”
23 :::
24
25
26 # Extending LVM
27
28 ```sh
29 pvcreate /dev/sdb2
30 vgextend vg0 /dev/sdb2
31 lvresize --extents '+100%FREE' vg0/data1
32 resize2fs /dev/vg0/data1
33 ```
34
35 :::notes
36 - for example, adding a new PV to an LV and resizing the file system you can spend some time coming up with these commands
37 - lots of possibilities for screwing up
38 - you can do it simply and safely with Cockpit like this → go to local browser
39 - Storage page, vg0 in Devices (top right), + in Physical Volumes, add sdb2
40 - expand data1 table line, click grow
41 :::
42
43 # Accessible from any browser
44
45  - Windows/Edge
46  - Mobile devices
47  - Simple install
48  - Zero configuration
49
50 :::notes
51 - TODO: check out bots in "make deps", add ./vm-run windows-10 to prep.sh
52 - Switch to Windows virt-viewer, open Edge, show Cockpit
53 - Quit virt-viewer
54 - Zero configuration so far, other than possibly installing cockpit pkg and enabling cockpit.socket
55 - In larger environments it's impractical to install cockpit server on hundreds
56   of machines and using the login web page
57 - Glimpse of how to customize how cockpit runs and how to authenticate to it
58 :::
59
60 # Anatomy: cockpit-ws
61
62 ![ws-session](ws-session.pdf)\ 
63
64 - TCP http+WebSocket $\leftrightarrow$ JSON pipe
65 - collect credentials
66
67 :::notes
68 - for configuring, extending, and embedding Cockpit you need to coarsely understand the components of it
69 - this: simplest structure, what I just showed you and what you will most probably see the first time you try it
70 - browser only speaks HTTP and WebSocket, so you always need a web server, cockpit-ws
71 - all components in cockpit communicate to each other via a JSON protocol on standard pipes, usually stdio
72 - this provides a lot of flexibility and extensibility, as we'll see shortly
73 - ws roles: communicate with the browser for getting credentials: login page, krb negotiation, client cert
74 - ws: deliver HTML/js content, translate WebSocket to JSON protocol; runs as unprivileged system user
75 :::
76
77 # Anatomy: cockpit-session
78
79 ![ws-session](ws-session.pdf)\ 
80
81 - ws credentials → PAM session
82 - forward JSON pipe to session leader
83
84 :::notes
85 - need some root helper to actually start session: use creds from ws to start PAM login session, connect pipe to it
86 - standard is cockpit-session: very small, auditable
87 - but doesn't have to be, that's the flexible part
88 :::
89
90 # Anatomy: cockpit-bridge
91
92 ![ws-session](ws-session.pdf)\ 
93
94 - session leader, cockpit's "bash"
95 - JSON on stdio $\leftrightarrow$ system APIs
96
97 :::notes
98 - bridge: session leader, moral equivalent of what bash is in ssh session
99 - JSON protocol on stdio to system APIs: exec programs, call D-Bus, work with files or sockets
100 - runs as target user in login session; complex, but no special privileges
101 :::
102
103 # SSH sessions
104
105 ![ssh-session](ssh-session.pdf)\ 
106
107 nothing Cockpit specific running outside of the user session
108
109 :::notes
110 - TODO: start rhel7 VM in prep.sh, set hostname
111 - ws and the login session don't need to run on the same machine
112 - cockpit-session is meant to be customizable for your purposes
113 - most obvious replacement is to let ssh start a session; that already does the
114   PAM bits and forward its initial stdio to the session lead; it would just
115   launch cockpit-bridge instead of bash
116 - browser: go to Dashboard, add cockpit.dev:2201
117 - interesting property: nothing Cockpit specific running in the system, no ws,
118   no extra open port; only bit is bridge, but that's uninteresting from security POV
119 :::
120
121 # Bastion host
122
123 ![bastion-host](bastion-host.pdf)\ 
124
125 Enforce using ssh in cockpit.conf(5):
126 ```ini
127 [WebService]
128 RequireHost=true
129 ```
130
131 :::notes
132 - further illustrated by a mode that we call "bastion host"
133 - disable cockpit-session and local logins, only use ssh
134 - can run in container
135 - no ws on critical machines, don't trust cockpit-session
136 - switch to browser; log out, use "connect to" for cockpit.dev:2201
137 :::
138
139 # Other authentication setups
140
141 - SSO/Kerberos in Identity Management domains
142 - smart card/client certificate authentication
143 - OAuth (Kubernetes)
144 - Foreman: included cockpit-ws with dynamic configuration
145
146 :::notes
147 - Cockpit supports common authentication systems out of the box
148 - IdM is very common; if you have a krb ticket, you get a session immediately
149   without the login page
150 - browsers can ask for TLS client certificates, commonly with smart cards, and
151   present them to the web server; latest Cockpit versions supports that
152 - Foreman has a "Web Console" button; already has ssh to all maintained
153   machines
154 - runs a single cockpit-ws process on its server, and dynamically configures it
155   for selected target machine, seamless transition between Foreman and Cockpit
156 - not enough time to demo all of this
157 :::
158
159 # Custom authentication example
160
161 TODO
162
163 # Q & A
164
165 Contact:
166
167 - `#cockpit` on Freenode
168 - https://cockpit-project.org
169
170 Useful links:
171
172  * [Authentication configuration](https://cockpit-project.org/guide/latest/authentication.html)
173  * [Authentication protocol](https://github.com/cockpit-project/cockpit/blob/master/doc/authentication.md)
174
175 :::notes
176 - Home page leads to mailing lists, documentation
177 - thanks for your attention; Q+A
178 :::