Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión a5d85bcb

Añadido por root hace alrededor de 7 años

Creacion de la rama bionic para el repositorio de fuentes de paquetes.

Ver diferencias:

ubuntu/bionic/all/linex-ubuntu-puppet/debian/changelog
linex-ubuntu-puppet (1.4.3) UNRELEASED; urgency=medium
* Añadidas las dependencias de los paquetes lockfile-progs y uuid-
runtime
-- root <root@elisa> Wed, 05 Apr 2017 11:03:32 +0200
linex-ubuntu-puppet (1.4.2) linex; urgency=medium
* Se añade a sinc_puppet: export PATH para correcto funcionamiento cuando levanta la interfaz Network-Manager
-- ismael <ismael.campos@juntaex.es> Thu, 16 Feb 2017 15:33:44 +0100
linex-ubuntu-puppet (1.4.1) linex; urgency=medium
* Unificar versión con willy
-- Ismael Campos <ismael.campos@juntaex.es> Fri, 03 Feb 2017 13:48:30 +0100
linex-ubuntu-puppet (1.4) linex; urgency=medium
* Se modifica ejecutable sinc_puppet y sincpuppet.default con la versión de linex-ubuntu-puppet 2.5 de Esteban.
* Se pasa a generar certificados con uuid en lugar de nombre de hosts y se resuelven problemas con certificados.
-- Ismael Campos <ismael.campos@juntaex.es> Fri, 03 Feb 2017 10:10:01 +0100
linex-ubuntu-puppet (1.3) linex; urgency=medium
* Modificado escuela2.0 por ubuntu 16.04 (Eli).
* Añadida desactivación de servicio puppet para systemctl
* Cambiado script sinc_puppet por el de Esteban versión 1.8
-- Rafael J. García Perdigón <rafael.garciap@gobex.es> Mon, 04 Jul 2016 14:39:37 +0200
linex-ubuntu-puppet (1.2) linex; urgency=medium
* Cambio del nombre del paquete de de linex-workstation-puppet a linex-ubuntu-puppet.
Cambiado el fichero escuela2.0.
Añadido el fichero de puppet.conf
Añadidos Divert a los ficheros de configuracion.
* Bloqueada la sincronización de plugins.
-- Rafael J. García Perdigón <rafael.garciap@gobex.es> Mon, 25 Jan 2016 12:15:40 +0100
linex-ubuntu-puppet (1.0) linex; urgency=low
* Initial Release. Metapackage to install puppet for linex workstations.
-- Rafael J. García Perdigón <rafael.garciap@gobex.es> Fri, 19 Sep 2014 10:10:03 +0200
ubuntu/bionic/all/linex-ubuntu-puppet/debian/compat
8
ubuntu/bionic/all/linex-ubuntu-puppet/debian/conffiles
/usr/share/linex-ubuntu-puppet/escuela2.0
/usr/share/linex-ubuntu-puppet/puppet.conf
/usr/share/linex-ubuntu-puppet/sincpuppet.default
ubuntu/bionic/all/linex-ubuntu-puppet/debian/control
Source: linex-ubuntu-puppet
Section: admin
Priority: optional
Maintainer: Rafael Jesús García Perdigón <rafael.garciap@gobex.es>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Package: linex-ubuntu-puppet
Architecture: all
Depends: ${misc:Depends}, puppet, puppet-common, pkgsync, lockfile-progs, uuid-runtime
Description: Configuración del cliente puppet
Instalación de las dependencias del cliente de puppet,
junto con la configuración necesaria para dicho cliente
en el entorno de un centro educativo.
ubuntu/bionic/all/linex-ubuntu-puppet/debian/copyright
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: lingobex-desktop-theme
Files: *
Copyright: 2014 Gobierno de Extremadura
License: GPL-3.0+
Files: debian/*
Copyright: 2014 Gobierno de Extremadura
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
ubuntu/bionic/all/linex-ubuntu-puppet/debian/install
usr
ubuntu/bionic/all/linex-ubuntu-puppet/debian/linex-ubuntu-puppet.links
/usr/share/linex-ubuntu-puppet/escuela2.0 /etc/escuela2.0
/usr/share/linex-ubuntu-puppet/puppet.conf /etc/puppet/puppet.conf
/usr/share/linex-ubuntu-puppet/leefichero.rb /usr/lib/ruby/vendor_ruby/facter/leefichero.rb
/usr/share/linex-ubuntu-puppet/sinc_puppet /usr/sbin/sinc_puppet
/usr/share/linex-ubuntu-puppet/sincpuppet /etc/init.d/sincpuppet
/usr/share/linex-ubuntu-puppet/sinc-puppet /etc/network/if-up.d/sinc-puppet
/usr/share/linex-ubuntu-puppet/sincpuppet.default /etc/default/sincpuppet
ubuntu/bionic/all/linex-ubuntu-puppet/debian/postinst
#!/bin/bash
set -e
mkdir -p /etc/pkgsync
touch /etc/pkgsync/mayhave
touch /etc/pkgsync/maynothave
invoke-rc.d puppet stop
update-rc.d -f puppet remove
update-rc.d -f sincpuppet remove
[ -x /bin/systemctl ] && systemctl disable puppet.service
/usr/sbin/sinc_puppet &
exit 0
ubuntu/bionic/all/linex-ubuntu-puppet/debian/postrm
#!/bin/bash
set -e
PKG="linex-ubuntu-puppet"
SHAREDIR="/usr/share/linex-ubuntu-puppet"
remove_divert() {
diverter=$(dpkg-divert --listpackage $1)
if [ "$diverter" = "linex-ubuntu-puppet" ]; then
dpkg-divert --package linex-ubuntu-puppet --rename --remove $1
fi
}
if [ "$1" = remove ]; then
remove_divert /etc/puppet/puppet.conf
fi
if [ "$1" = purge ]; then
update-rc.d sincpuppet remove
fi
exit 0
ubuntu/bionic/all/linex-ubuntu-puppet/debian/preinst
#!/bin/bash
set -e
PKG="linex-ubuntu-puppet"
SHAREDIR="/usr/share/linex-ubuntu-puppet"
divert() {
diverted_file=$1
dpkg-divert --package "$PKG" --add --rename \
--divert "${diverted_file}-pre-$PKG" $diverted_file
}
divert /etc/puppet/puppet.conf
exit 0
ubuntu/bionic/all/linex-ubuntu-puppet/debian/rules
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/escuela2.0
use=ubuntu1604
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/leefichero.rb
# Archivo /usr/lib/ruby/vendor_ruby/facter/leefichero.rb
# Se utiliza para leer fichero /etc/escuela2.0 y anadir variables a facter
if File.exists?("/etc/escuela2.0")
File.open("/etc/escuela2.0").each do |line|
var = nil
value = nil
var = $1 and val = $2 if line =~ /^(.+)=(.+)$/
if var != nil && val != nil
Facter.add(var) do
setcode { val }
end
end
end
end
####
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/puppet.conf
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
server=puppetinstituto
pluginsync=false
[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc-puppet
#!/bin/bash
# Colocar /etc/network/if-up.d/ para lanzar sinc_puppet cuando se levanta la interfaz de red.
[ "$IFACE" != "lo" ] || exit 0
/usr/sbin/sinc_puppet &
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc_puppet
#!/bin/bash
# Script para tratar de realizar la sincronización del cliente puppet
# Colocar en /etc/network/if-up.d/ para que se ejecute al levantar el interfaz de red
# Desde AdministracionSI no colocamos el fichero directamente en /etc/network/if-up.d/. En su lugar se coloca sinc-puppet para evitar retardos en la activación de interfaces de red.
# Esteban M. Navas Martín
# Fecha última modificación: 20/12/2016
# Modificado por Administracionsi: 03/02/2017
export DEBIAN_FRONTEND=noninteractive
export VERSION=2.15
export PATH="${PATH:+$PATH:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
SCRIPT=`basename "$0"`
function print_version {
echo "$SCRIPT $VERSION"
}
function print_help {
echo "$SCRIPT $VERSION"
echo "Automated sinc puppet client"
echo ""
echo "Usage: $0 [OPTIONS]"
echo "Recognized options:"
echo " -h display this help and exit"
echo " -v display $SCRIPT version and exit"
echo " -f force $SCRIPT on SPLAYLIMIT"
echo " -f now force $SCRIPT now"
echo " -r renew cert client"
echo ""
}
function solveapterrors {
idioma=$LC_ALL
export LC_ALL=C
apt-get check 1>/dev/null 2>/tmp/apterrors
if [ -s /tmp/apterrors ]; then
grep "Unmet dependencies. Try using -f." /tmp/apterrors && apt-get -yf install && dpkg --configure -a && apt-get -y autoremove
grep "dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem." /tmp/apterrors && dpkg --configure -a && apt-get -yf install && apt-get -y autoremove
grep -E 'Encountered a section with no Package: header|Problem with MergeList ' /tmp/apterrors && rm -rf /var/lib/apt/lists/
fi
export LC_ALL=$idioma
}
function dosync {
if [ "$1" == "-f" ] && [ "$2" == "now" ]; then
echo "Conexión con servidor de puppet. Sincronizando puppet....." | logger -s -t $0
puppet agent --onetime --no-daemonize >/dev/null 2>&1
if [ $? -eq "0" ]; then
echo "Sistema PUPPET correcto" | logger -s -t $0
exit 0
fi
else
echo "Conexión con servidor de puppet." | logger -s -t $0
echo "Esperando un tiempo máximo de $SPLAYLIMIT para sincronizar puppet....." | logger -s -t $0
puppet agent --onetime --no-daemonize --splay --splaylimit $SPLAYLIMIT >/dev/null 2>&1
if [ $? -eq "0" ]; then
echo "Sistema PUPPET correcto" | logger -s -t $0
exit 0
fi
fi
}
# Leer y procesar argumentos
while getopts ":f: rvh" opt
do
case $opt in
v ) print_version
exit 0
;;
h ) print_help
exit 0
;;
f) force="-f"
now=$OPTARG
;;
r) renew="-r"
;;
\? ) echo "Opcion invalida -$OPTARG"
exit 1
;;
: ) force="-f"
now=""
esac
done
shift $((OPTIND-1))
# Mostrar ayuda si un caracter no deseado es introducido##
if [ -n "$1" ]; then
print_help
fi
# Matamos procesos detenidos
stopped_processes=$(ps auwx | awk 'NR>1 && $8 ~ "T" {print $2}')
if [ "$stopped_processes" ]; then kill -9 $stopped_processes; fi
#Definimos fichero de lock
lockfile=/tmp/sincpuppet
# Matamos todos los procesos de sinc_puppet excepto el último que se haya
sinc_puppet_processes=$(pgrep -c sinc_puppet)
if [ "$sinc_puppet_processes" -gt "1" ]; then
kill -9 $(ps -ef|grep "sinc_puppet"|grep -v grep| awk '{print $2}' |grep -v $$) 2>/dev/null
#Si matamos con kill -9 todos los procesos sinc_puppet debemos borrar fichero de lock porque sino el proceso actual muere.
lockfile-remove $lockfile
fi
# Nos aseguramos de que sólo exista una instancia de sinc_puppet corriendo
# Eliminar fichero de bloqueo al salir
trap "lockfile-remove $lockfile; exit" INT TERM EXIT
lockfile-check $lockfile
if [ $? -eq 0 ] ; then
# Si existe el fichero de bloqueo
# echo >&2 "lock not acquired, giving up: $lockfile"
exit 1
else
# Si no existe el fichero de bloqueo
lockfile-create $lockfile # Creamos el fichero de bloqueo
# echo "lock acquired: $lockfile"
fi
# El parámetro WAITFORCERT ya no se usa. Lo mantenemos temporalmente por si fuera necesario
# más adelante
WAITFORCERT="30"
LOCALES="es_ES.UTF-8"
# Controlamos la ejecución manual o automática de sinc_puppet
ENABLE=yes
[ -r /etc/default/sincpuppet ] && . /etc/default/sincpuppet
if [ "$ENABLE" == "no" ] || [ ! "$ENABLE" ]; then
echo " * [info]: La aplicación 'sinc_puppet' está desactivada en /etc/default/sincpuppet."
echo " Para activarla poner el valor ENABLE=yes."
exit 0
fi
# Establecemos los locales por defecto
export LANG=$LOCALES
export LANGUAGE="es_ES:es:en"
export LC_ALL=$LOCALES
# Número máximo de segundos sin sincronizar con el servidor puppet
MAXTIME=`expr $INTERVAL \* 3600`
# Calculamos la diferencia
uno=$(stat -c %Y /var/log/syslog)
dos=$(stat -c %Y /var/lib/puppet/state/state.yaml)
dife=$((uno-dos))
dife2=0
if [ -f /var/lib/puppet/state/agent_catalog_run.lock ]; then
tres=$(stat -c %Y /var/lib/puppet/state/agent_catalog_run.lock)
dife2=$((uno-tres))
fi
if [ $dife2 -gt $MAXTIME ]; then
rm -f /var/lib/puppet/state/agent_catalog_run.lock
fi
solveapterrors
echo "La última sincronización con PUPPET fue hace: "$(($dife / 3600)) "horas" | logger -s -t $0
echo "Intervalo de sincronización con PUPPET: $INTERVAL horas" | logger -s -t $0
echo
# Salimos si no se ha alcanzado el tiempo máximo sin sincronizar con PUPPET o no se ha forzado la ejecución
if [ $dife -lt $MAXTIME ] || [ $# -eq 1 ] && [ "$force" != "-f" ] || [ $# -eq 1 ] && [ "$renew" != "-r" ]; then exit 0; fi
ping -c 1 $PING_SERVER >/dev/null 2>&1
ERROR=$?
MAX=0
until [ $ERROR -eq "0" ] || [ $MAX -eq $PING_TRIES ]; do
echo "Falló Ping al servidor Puppet. Nuevo intento en $PING_INTERVAL segundos....." | logger -s -t $0
MAX=`expr $MAX + 1`
sleep $PING_INTERVAL
ping -c 1 $PING_SERVER >/dev/null 2>&1
ERROR=$?
done
if [ $MAX -eq $PING_TRIES ]; then
echo "Imposible contactar con el servidor....." | logger -s -t $0
exit $MAX
fi
# Activamos puppet, por si estuviera desactivado
puppet agent --enable
if [ "$renew" == "-r" ]; then
uuid=$(/usr/bin/uuidgen -t) && sed -i "s/certname=.*/certname=$uuid/" /usr/share/linex-ubuntu-puppet/puppet.conf
find /var/lib/puppet/ssl/ -type f -name *.pem -not -name ca.pem -not -name crl.pem -exec rm -f {} \;
dosync $force $now
fi
# Obtenemos el uuid del fichero puppet.conf
uuid=$(sed -n 's|certname=\(.*\)|\1|p' /usr/share/linex-ubuntu-puppet/puppet.conf)
# Si no existe el certificado del cliente, ejecutamos puppet tratando de recibir un certificado
if [ -z "$uuid" ]; then
uuid=$(/usr/bin/uuidgen -t) && sed -i "/server=puppetinstituto/a certname=$uuid" /usr/share/linex-ubuntu-puppet/puppet.conf
echo "Se ha generado un nuevo uuid para este host: $uuid" | logger -s -t $0
find /var/lib/puppet/ssl/ -type f -name *.pem -not -name ca.pem -not -name crl.pem -exec rm -f {} \;
dosync $force $now
fi
test -f /var/lib/puppet/ssl/certs/$uuid.pem
if [ $? -eq "0" ]; then
dosync $force $now
#Si existe el certificado uuid y no se consigue sincronizar. Se sincroniza la hora, se genera un nuevo uuid y se borran todos los certificados dentro de /var/lib/puppet/ssl
ntpdate -u servidor 2>/dev/null
uuid=$(/usr/bin/uuidgen -t) && sed -i "s/certname=.*/certname=$uuid/" /usr/share/linex-ubuntu-puppet/puppet.conf
find /var/lib/puppet/ssl/ -type f -name *.pem -exec rm -f {} \;
dosync $force $now
else
[ -f /var/lib/puppet/state/puppetdlock ] && rm -f /var/lib/puppet/state/puppetdlock
uuid=$(/usr/bin/uuidgen -t) && sed -i "s/certname=.*/certname=$uuid/" /usr/share/linex-ubuntu-puppet/puppet.conf
find /var/lib/puppet/ssl/ -type f -name *.pem -not -name $uuid.pem -not -name ca.pem -not -name crl.pem -exec rm -f {} \;
dosync $force $now
fi
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet
#!/bin/bash
### BEGIN INIT INFO
# Provides: sincpuppet
# Required-Start: $local_fs $network
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Daemon to synchronize puppet
# Description: daemon to synchronize puppet.
### END INIT INFO
# When the machine has unavailable network, nslcd slow down everything trying to take ldap info.
# This daemon try to recognize that unavailability and stop nslcd daemon until network is available again.
SINCPUPPET_BIN=/usr/sbin/sinc_puppet
SINCPUPPET_DESC="Daemon to synchronize puppet"
[ -x "$SINCPUPPET_BIN" ] || exit 0
. /lib/lsb/init-functions
start() {
# set up state directory
log_daemon_msg "Starting $SINCPUPPET_DESC" "SincPuppet"
$SINCPUPPET_BIN &
log_end_msg $?
}
stop() {
log_daemon_msg "Stopping $SINCPUPPET_DESC" "SincPuppet"
killall sinc_puppet
log_end_msg $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
esac
exit 0
ubuntu/bionic/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet.default
# Defaults for sinc_puppet
#
# Definimos el idioma por defecto al ejecutar sinc_puppet
# LOCALES="es_ES.UTF-8"
LOCALES="es_ES.UTF-8"
# Activar o desactivar sinc_puppet:
# ENABLE="yes": activa sinc_puppet (opción por defecto)
# ENABLE="no" : desactiva sinc_puppet
# Si no existe la variable ENABLE o no tiene valor, es equivalente al valor 'yes'.
ENABLE="yes"
# Número máximo de horas sin sincronizar con el servidor puppet
# INTERVAL="12" # horas
INTERVAL="12" # horas
# Nombre DNS del servidor al que realizar ping para comprobar que estamos en el centro
# PING_SERVER="puppetinstituto"
PING_SERVER="puppetinstituto"
# Intervalo para volver a realizar ping en segundos
# PING_INTERVAL="30" # segundos
PING_INTERVAL="30" # segundos
# Número máximo de ping a realizar antes de dejar de intentar sincronizar con puppet
# PING_TRIES="3"
PING_TRIES="3"
# Definimos un tiempo máximo en minutos para retrasar la sincronización con el servidor
# El cliente se sincronizará de forma pseudoaleatoria dentro de este intervalo
# Básicamente sirve para evitar que muchas peticiones simultáneas de clientes saturen al servidor
# Este ajuste puede definirse en segundos (30 or 30s), minutos (30m), horas (6h),
# días (2d), o años (5y).
# SPLAYLIMIT="3m"
SPLAYLIMIT="3m"
# 'puppet agent' conectará con el servidor en intervalos de 'WAITFORCERT' segundos para pedir un certificado al servidor
# WAITFORCERT="30"
WAITFORCERT="30"
ubuntu/bionic/amd64/leeme.txt
Rama para amd64
ubuntu/bionic/i386/leeme.txt
Rama para i386

Exportar a: Unified diff