Archive

Articles taggués ‘securite’

Using Rsync and SSH

23/01/2024 Comments off

Source: troy.jdmz.net

Keys, Validating, and Automation

This document covers using cron, ssh, and rsync to backup files over a local network or the Internet. Part of my goal is to ensure no user intervention is required when the computer is restarted (for passwords, keys, or key managers).
I like to backup some logging, mail, and configuration information sometimes on hosts across the network and Internet, and here is a way I have found to do it. You’ll need these packages installed:
  • rsync
  • openssh
  • cron (or vixie-cron)

Please note these instructions may be specific to Red Hat Linux versions 7.3, 9, and Fedora Core 3, but I hope they won’t be too hard to adapt to almost any *NIX type OS. The man pages for ‘ssh’ and ‘rsync’ should be helpful to you if you need to change some things (use the « man ssh » and « man rsync » commands). Lire la suite…

Categories: Système Tags: , , ,

mod_geoip2 Apache module

22/01/2024 Comments off

The mod_geoip2 module embeds GeoIP database lookups into the Apache web server. It is only capable of looking up the IP of a client that connects to the web server, as opposed to looking up arbitrary addresses.

This module works with Apache 2. Please use mod_geoip with Apache 1.

Installation

You may download the latest release of mod_geoip2 or get the latest development version from GitHub. See the included INSTALL file in the tarball for installation details.

Overview

The mod_geoip2 module uses the libGeoIP library to look up geolocation information for a client as part of the http request process. This module is free software, and is licensed under the Apache license.

To compile and install this module, you must first install libGeoIP 1.4.3 or newer.

The mod_geoip2 module takes effect either during request header parsing phase or the post read request phase, depending on whether it is configured for server-wide use or for a specific location/directory.

When enabled, the module looks at the incoming IP address and sets some variables which provide geolocation information for that IP. The variables it set depend on the specific GeoIP database being used (Country, City, ISP, etc.). These variables can be set in either the request notes table, the environment or both depending on the server configuration.

Lire la suite…

Sauvegarder ses données avec Rsync

21/01/2024 Comments off

Source: journaldunadminlinux.fr

En parcourant pas mal de forums, j’ai pu remarquer que pas mal de jeunes admins ne connaissaient pas Rync.

Rsync est un petit outil de sauvegarde extrêmement puissant. Grâce à cette outil j’ai pu sauvegarder des centaines de  giga-octet de données sans problèmes.

Rsync se charge en plus de garder tous les droits et attributs de vos fichiers et gère en natif SSH pour faire une sauvegarde d’une machine vers une autre. Lire la suite…

Connection par ssh derrière un proxy html

18/01/2024 Comments off

Par défaut, ssh ne sait pas se connecter à un serveur si le client est placé derrière un proxy. Pour ajouter cette fonctionnalité, il faut :

– installer le paquet connect-proxy

apt-get install connect-proxy

– ajouter un fichier  ~/.ssh/config (juste pour un compte) ou /etc/ssh/ssh_config (configuration globale) contenant les lignes suivantes :

# on n'a pas besoin de connect pour le réseau local
# il faut modifier ou ajouter des lignes Host pour décrire votre réseau local Host 192.168.0.* ProxyCommand /usr/bin/connect %h %p # toutes les autres adresses utilisent la commande connect
# il faut remplacer l'adresse IP et le port par les valeurs de votre proxy
Host *
ProxyCommand /usr/bin/connect -H 192.168.0.1:8080 %h %p

On peut alors se connecter sans problème à un hôte par la commande classique : ssh identifiant@serveur

Categories: Réseau, Système Tags: , , ,

Forcer logrotate à créer une nouvelle version d’un fichier de log

11/01/2024 Comments off

Récemment, je me suis aperçu que mon dernier fichier /var/log/auth.log n’avait pas été renouvelé depuis le 17/04/2011… Evidemment, ça n’aide pas à analyser sereinement les fichiers de logs, vu la taille que ça génère: 105306586 c’est-à-dire plus de 100Mo !

Je voulais conserver 26 semaines de logs pour analyser les tentatives d’intrusion et calculer leur évolution au fur et à mesure que je renforçais la protection de mon serveur.

Tout simple:

  • créer un fichier séparé pour auth.log qu’on appelle /etc/logrotate.d/auth:

/var/log/auth.log

{
        rotate 26
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                reload rsyslog >/dev/null 2>&1 || true
        endscript
}

  • retirer la référence à /var/log/auth.log dans /etc/logrotate.d/auth
  • redémarrer le service rsyslog:
/etc/init.d/rsyslog restart

Lire la suite…