samba_pass #21

Merged
opengnsys merged 3 commits from samba_pass into main 2025-06-30 14:57:20 +02:00
5 changed files with 8 additions and 58 deletions

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.8.9] - 2024-06-30
### Changed
- Borra directorio samba de etc y modifica postint para que copie el fichero de configuración de la plantilla de samba
## [0.8.8] - 2024-06-27
### Changed
- Actualiza grub.exe para que soporte sistemas de particiones ext

View File

@ -1,8 +1,7 @@
#!/bin/bash
PROG=$(basename $0)
OPENGNSYS=${OPENGNSYS:-"/opt/ogboot"}
OGCFGFILE=$OPENGNSYS/etc/ogboot_samba.json
OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys/ogboot"}
SAMBAUSER="opengnsys" # Usuario por defecto.
TFTPDIR=$OPENGNSYS/tftpboot
INITRD=oginitrd.img
@ -18,7 +17,7 @@ fi
case $# in
0) # Cambios en todos los clientes ogLive instalados.
if which oglivecli &>/dev/null; then
LIST=$(oglivecli list | awk '{print $2}')
LIST=$(./oglivecli list_installed_oglives | jq -r '.installed_ogLives[].directory' | xargs -n1 basename)
else
LIST="ogclient"
fi ;;
@ -95,42 +94,6 @@ for OGLIVE in $LIST; do
sudo sed -i "s/OPTIONS=\(.*\)user=\w*\(.*\)pass=\w*\(.*\)/OPTIONS=\1user=$SAMBAUSER\2pass=$SAMBAPASS\3/" scripts/ogfunctions
# TEMPORAL: solución ticket 554, actualizar cliente en caché (ogLive r3257).
sudo sed -i "s/busybox reboot/reboot/" scripts/ogfunctions
# FIN CÓDIGO TEMPORAL.
# Ticket 565, preparar acceso Rsync cliente.
echo "$SAMBAPASS" | sudo tee scripts/passrsync > /dev/null
echo "Guardar tokens de seguridad"
cat <<EOT | sudo tee scripts/client.cfg > /dev/null
CLIENTID=$(jq -r .client.id $OGCFGFILE)
CLIENTSECRET=$(jq -r .client.secret $OGCFGFILE)
EOT
sudo chown ogboot:ogboot scripts/passrsync scripts/client.cfg
# pwd
# sudo find . -print > /tmp/filelist.txt
# if [ $? -ne 0 ]; then
# echo "Error: No se pudo encontrar los archivos."
# exit 5
# fi
# cpio -H newc -oa < /tmp/filelist.txt > /tmp/initrd.cpio
# if [ $? -ne 0 ]; then
# echo "Error: No se pudo crear el archivo CPIO."
# exit 5
# fi
# $COMPRESS_CMD < /tmp/initrd.cpio > /tmp/initrd.cpio.gz
# if [ $? -ne 0 ]; then
# echo "Error: No se pudo comprimir el archivo CPIO."
# exit 5
# fi
# echo "Copiando el contenido del archivo /tmp/initrd.cpio.gz al archivo /opt/opengnsys/tftpboot/ogLive-5.11.0-r20210413/oginitrd.img."
# echo $CLIENTINITRD
# dd if=/tmp/initrd.cpio.gz of=/opt/opengnsys/tftpboot/ogLive-5.11.0-r20210413/oginitrd.img
# echo "dd ejecutado correctamente"
# if [ $? -ne 0 ]; then
# echo "Error: No se pudo escribir el archivo comprimido en el destino."
# exit 5
# fi
# echo "borrando rm /tmp/initrd.cpio /tmp/initrd.cpio.gz"
# sudo rm /tmp/initrd.cpio /tmp/initrd.cpio.gz
find . | cpio -H newc -oa | gzip -9c > "$CLIENTINITRD"
else
echo "$PROG: Aviso: no se ha modificado la clave del cliente \"$OGLIVE\"."
@ -146,12 +109,8 @@ EOT
done
if [[ $CHANGES != 0 ]]; then
# Ticket 565, preparar acceso Rsync servidor.
echo "$SAMBAUSER:$SAMBAPASS" | sudo tee /etc/rsyncd.secrets > /dev/null
echo "chown debugging"
sudo chown root:root /etc/rsyncd.secrets
sudo chmod 600 /etc/rsyncd.secrets
# Cambiar clave Samba.
echo "Cambiando clave samba en el servidor"
echo -ne "$SAMBAPASS\n$SAMBAPASS\n" | sudo smbpasswd -a -s $SAMBAUSER
echo "setsmbpass finish"
else

View File

@ -153,7 +153,7 @@ configure_nginx_and_fpm() {
configure_samba(){
echo "Configurando Samba"
cp /opt/opengnsys/ogboot/etc/samba/smb-ogboot.conf /etc/samba/
cp /opt/opengnsys/ogboot/etc/smb-ogboot.conf.tmpl /etc/samba/smb-ogboot.conf
sed -i "s|__OGBOOTDIR__|$OGBOOT_ROOT|g" /etc/samba/smb-ogboot.conf
INCLUDE_LINE="include = /etc/samba/smb-ogboot.conf"
if ! grep -q "$INCLUDE_LINE" /etc/samba/smb.conf; then

View File

@ -1,6 +0,0 @@
[tftpboot]
comment = OpenGnsys init files
browseable = no
writeable = no
path = __OGBOOTDIR__/tftpboot
guest ok = no

View File

@ -1,7 +0,0 @@
[ogclient]
comment = OpenGnsys Client
browseable = no
writeable = no
locking = no
path = __OGBOOTDIR__/client
guest ok = no