Debian Codegraph @

doc/modules/guide/pages/authentication.adoc

raw
1 [[authentication]]
2 = Cockpit Authentication
3
4 While cockpit allows you to monitor and administer several servers at
5 the same time, there is always a primary server your browser connects to
6 that runs the Cockpit web service (cockpit-ws) through which connections
7 to additional servers are established. See
8 https://raw.githubusercontent.com/cockpit-project/cockpit/main/doc/cockpit-transport.png[this
9 diagram] for how it works.
10
11 Normally, a session is established on the primary server, and you use
12 the Shell UI of that session to connect to secondary servers.
13
14 However, it is also possible to instruct the `+cockpit-ws+` process on
15 the primary server to directly connect to a secondary server, without
16 opening a session on the primary server at all. This is done on the main
17 login page of Cockpit, by filling out the "Connect to" field.
18
19 [[initial-auth]]
20 == Directly logging into the primary server
21
22 The most common way to use Cockpit is to just log directly into the
23 server that you want to access. This can be done if you have direct
24 network access to port 9090 on that server.
25
26 By default the cockpit web service is installed on thec base system and
27 xref:listen.adoc[socket activated by systemd]. In this setup access is
28 controlled by a cockpit specific pam stack, generally located at
29 `+/etc/pam.d/cockpit+`. By default this is configured to allow you to
30 login with the username and password of any local account on the system.
31 You can also setup a xref:sso.adoc[Kerberos based SSO solution] or
32 xref:cert-authentication.adoc[certificate/smart card authentication].
33
34 You can also
35 https://github.com/cockpit-project/cockpit/blob/main/doc/authentication.md#actions[disable
36 authentication schemes] to enforce authentication policies, or to
37 suppress undesired browser GSSAPI authentication dialogs.
38
39 The web server can also be run from the
40 https://quay.io/cockpit/ws[cockpit/ws] container. If you are
41 running cockpit on a container host operating system like
42 https://getfedora.org/coreos/[Fedora CoreOS] this will be the only
43 supported mode. In this setup, cockpit establishes an SSH connection
44 from the container to the underlying host, meaning that it is up to your
45 SSH server to grant access. To login with a local account, `+sshd+` will
46 need to be configured to allow password based authentication.
47 Alternatively you can setup a xref:sso.adoc[Kerberos based SSO solution].
48
49 Like `+sshd+`, cockpit can be configured to limit the number of
50 concurrent login attempts allowed. This is done by adding a
51 `+MaxStartups+` option to the `+WebService+` section of your
52 `+cockpit.conf+`. Additional connections will be dropped until
53 authentication succeeds or the connections are closed.
54
55 [[direct-secondary-auth]]
56 == Directly logging into a secondary server without a primary session
57
58 It is also possible to log into a secondary server without opening a
59 session on the primary server. This is useful if you are not actually
60 interested in the primary server and would only use it because you do
61 not have direct network access to the secondary server.
62
63 In this case, `+cockpit-ws+` still runs on the primary server, but the
64 credentials from the login screen are directly used with SSH to log into
65 the secondary server given in the "Connect To" field of the login
66 screen.
67
68 Thus, the PAM configuration and accounts on the primary server don't
69 matter at all. Often, the only purpose of the primary server is to sit
70 on the boundary of your network and forward connections to internal
71 machines.
72
73 In this case, the login page will prompt you to verify unknown SSH keys.
74 Accepted keys will be remembered in the local storage of your browser.
75
76 [[secondary-auth]]
77 == Logging into a secondary server from the primary session
78
79 Once you have a session on the primary server, it is possible connect to
80 additional servers by using the host switching UI of the Cockpit Shell.
81 This is useful if you have direct network access to the primary server,
82 but not to the secondary server.
83
84 On the command line, you would log into the primary server and then use
85 SSH to log into the secondary one. Cockpit does just the same, and uses
86 SSH to log into the secondary server. Instead of running a interactive
87 shell there, however, it starts a `+cockpit-bridge+` process.
88
89 _Warning:_ Unlike with SSH on the command line though, this will also
90 load and use the Cockpit pages (i.e. JavaScript) from the remote
91 machine, which means that the remote machine can execute arbitrary code
92 on your primary and all other connected secondary machines. Hence, only
93 connect to _machines which you trust_.
94
95 Due to this security risk, this host switcher functionality is disabled
96 by default, except on long-term stable Linux distributions (Red Hat
97 Enterprise Linux 9, Debian 12, and Ubuntu 22.04/24.04 LTS). If you are
98 comfortable with the security implications, you can enable it manually
99 with the `+AllowMultiHost+` option in `+cockpit.conf+`.
100
101 These servers will need to be running an SSH server and be configured to
102 support one of the following authentication methods.
103
104 === Password
105
106 The target server will need to have password based authentication
107 enabled in `+sshd+`.
108
109 === Kerberos
110
111 The target server will need to be a member of the same domain as the
112 primary server and your domain must be whitelisted in your browser. See
113 the xref:sso.adoc[SSO documentation] for how to set this up.
114
115 === Public key
116
117 When you successfully log into the primary server, a `+ssh-agent+` is
118 started and keys are loaded into it by running `+ssh-add+` without any
119 arguments. Any passphrase prompt is answered with the password used to
120 log into the primary server.
121
122 Cockpit provides a user interface for loading other keys into the agent
123 that could not be automatically loaded.
124
125 The target server will need to have public key authentication enabled in
126 `+sshd+`, and the public key you wish to use must be present in
127 `+~/.ssh/authorized_keys+`. Cockpit has a user interface for creating
128 SSH keys and for authorizing them.
129
130 [[host-keys]]
131 === SSH host keys
132
133 Cockpit will prompt the user to verify unknown SSH host keys, and will
134 write accepted host keys into `+~/.ssh/known_hosts+`.