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 Cockpit
-
Install
Ubuntusudo apt update && sudo apt install -y cockpitFedorasudo dnf -y install cockpit -
Enable
sudo systemctl enable --now cockpit.socket
3. 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
-
4. Install 3rd Party Cockpit Applications
4.2. Podman
-
cd into your home folder
cd -
Download git repo
git clone https://github.com/cockpit-project/cockpit-podman -
cd into folder
cd cockpit-podman -
Build the plugin
make -
Install system-wide
sudo make install-
The module will be installed to
/usr/share/cockpit/
-
4.3. ZFS
-
cd into your home folder
cd -
Download git repo
git clone --recurse-submodules https://github.com/45Drives/cockpit-zfs.git -
cd into folder
cd cockpit-zfs -
Build the plugin
makeThis will take some time. -
Install system-wide
sudo make installThis will take some time too. -
Restart
Cockpitsudo systemctl restart cockpit.socket-
The module will be installed to
/usr/share/cockpit/zfs/
-
4.4. ZFS Old
-
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
-
5. 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
-