Outils pour utilisateurs

Outils du site


admin:services:apt-dater

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
admin:services:apt-dater [2014/10/22 13:26] – En speed Ajouter une clef pour un admin sur une machine managée par apt-dater zertrinadmin:services:apt-dater [2020/04/26 00:13] (Version actuelle) klafyvel
Ligne 1: Ligne 1:
 [[:admin|< retour à la page de l'administration technique]] [[:admin|< retour à la page de l'administration technique]]
  
-Chaque serveur de FedeRez est configuré pour être mis à jour via [[http://www.ibh.de/apt-dater/ apt-dater]].+Chaque serveur de FedeRez est configuré pour être mis à jour via [[http://www.ibh.de/apt-dater/|apt-dater]]. 
 +======= Comment faire les mises à jour ? =======
  
-====== Infos générales ======+{{page>admin:services:apt-dater:controller:utilisation&nofooter}}
  
-TODO+======= Installation sur les hosts =======
  
-===== En speed ====+{{page>admin:services:apt-dater:host&nofooter}}
  
-==== Ajouter une clef pour un admin sur une machine managée par apt-dater ====+{{page>admin:services:apt-dater:wrapper&nofooter}}
  
-Sur la/les machine(s) concernée(s):+======= Le contrôleur =======
  
-:!Attention ici exemple de zertrin, adapter la clef et les IP autorisées à votre cas !+{{page>admin:services:apt-dater:controller&nofooter}}
  
-  cat << EOF >> ~aptdater/.ssh/authorized_keys +====== Liens (potentiellement) utiles ======
-  command="exec /usr/local/bin/apt-dater-host-wrapper",no-user-rc,no-X11-forwarding,from="127.0.0.1,5.135.159.117,2001:41d0:8:d975::1" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpwXiaxQhSI/9jyxmsVewnsBQeBNWZZhoZaGfpFHWsciy1j/+hC5ectW6kvsbm6mf4YkKx2Hc29oRSm7lsyv3+itBS5HbnzHtdbaKTeWKZIhXI/TlMw8RA0+5qX9vKT0sJhkqFyZoXRpw9tKh7+zehez1FFJV60y8U/qm4mXlgiLZcVh4hXG+U7JfxYAQntWf47sNNoqG06CVFTJs8NR6WE6kpvZTNZrBoHwzdVbPKKaRRrgjyUx7Qxb/1XUnv+Iwe5ZYUlyMF+2jAM1YXk9+fnCkaEIWsJTHEsrVGZaUlDu9qVQOUun4B2kU8pqUK9oqKp7svsqtboi5mWGhcNkMN zertrin@gmail.com +
-  EOF +
- +
-====== Mise en place initiale d'apt-dater ====== +
- +
-===== Liens (potentiellement) utiles =====+
  
   * Site officiel : http://www.ibh.de/apt-dater/   * Site officiel : http://www.ibh.de/apt-dater/
   * Référence pour la config et la sécurisation d'apt-dater : https://sdeziel.info/apt-dater/index.html   * Référence pour la config et la sécurisation d'apt-dater : https://sdeziel.info/apt-dater/index.html
  
-===== Installation sur les machines managées ===== 
- 
-Installation du paquet : 
- 
-  apt-get install apt-dater-host 
- 
-===== Configuration initiale sur les machines managées ===== 
- 
-==== Ajout d'un utilisateur dédié ==== 
- 
-  adduser --quiet --system --home /var/lib/aptdater --group --shell /bin/sh aptdater 
- 
-==== Configuration de SSH pour apt-dater ==== 
- 
-On n'autorise que des connexions par clef depuis certaines IPs et on n'autorise que l'exécution d'un wrapper de sécurisation: 
- 
-  mkdir -m 0700 ~aptdater/.ssh 
- 
-Ajout de la clef d'un admin dans le authorized_keys d'aptdater: 
- 
-:!: Attention ici exemple de zertrin, adapter la clef et les IP autorisées à votre cas ! 
- 
-  cat << EOF >> ~aptdater/.ssh/authorized_keys 
-  command="exec /usr/local/bin/apt-dater-host-wrapper",no-user-rc,no-X11-forwarding,from="127.0.0.1,5.135.159.117,2001:41d0:8:d975::1" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpwXiaxQhSI/9jyxmsVewnsBQeBNWZZhoZaGfpFHWsciy1j/+hC5ectW6kvsbm6mf4YkKx2Hc29oRSm7lsyv3+itBS5HbnzHtdbaKTeWKZIhXI/TlMw8RA0+5qX9vKT0sJhkqFyZoXRpw9tKh7+zehez1FFJV60y8U/qm4mXlgiLZcVh4hXG+U7JfxYAQntWf47sNNoqG06CVFTJs8NR6WE6kpvZTNZrBoHwzdVbPKKaRRrgjyUx7Qxb/1XUnv+Iwe5ZYUlyMF+2jAM1YXk9+fnCkaEIWsJTHEsrVGZaUlDu9qVQOUun4B2kU8pqUK9oqKp7svsqtboi5mWGhcNkMN zertrin@gmail.com 
-  EOF 
- 
-  chown aptdater: -R ~aptdater/.ssh 
- 
-==== Configuration de sudo pour apt-dater ==== 
- 
-  cat << "EOF" > /etc/sudoers.d/apt-dater-host 
-  # package installation is denied 
-  aptdater ALL = (root) NOPASSWD: /usr/bin/apt-get update 
-  aptdater ALL = (root) NOPASSWD: /usr/bin/apt-get clean 
-  aptdater ALL = (root) NOPASSWD: /usr/bin/apt-get dist-upgrade 
-  aptdater ALL = (root) NOPASSWD: /usr/bin/apt-get --assume-yes dist-upgrade 
-  aptdater ALL = (root) NOPASSWD: /usr/bin/apt-get --quiet --simulate --fix-broken --allow-unauthenticated dist-upgrade 
-  EOF 
- 
-  chmod 0440 /etc/sudoers.d/apt-dater-host 
- 
-==== Limitation de la priorité d'apt-dater apt-dater (optionnel) ==== 
- 
-  printf "aptdater\t-\tpriority\t10\n" > /etc/security/limits.d/aptdater.conf 
- 
-==== Création d'un wrapper pour sécuriser apt-dater ==== 
- 
-À placer dans ''/usr/local/bin/apt-dater-host-wrapper'' 
- 
-<code bash> 
-#!/bin/sh 
- 
-set -e 
-set -u 
- 
-# Explicitly set the PATH to that of ENV_SUPATH in /etc/login.defs and unset 
-# various other variables. For details, see: 
-# https://wiki.ubuntu.com/SecurityTeam/AppArmorPolicyReview#Execute_rules 
-export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
-export ENV= 
-export CDPATH= 
- 
-LOGGER="/usr/bin/logger" 
-APT_DATER_HOST="$(which apt-dater-host)" 
-KILL="/bin/kill" 
-SLEEP="/bin/sleep" 
- 
-# Install command allowed? 
-INSTALL_ALLOWED="false" 
-if [ "$#" -eq 1 ]; then 
-  if [ "$1" = "--install-allowed" ]; then 
-    INSTALL_ALLOWED="true" 
-  fi 
-fi 
- 
-illegal_command() { 
-  # Do not log SSH_ORIGINAL_COMMAND for security reasons 
-  $LOGGER "$(basename $0) illegal command denied" 
-  # Default deny 
-  $KILL -9 $PPID 
-  exit 0 
-} 
- 
-check_ssh_command() { 
-  if [ "$#" -lt 2 ]; then 
-    # not in the form of apt-dater-host upgrade 
-    illegal_command 
-  fi 
- 
-  if [ "$1" != "apt-dater-host" ]; then 
-    # not invoking apt-dater-host 
-    illegal_command 
-  else 
-    # Remove the 1st arg with later replace it with the 
-    # fully qualified path to apt-dater-host 
-    shift 
-  fi 
- 
-  COMMAND="$1" 
-  shift 
- 
-  if [ "$COMMAND" = "refresh" -o "$COMMAND" = "kernel" ]; then 
-    $APT_DATER_HOST $COMMAND 
-  elif [ "$COMMAND" = "upgrade" ]; then 
-    # Don't kill the shell session right away when 
-    # upgrading/installing to please apt-dater 
-    $APT_DATER_HOST $COMMAND && $SLEEP 0.5 
-  elif [ "$COMMAND" = "install" ]; then 
-    if [ "$INSTALL_ALLOWED" = "true" ]; then 
-      # Don't kill the shell session right away when 
-      # upgrading/installing to please apt-dater 
-      $APT_DATER_HOST $COMMAND $* && $SLEEP 0.5 
-    else 
-      illegal_command 
-    fi 
-  fi 
-} 
- 
-if [ -z "$SSH_ORIGINAL_COMMAND" ]; then 
-  illegal_command 
-fi 
- 
-case "$SSH_ORIGINAL_COMMAND" in 
-  *\&*) 
-    illegal_command 
-    ;; 
-  *\(*) 
-    illegal_command 
-    ;; 
-  *\{*) 
-    illegal_command 
-    ;; 
-  *\;*) 
-    illegal_command 
-    ;; 
-  *\>*) 
-    illegal_command 
-    ;; 
-  *\`*) 
-    illegal_command 
-    ;; 
-  *\|*) 
-    illegal_command 
-    ;; 
-  apt-dater-host\ refresh) 
-    check_ssh_command $SSH_ORIGINAL_COMMAND 
-    ;; 
-  apt-dater-host\ upgrade) 
-    check_ssh_command $SSH_ORIGINAL_COMMAND 
-    ;; 
-  apt-dater-host\ install\ *) 
-    check_ssh_command $SSH_ORIGINAL_COMMAND 
-    ;; 
-  apt-dater-host\ kernel) 
-    check_ssh_command $SSH_ORIGINAL_COMMAND 
-    ;; 
-  *) 
-    illegal_command 
-    ;; 
-esac 
-</code> 
- 
-En oubliant pas de le rendre exécutable: 
- 
-  chmod 0755 /usr/local/bin/apt-dater-host-wrapper 
  
admin/services/apt-dater.1413977191.txt.gz · Dernière modification : 2014/10/22 13:26 de zertrin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki