Add oglive key to forgejo
parent
927e24e13e
commit
5a8d7dd303
|
@ -9,16 +9,27 @@ Para instalar dependencias de python se usa el modulo venv (https://docs.python.
|
||||||
|
|
||||||
## Ubuntu 24.04
|
## Ubuntu 24.04
|
||||||
|
|
||||||
sudo apt install python3-git python3-libarchive-c python3-termcolor bsdextrautils
|
sudo apt install python3-git opengnsys-libarchive-c python3-termcolor bsdextrautils
|
||||||
|
|
||||||
|
|
||||||
## Agregar clave de SSH si es necesario
|
## Agregar claves de SSH a oglive
|
||||||
|
|
||||||
El proceso falla si no hay clave de SSH en la imagen. Utilizar:
|
El sistema de Git accede al ogrepository por SSH. Para funcionar, necesita que el oglive tenga una clave de SSH, y que el ogrepository la acepte.
|
||||||
|
|
||||||
/opt/opengnsys/bin/setsslkey
|
El instalador de Git puede realizar los cambios requeridos, con:
|
||||||
|
|
||||||
para agregarla.
|
./opengnsys_git_installer.py --set-ssh-key
|
||||||
|
|
||||||
|
O para hacerlo contra un oglive especifico:
|
||||||
|
|
||||||
|
./opengnsys_git_installer.py --set-ssh-key --oglive 1 # numero de oglive
|
||||||
|
|
||||||
|
Ejecutar este comando agrega la clave de SSH a Forgejo automáticamente.
|
||||||
|
|
||||||
|
|
||||||
|
La clave existente puede extraerse con:
|
||||||
|
|
||||||
|
./opengnsys_git_installer.py --extract-ssh-key --quiet
|
||||||
|
|
||||||
# Ejecutar
|
# Ejecutar
|
||||||
|
|
||||||
|
@ -34,7 +45,11 @@ Forgejo gestiona los repositorios y el acceso por SSH, por lo cual debe quedarse
|
||||||
El usuario por defecto es `oggit` con password `opengnsys`.
|
El usuario por defecto es `oggit` con password `opengnsys`.
|
||||||
|
|
||||||
|
|
||||||
|
# Paquetes con dependencias
|
||||||
|
|
||||||
|
El sistema OgGit requiere módulos de Python que no vienen en Ubuntu 24.04 o tienen versiones demasiado antiguas.
|
||||||
|
|
||||||
|
Los fuentes de los paquetes se encuentran en oggit/packages.
|
||||||
|
|
||||||
# Documentación de código fuente
|
# Documentación de código fuente
|
||||||
|
|
||||||
|
|
|
@ -373,6 +373,7 @@ class OpengnsysGitInstaller:
|
||||||
client_key_path = os.path.join(ssh_key_dir, "id_ed25519")
|
client_key_path = os.path.join(ssh_key_dir, "id_ed25519")
|
||||||
authorized_keys_path = os.path.join(ssh_key_dir, "authorized_keys")
|
authorized_keys_path = os.path.join(ssh_key_dir, "authorized_keys")
|
||||||
|
|
||||||
|
oglive_public_key = ""
|
||||||
|
|
||||||
|
|
||||||
# Create a SSH key on the oglive, if needed
|
# Create a SSH key on the oglive, if needed
|
||||||
|
@ -383,6 +384,10 @@ class OpengnsysGitInstaller:
|
||||||
self.__logger.info("Writing new SSH key into %s", client_key_path)
|
self.__logger.info("Writing new SSH key into %s", client_key_path)
|
||||||
subprocess.run(["/usr/bin/ssh-keygen", "-t", "ed25519", "-N", "", "-f", client_key_path], check=True)
|
subprocess.run(["/usr/bin/ssh-keygen", "-t", "ed25519", "-N", "", "-f", client_key_path], check=True)
|
||||||
|
|
||||||
|
with open(client_key_path + ".pub", "r", encoding="utf-8") as pubkey:
|
||||||
|
oglive_public_key = pubkey.read()
|
||||||
|
|
||||||
|
# Add our public keys to the oglive, so that we can log in
|
||||||
public_keys = ""
|
public_keys = ""
|
||||||
|
|
||||||
for username in self.ssh_key_users:
|
for username in self.ssh_key_users:
|
||||||
|
@ -451,10 +456,13 @@ class OpengnsysGitInstaller:
|
||||||
with open(client_initrd_path, "rb") as initrd_file:
|
with open(client_initrd_path, "rb") as initrd_file:
|
||||||
hexdigest = hashlib.file_digest(initrd_file, "sha256").hexdigest()
|
hexdigest = hashlib.file_digest(initrd_file, "sha256").hexdigest()
|
||||||
with open(client_initrd_path + ".sum", "w", encoding="utf-8") as digest_file:
|
with open(client_initrd_path + ".sum", "w", encoding="utf-8") as digest_file:
|
||||||
digest_file.write(hexdigest)
|
digest_file.write(hexdigest + "\n")
|
||||||
|
|
||||||
self.__logger.info("Updated initrd %s", client_initrd_path)
|
self.__logger.info("Updated initrd %s", client_initrd_path)
|
||||||
|
|
||||||
|
|
||||||
|
self.add_forgejo_sshkey(oglive_public_key, "Key for " + ogclient)
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
"""Instalar
|
"""Instalar
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue