Implementando Cockpit

Sitio oficial
Red Hat
Guía 01

Recursos varios

SSH Keys

# https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1804
$ ssh-keygen
Your identification has been saved in /home/diego/_desarrollo/cockpit_key.
Your public key has been saved in /home/diego/_desarrollo/cockpit_key.pub.

Configuración server

# Cheatsheet - Alta de servidores
# Script new_server.sh
$ ssh -i /.ssh/id_rsa [email protected]
$ bash new_server.sh
# Al volver a loguear se carga la pass para el user

Cockpit

Instalar cockpit y plugins

$ sudo apt install cockpit
$ sudo apt install cockpit-dashboard cockpit-machines cockpit-networkmanager cockpit-packagekit cockpit-storaged cockpit-bridge # cockpit-pcp
$ sudo apt update --fix-missing
$ sudo dpkg --configure -a
$ sudo systemctl restart cockpit.socket
$ sudo systemctl enable --now cockpit.socket

Apache webserver

$ dpkg -l | grep -i apache2
$ ps aux | grep apache2
$ apt-get install apache2
$ systemctl enable apache2
$ systemctl status apache2

Install a Let’s Encrypt SSL certificate

$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get install certbot python-certbot-apache
$ sudo certbot --apache -d dominio.com

Set a Reverse Proxy in Apache

# https://linuxhostsupport.com/blog/install-cockpit-on-ubuntu-18-04/
$ a2enmod proxy
$ a2enmod proxy_http
$ a2enmod proxy_wstunnel
$ systemctl restart apache2
$ cp /etc/apache2/sites-available/000-default-le-ssl.conf /etc/apache2/sites-available/dominio.com.conf
$ nano /etc/apache2/sites-available/dominio.com.conf
$ a2dissite 000-default
$ a2dissite 000-default-le-ssl.conf
$ a2ensite dominio.com
$ systemctl restart apache2
$ sudo nano /etc/cockpit/cockpit.conf
#    [WebService]
#    Origins = https://dominio.com http://127.0.0.1:9090
#    ProtocolHeader = X-Forwarded-Proto
#    AllowUnencrypted = true
$ systemctl restart cockpit.socket
$ systemctl enable cockpit.socket

Finalmente

Monitor web Cockpit

Agregar servidores remotos

$ ssh-keygen
Password to the generated SSH key.
The contents of the ~/.ssh/id_rsa.pub file copied in the clipboard.
Your identification has been saved in /home/diego/.ssh/cockpitweb_key.
Your public key has been saved in /home/diego/.ssh/cockpitweb_key.pub.
# agregué mi llaves (pub y priv) para poder conectarme al resto de los servidores
$ cat ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"