Linux Cockpit Notes
1. What is Cockpit?
Cockpit is a web-based graphical interface for servers, intended for everyone, especially those who are:
* new to Linux
* familiar with Linux
* expert adminsCockpit makes Linux discoverable. You don’t have to remember commands at a command-line.
See your server in a web browser and perform system tasks with a mouse. It’s easy to start containers, administer storage, configure networks, and inspect logs. Basically, you can think of Cockpit like a graphical “desktop interface”, but for individual servers.
2. Install
2.1. Install Cockpit
-
Install
Ubuntusudo apt update && sudo apt install -y cockpitFedorasudo dnf -y install cockpit -
Enable
sudo systemctl enable --now cockpit.socket
2.2. Install Native Cockpit Applications
-
Launch
Cockpitvia https://hostname:9090 -
Enable
Administrative accessby clicking the Limited access button followed by authenticating with your password. -
Click the Applications menu item
-
Install the following appplications and click the Install button to install them.
-
Files
-
Machines
-
Podman
-
SELinux
-
2.3. Install 3rd Party Cockpit Applications
2.3.1. ZFS
-
Doc is here.
-
cd into your home folder
cd -
Download git repo
git clone https://github.com/45drives/cockpit-zfs-manager.git -
Copy
sudo cp -r cockpit-zfs-manager/zfs /usr/share/cockpit -
Restart
Cockpitsudo systemctl restart cockpit
-
2.3.2. File Sharing (DEB Systems)
-
This is a Cockpit plugin for managing Samba and NFS shares
-
Via the following URL, open the following in a browser to identify the latest rpm release package from:
https://github.com/45Drives/cockpit-file-sharing/releases -
Install the release package
Examplesudo dnf -y install https://github.com/45Drives/cockpit-file-sharing/releases/download/v4.2.9-8/cockpit-file-sharing-4.2.9-8.el8.noarch.rpm
-
2.4. Install Cockpit MFA Support
|
Copilot with GPT-4 generated the install steps. |
-
Install Packages
Ubuntusudo apt-get install libpam-google-authenticator libqrencode-dev -yFedorasudo dnf -y install libpam-google-authenticator libqrencode-dev -
Generate the MFA Secret
Run the google-authenticator command with the appropriate flags. This will generate a QR code that you can scan with your authenticator app, as well as some backup codes. Make sure to save these in a safe place:
google-authenticator -t -d -f -r 3 -R 30 -W -Q UTF8 -
Configure PAM
Add the Google Authenticator module to the PAM configuration for Cockpit. This can be done by appending a line to the /etc/pam.d/cockpit file:
sudo bash -c 'echo "auth required pam_google_authenticator.so nullok" >> /etc/pam.d/cockpit' -
Restart
Cockpitsudo systemctl restart cockpit -
Test MFA
Log out of Cockpit and log back in. You should be prompted to enter your username and password, followed by a one-time password (OTP) generated using the ffx provider.
That’s it! You have now added MFA to
Cockpit.Remember to keep your secret key secure and do not share it with anyone
-
Configure Nginx Proxy Manager entry with:
-
Websockets Support
-
Scheme: https
-