]> piware.de Git - talk-cockpit-auth-anywhere.git/blob - cockpit-auth-anywhere.md
Rework demo scripts
[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 - Switch to Windows virt-viewer, open Edge, show Cockpit
52 - Quit virt-viewer
53 - Zero configuration so far, other than possibly installing cockpit pkg and enabling cockpit.socket
54 - In larger environments it's impractical to install cockpit server on hundreds
55   of machines and using the login web page
56 - Glimpse of how to customize how cockpit runs and how to authenticate to it
57 :::
58
59 # Anatomy: cockpit-ws
60
61 ![ws-session](ws-session.pdf)\ 
62
63 - TCP http+WebSocket $\leftrightarrow$ JSON pipe
64 - collect credentials
65
66 :::notes
67 - for configuring, extending, and embedding Cockpit you need to coarsely understand the components of it
68 - this: simplest structure, what I just showed you and what you will most probably see the first time you try it
69 - browser only speaks HTTP and WebSocket, so you always need a web server, cockpit-ws
70 - all components in cockpit communicate to each other via a JSON protocol on standard pipes, usually stdio
71 - this provides a lot of flexibility and extensibility, as we'll see shortly
72 - ws roles: communicate with the browser for getting credentials: login page, krb negotiation, client cert
73 - ws: deliver HTML/js content, translate WebSocket to JSON protocol; runs as unprivileged system user
74 :::
75
76 # Anatomy: cockpit-session
77
78 ![ws-session](ws-session.pdf)\ 
79
80 - ws credentials → PAM session
81 - forward JSON pipe to session leader
82
83 :::notes
84 - need some root helper to actually start session: use creds from ws to start PAM login session, connect pipe to it
85 - standard is cockpit-session: very small, auditable
86 - but doesn't have to be, that's the flexible part
87 :::
88
89 # Anatomy: cockpit-bridge
90
91 ![ws-session](ws-session.pdf)\ 
92
93 - session leader, cockpit's "bash"
94 - JSON on stdio $\leftrightarrow$ system APIs
95
96 :::notes
97 - bridge: session leader, moral equivalent of what bash is in ssh session
98 - JSON protocol on stdio to system APIs: exec programs, call D-Bus, work with files or sockets
99 - runs as target user in login session; complex, but no special privileges
100 :::
101
102 # SSH sessions
103
104 ![ssh-session](ssh-session.pdf)\ 
105
106 nothing Cockpit specific running outside of the user session
107
108 :::notes
109 - ws and the login session don't need to run on the same machine
110 - cockpit-session is meant to be customizable for your purposes
111 - most obvious replacement is to let ssh start a session; that already does the
112   PAM bits and forward its initial stdio to the session lead; it would just
113   launch cockpit-bridge instead of bash
114 - browser: go to Dashboard, add cockpit.dev:2201
115 - interesting property: nothing Cockpit specific running in the system, no ws,
116   no extra open port; only bit is bridge, but that's uninteresting from security POV
117 :::
118
119 # Bastion host
120
121 ![bastion-host](bastion-host.pdf)\ 
122
123 Enforce using ssh in cockpit.conf(5):
124 ```ini
125 [WebService]
126 RequireHost=true
127 ```
128
129 :::notes
130 - further illustrated by a mode that we call "bastion host"
131 - disable cockpit-session and local logins, only use ssh
132 - can run in container
133 - no ws on critical machines, don't trust cockpit-session
134 - switch to browser; log out, use "connect to" for cockpit.dev:2201
135 :::
136
137 # Other authentication setups
138
139 - SSO/Kerberos in Identity Management domains
140 - smart card/client certificate authentication
141 - OAuth (Kubernetes)
142 - Foreman: included cockpit-ws with dynamic configuration
143
144 :::notes
145 - Cockpit supports common authentication systems out of the box
146 - IdM is very common; if you have a krb ticket, you get a session immediately
147   without the login page
148 - browsers can ask for TLS client certificates, commonly with smart cards, and
149   present them to the web server; latest Cockpit versions supports that
150 - Foreman has a "Web Console" button; already has ssh to all maintained
151   machines
152 - runs a single cockpit-ws process on its server, and dynamically configures it
153   for selected target machine, seamless transition between Foreman and Cockpit
154 - not enough time to demo all of this
155 :::
156
157 # Custom authentication example
158
159 TODO
160
161 # Q & A
162
163 Contact:
164
165 - `#cockpit` on Freenode
166 - https://cockpit-project.org
167
168 Useful links:
169
170  * [Authentication configuration](https://cockpit-project.org/guide/latest/authentication.html)
171  * [Authentication protocol](https://github.com/cockpit-project/cockpit/blob/master/doc/authentication.md)
172
173 :::notes
174 - Home page leads to mailing lists, documentation
175 - thanks for your attention; Q+A
176 :::