on move tout a dans /usr/scripts/archives
darcs-hash:20011221212555-a279a-121af29168739a91cc51cf72acef9af7f0ed96c2.gz
This commit is contained in:
parent
8c71d8f410
commit
c7a90e2085
27 changed files with 0 additions and 1066 deletions
11
E-mail_all
11
E-mail_all
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/zsh
|
|
||||||
./remail $1 $2 > email.tmp
|
|
||||||
chmod a+x email.tmp
|
|
||||||
echo maintenant il faut editer ./email.tmp avec pico
|
|
||||||
echo et virrer les ^M qui apparaissent.
|
|
||||||
echo apres, on lance ./email.tmp et on l'efface
|
|
||||||
#./email.tmp
|
|
||||||
#rm email.tmp
|
|
||||||
echo Done
|
|
||||||
# envoie un E-mail a tout le monde
|
|
||||||
# orthographe : E-mail_all fichier.txt "titre"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
cat $3 | smbclient -U $1 -M $2
|
|
93
arpanoid
93
arpanoid
|
@ -1,93 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# Dis, emacs, c'est du -*- python -*-, ça !
|
|
||||||
#
|
|
||||||
# C.Chépélov, 19 janvier 1999. Suite à discussion avec Olivier DALOY, et
|
|
||||||
# des trucs louches dans ses logs. Merci, merci ARP !!
|
|
||||||
|
|
||||||
import config
|
|
||||||
import pickle,string,os
|
|
||||||
|
|
||||||
# Phase 1 : lire les données théoriques, les retrier pour être exploitables.
|
|
||||||
|
|
||||||
ZONEDB = pickle.load(open(config.CFG_FILE_ROOT+"Zone.db","r"))
|
|
||||||
|
|
||||||
THicn_by_mac = {} # ip, comment, name by MAC (théorique)
|
|
||||||
THncm_by_ip = {} # name, comment, MAC by IP (théorique)
|
|
||||||
|
|
||||||
for name in ZONEDB.keys():
|
|
||||||
(IP,comment,MAC) = ZONEDB[name]
|
|
||||||
THicn_by_mac[MAC] = (IP,comment,name)
|
|
||||||
THncm_by_ip[IP] = (name,comment,MAC)
|
|
||||||
|
|
||||||
# Phase 2 : Lire les données réelles, les mettres dans des dicos pour être
|
|
||||||
# exploitables.
|
|
||||||
|
|
||||||
arp = os.popen("arp -n","r")
|
|
||||||
arp.readline()
|
|
||||||
|
|
||||||
ip_by_mac = {}
|
|
||||||
mac_by_ip = {}
|
|
||||||
while 1:
|
|
||||||
s = arp.readline()
|
|
||||||
if not s: break
|
|
||||||
sl = string.split(s)
|
|
||||||
try:
|
|
||||||
ip = sl[0]
|
|
||||||
|
|
||||||
mac = ""
|
|
||||||
if (sl[1] != "ether") or (sl[2] == "(incomplete)"): raise "incomplete"
|
|
||||||
for c in string.lower(sl[2]):
|
|
||||||
if c in "0123456789abcdef":
|
|
||||||
mac = mac + c
|
|
||||||
if not ip or not mac: break
|
|
||||||
ip_by_mac[mac] = ip
|
|
||||||
mac_by_ip[ip] = mac
|
|
||||||
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Phase 3 : en fonction des gens qu'on a vus, faire une comparaison...
|
|
||||||
# d'abord, par IP vues :
|
|
||||||
|
|
||||||
try:
|
|
||||||
problems = open("/var/log/arpanoid","r").readlines()
|
|
||||||
except:
|
|
||||||
problems = []
|
|
||||||
# la liste des problèmes. Sera triée par ordre alphabétique
|
|
||||||
# et les problèmes rendus uniques.
|
|
||||||
# note: on récupère les vieux problèmes, on génèrera le même message
|
|
||||||
# plusieurs fois (pas grave, on virera les messages identiques)
|
|
||||||
|
|
||||||
def log(s):
|
|
||||||
s = s + '\n'
|
|
||||||
if not s in problems: problems.append(s)
|
|
||||||
|
|
||||||
for ip,mac in mac_by_ip.items():
|
|
||||||
|
|
||||||
if THicn_by_mac.has_key(mac):
|
|
||||||
thIP,comment,name = THicn_by_mac[mac]
|
|
||||||
if thIP == ip: pass # print name,' est clair (IP by MAC)'
|
|
||||||
else:
|
|
||||||
if THncm_by_ip.has_key(ip): victim,t1,t2 = THncm_by_ip[ip]
|
|
||||||
else: victim = "(inconnu)"
|
|
||||||
log("%s (%s) usurpe une adresse IP !!! (normal=%s,actuel=%s[%s])" % (name,comment,thIP,ip,victim))
|
|
||||||
else:
|
|
||||||
log("MACHINE INCONNUE (intruse ?) MAC=%s !" % mac)
|
|
||||||
|
|
||||||
if THncm_by_ip.has_key(ip):
|
|
||||||
name,comment,thMAC = THncm_by_ip[ip]
|
|
||||||
if thMAC == mac: pass # print name,' est clair (MAC by IP)'
|
|
||||||
else:
|
|
||||||
if THicn_by_mac.has_key(mac): t1,t2,name = THicn_by_mac[mac]
|
|
||||||
else: victim = "(inconnu)"
|
|
||||||
log("%s (%s) utilise une autre carte réseau !!! (normal=%s,actuel=%s[%s]" % (name,comment,thMAC,mac,victim))
|
|
||||||
else:
|
|
||||||
diag = "(intruse ?)"
|
|
||||||
if THicn_by_mac.has_key(mac):
|
|
||||||
THip,comment,name = THicn_by_mac[mac]
|
|
||||||
diag = "%s de %s" % (name,comment)
|
|
||||||
log("MACHINE AVEC FAUX IP=%s (%s)!" % (ip,diag))
|
|
||||||
problems.sort()
|
|
||||||
|
|
||||||
print string.join(problems,"")
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
subject="logs ARPanoid `date` "
|
|
||||||
dest="root@crans.ens-cachan.fr"
|
|
||||||
|
|
||||||
cat <<Fini | cat - /var/log/arpanoid | mail -s "$subject" $dest
|
|
||||||
|
|
||||||
Résultats de la chasse "ARPanoid" de la journée :
|
|
||||||
-------------------------------------------------
|
|
||||||
|
|
||||||
Fini
|
|
||||||
|
|
||||||
mv -f /var/log/arpanoid /var/log/arpanoid.bak
|
|
||||||
touch /var/log/arpanoid
|
|
||||||
chmod 640 /var/log/arpanoid
|
|
||||||
chown root:admin /var/log/arpanoid
|
|
||||||
/etc/CRANS/code/arpanoid > /var/log/arpanoid 2>/dev/null
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
/etc/CRANS/code/arpanoid > /var/log/arpanoid 2>/dev/null
|
|
21
auto-claque
21
auto-claque
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# CC 2/2/1999 horrible kludge
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Pour des raisons bizarres (bug driver SMC ? matériel ?), les interfaces
|
|
||||||
# eth1 et eth2 bloquent régulièrement.
|
|
||||||
# en général, un claquage suffit à les relancer. Par ailleurs, un claquage
|
|
||||||
# ne bloque pas les communications -- on peut donc jouer à le faire
|
|
||||||
# régulièrement.
|
|
||||||
#
|
|
||||||
|
|
||||||
#a enlever les commentaires! 19.02
|
|
||||||
# 20/01/2000 jerome reactive le script
|
|
||||||
|
|
||||||
echo "Claquage des interfaces" | /usr/bin/logger -t "AutoClaque" -p user.warn
|
|
||||||
|
|
||||||
ifconfig eth0 down; ifconfig eth0 up; route add default gw 138.231.136.2
|
|
||||||
|
|
||||||
ifconfig eth1 down; ifconfig eth1 up
|
|
||||||
ifconfig eth2 down; ifconfig eth2 up 138.231.137.2 netmask 255.255.255.0 broadcast 138.231.137.255
|
|
||||||
ifconfig eth3 down; ifconfig eth3 up
|
|
186
beastie.c
186
beastie.c
|
@ -1,186 +0,0 @@
|
||||||
/*
|
|
||||||
* Un faux daemon.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1999 Association CRANS.
|
|
||||||
*
|
|
||||||
* Auteur: Olivier Saut <Olivier.Saut@crans.ens-cachan.fr>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <varargs.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
|
|
||||||
#ifndef LINUX
|
|
||||||
#include <libutil.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define kZamok_Tourne 1
|
|
||||||
#define kPORT 514 /* Port de rshd */
|
|
||||||
#define kMaxDaemonChildren 10
|
|
||||||
|
|
||||||
int nbrFils;
|
|
||||||
|
|
||||||
|
|
||||||
int daemon_init(void) {
|
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
if((pid = fork())<0)
|
|
||||||
return (-1);
|
|
||||||
else if (pid !=0) {
|
|
||||||
(void)fprintf(stdout,"beastie launched : %d\n",pid);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
setsid();
|
|
||||||
chdir("/");
|
|
||||||
umask(0);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Attention subtil (waitpid plutot que wait) :-) */
|
|
||||||
void zombie(int signo) {
|
|
||||||
pid_t pid;
|
|
||||||
int stat;
|
|
||||||
|
|
||||||
while ((pid = waitpid(-1, &stat, WNOHANG)) > 0)
|
|
||||||
nbrFils--;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sigterm(int signo) {
|
|
||||||
syslog(LOG_NOTICE,"beastie killed by SIGTERM.");
|
|
||||||
closelog();
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
|
||||||
int serv_sock, client_sock, cli_len;
|
|
||||||
struct sockaddr_in serv_addr, cli_addr;
|
|
||||||
struct hostent *cli_ent;
|
|
||||||
char *clientname,*message;
|
|
||||||
int PORT;
|
|
||||||
pid_t pid;
|
|
||||||
sig_t previous_handler;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
if(argc>1)
|
|
||||||
PORT=atoi(argv[1]);
|
|
||||||
else
|
|
||||||
PORT=kPORT;
|
|
||||||
|
|
||||||
if(setuid(getuid())) {
|
|
||||||
perror("Setuid.");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On se daemonize */
|
|
||||||
if(daemon_init()) {
|
|
||||||
perror("Initialize as daemon.");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pour éviter les zombies (vade retro...) */
|
|
||||||
previous_handler = signal(SIGCHLD,(sig_t)zombie);
|
|
||||||
if(previous_handler==SIG_ERR) {
|
|
||||||
perror("Installing SIGCHLD handler");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pour détecter le SIGTERM */
|
|
||||||
previous_handler = signal(SIGTERM,(sig_t)sigterm);
|
|
||||||
if(previous_handler==SIG_ERR) {
|
|
||||||
perror("Installing SIGTERM handler");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
nbrFils=0;
|
|
||||||
|
|
||||||
#ifndef LINUX
|
|
||||||
setproctitle("ecoute le port %d",PORT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
openlog("beastie", LOG_PID|LOG_CONS,LOG_LOCAL2);
|
|
||||||
|
|
||||||
serv_sock = socket(AF_INET, SOCK_STREAM, 0);
|
|
||||||
if (serv_sock < 0)
|
|
||||||
{
|
|
||||||
perror("Creating server socket.");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On remplit la structure */
|
|
||||||
bzero((char *) &serv_addr, sizeof (serv_addr));
|
|
||||||
serv_addr.sin_family = AF_INET;
|
|
||||||
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
|
||||||
serv_addr.sin_port = htons(PORT);
|
|
||||||
|
|
||||||
/* Et on lie la socket au port */
|
|
||||||
if (bind(serv_sock, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0)
|
|
||||||
{
|
|
||||||
perror("Binding server socket.");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
listen(serv_sock,5);
|
|
||||||
|
|
||||||
while(kZamok_Tourne) {
|
|
||||||
|
|
||||||
cli_len = sizeof (cli_addr);
|
|
||||||
bzero((char *) &cli_addr, sizeof (cli_addr));
|
|
||||||
|
|
||||||
client_sock = accept(serv_sock, (struct sockaddr *) &cli_addr, &cli_len);
|
|
||||||
if (client_sock < 0)
|
|
||||||
{
|
|
||||||
perror("Accepting connection on server socket.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On forke, on traite la requete dans le fils */
|
|
||||||
/* Evaluation paresseuse */
|
|
||||||
if((nbrFils++ < kMaxDaemonChildren) && ((pid=fork())==0) ) {
|
|
||||||
close(serv_sock);
|
|
||||||
clientname=inet_ntoa(cli_addr.sin_addr); /* On recupere le nom */
|
|
||||||
/* Hehe t'es loggue mon pote */
|
|
||||||
if(strcmp(clientname, "127.0.0.1")) {
|
|
||||||
if (!((cli_ent= gethostbyaddr((char *)&cli_addr.sin_addr.s_addr,
|
|
||||||
sizeof (u_long), AF_INET)) == (struct hostent *)0)) {
|
|
||||||
snprintf(buffer,1023, "Tentative de connexion de %s au port %d.",cli_ent->h_name,PORT);
|
|
||||||
syslog(LOG_NOTICE,buffer );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
snprintf(buffer,1023, "Tentative de connexion de %s au port %d.",clientname,PORT);
|
|
||||||
syslog(LOG_NOTICE,buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(client_sock);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
/* Fin du fork */
|
|
||||||
|
|
||||||
close(client_sock);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
closelog();
|
|
||||||
close(serv_sock);
|
|
||||||
exit( 0);
|
|
||||||
}
|
|
52
cdecode
52
cdecode
|
@ -1,52 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Dis, emacs, c'est du -*- python -*-
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
Programme fait pour encoder les chambres suivant le cryptage standard
|
|
||||||
pour le bâtiment G (le F peut aussi s'en servir). Inutile au B, il y a déjà un
|
|
||||||
autre mapping (les prises réseau sont numérotées différemment des chambres)
|
|
||||||
|
|
||||||
Ceci ne résistera évidemment pas à une attaque cryptographique en règle.
|
|
||||||
|
|
||||||
L'algorithme étant réellement trivial, il est raisonnable de laisser ce
|
|
||||||
script "chmod 700" et "chown root:root" !
|
|
||||||
|
|
||||||
C.Chepelov 5 novembre 1998 (présente implémentation), mise au point de
|
|
||||||
l'algorithme et première implémentation en Reverse Polish Lisp (HP48) à
|
|
||||||
l'automne 1997.
|
|
||||||
|
|
||||||
Note : l'implémentation de référence est "cencode". L'algo est symétriqe...
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print "usage : %s <numéro de code>" % sys.argv[0]
|
|
||||||
print "exemple : %s 9378 --> 126 " % sys.argv[0]
|
|
||||||
print
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
s_arg = sys.argv[1]
|
|
||||||
try:
|
|
||||||
arg = int(s_arg)
|
|
||||||
if arg >= 10000: raise "pas bon."
|
|
||||||
except:
|
|
||||||
print "L'argument doit être un nombre inférieur à 10000 !"
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
# C'est pas du tout optimal, mais on s'en fout !
|
|
||||||
c1 = int(arg / 100) % 10
|
|
||||||
c2 = int(arg / 10) % 10
|
|
||||||
c3 = arg % 10
|
|
||||||
s = int(arg / 1000) % 10
|
|
||||||
|
|
||||||
f3 = t1 = (10 - c1 + s) % 10
|
|
||||||
f2 = t2 = (10 - c2 + s) % 10
|
|
||||||
f1 = t3 = (10 - c3 + s) % 10
|
|
||||||
|
|
||||||
res = f1 * 100 + f2 * 10 + f3
|
|
||||||
print "Chambre = %d " % res
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
53
cencode
53
cencode
|
@ -1,53 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Dis, emacs, c'est du -*- python -*-
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
Programme fait pour encoder les chambres suivant le cryptage standard
|
|
||||||
pour le bâtiment G (le F peut aussi s'en servir). Inutile au B, il y a déjà un
|
|
||||||
autre mapping (les prises réseau sont numérotées différemment des chambres)
|
|
||||||
|
|
||||||
Ceci ne résistera évidemment pas à une attaque cryptographique en règle.
|
|
||||||
|
|
||||||
L'algorithme étant réellement trivial, il est raisonnable de laisser ce
|
|
||||||
script "chmod 700" et "chown root:root" !
|
|
||||||
|
|
||||||
C.Chepelov 5 novembre 1998 (présente implémentation), mise au point de
|
|
||||||
l'algorithme et première implémentation en Reverse Polish Lisp (HP48) à
|
|
||||||
l'automne 1997.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print "usage : %s <numéro de chambre>" % sys.argv[0]
|
|
||||||
print "exemple : %s 126 --> 9378 " % sys.argv[0]
|
|
||||||
print "Ajouter G ou F selon bâtiment, W ou B selon gaine technique. "
|
|
||||||
print
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
s_arg = sys.argv[1]
|
|
||||||
try:
|
|
||||||
arg = int(s_arg)
|
|
||||||
if arg >= 1000: raise "pas bon."
|
|
||||||
except:
|
|
||||||
print "L'argument doit être un nombre inférieur à 1000 !"
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
# C'est pas du tout optimal, mais on s'en fout !
|
|
||||||
c1 = int(arg / 100) % 10
|
|
||||||
c2 = int(arg / 10) % 10
|
|
||||||
c3 = arg % 10
|
|
||||||
|
|
||||||
s = (c1 + c2 + c3) % 10
|
|
||||||
|
|
||||||
f3 = t1 = (10 - c1 + s) % 10
|
|
||||||
f2 = t2 = (10 - c2 + s) % 10
|
|
||||||
f1 = t3 = (10 - c3 + s) % 10
|
|
||||||
|
|
||||||
res = s * 1000 + f1 * 100 + f2 * 10 + f3
|
|
||||||
print "Code = %d " % res
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
15
check-samba
15
check-samba
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/zsh
|
|
||||||
#script shell par kif 01/10/00
|
|
||||||
|
|
||||||
LOG=/var/log/CransMisc/samba-master.log
|
|
||||||
master=`smbclient -N -L zamok |grep -A5 Master |grep CRANS |tail -c 6 `
|
|
||||||
|
|
||||||
if [ "$master" != 'ZAMOK' ];
|
|
||||||
then
|
|
||||||
echo -n `date` >> $LOG
|
|
||||||
echo " : le maitre est $master " >> $LOG
|
|
||||||
echo "Zamok n'est plus maitre ; je relance samba" >> $LOG
|
|
||||||
/id/samba restart >> $LOG 2>&1
|
|
||||||
#else
|
|
||||||
# echo zamok est encore maitre
|
|
||||||
fi
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# CC 2/2/1999 horrible kludge
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Pour des raisons bizarres (bug driver SMC ? matériel ?), les interfaces
|
|
||||||
# eth1 et eth2 bloquent régulièrement.
|
|
||||||
# en général, un claquage suffit à les relancer. Par ailleurs, un claquage
|
|
||||||
# ne bloque pas les communications -- on peut donc jouer à le faire
|
|
||||||
# régulièrement.
|
|
||||||
#
|
|
||||||
|
|
||||||
#a enlever les commentaires! 19.02
|
|
||||||
# 20/01/2000 jerome reactive le script
|
|
||||||
|
|
||||||
echo "Claquage des interfaces" | /usr/bin/logger -t "Claque" -p user.warn
|
|
||||||
|
|
||||||
ifconfig eth0 down; ifconfig eth0 up; route add default gw 138.231.136.2
|
|
||||||
|
|
||||||
ifconfig eth1 down; ifconfig eth1 up 138.231.136.130 netmask 255.255.252.0 broadcast 138.231.139.255
|
|
||||||
#ifconfig eth2 down; ifconfig eth2 up
|
|
||||||
#ifconfig eth3 down; ifconfig eth3 up
|
|
||||||
|
|
||||||
#ifconfig eth2 up 138.231.138.2 netmask 255.255.255.0 broadcast 138.231.138.255
|
|
||||||
#ifconfig eth2:1 up 138.231.138.2 netmask 255.255.255.0 broadcast 138.231.138.255
|
|
||||||
#ifconfig eth1:1 down 138.231.139.2 netmask 255.255.255.0 broadcast 138.231.139.255
|
|
||||||
#ifconfig eth1 up
|
|
16
fan-speed
16
fan-speed
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#donne la vitesse du ventilateur CPU
|
|
||||||
echo 0
|
|
||||||
#allez, on met 1000 au pif, ça nous rappellera que ce chiffre est bidon. --nico
|
|
||||||
#echo 1000
|
|
||||||
#en attendant de remettre i2c sensors, cette ligne est commentée :
|
|
||||||
cat /proc/sys/dev/sensors/w83781d-i2c-0-2d/fan2 | tail -c 5
|
|
||||||
#
|
|
||||||
#| head -c 4
|
|
||||||
#echo $(cat /proc/sys/dev/sensors/w83781d-i2c-0-2d/temp2 | tail -c 5 | head -c 2 )"/1-30"|bc
|
|
||||||
#cat /proc/sys/dev/sensors/w83781d-i2c-0-2d/temp1 | sed -e 's/.*60.0 50.0 //' | sed -e's/\0//' -e 's/\.//'
|
|
||||||
#cat /proc/sys/dev/sensors/w83781d-i2c-0-2d/temp2 | sed -e 's/.*57.0 50.0 //' | sed -e's/\0//' -e 's/\.//'
|
|
||||||
#echo 10
|
|
||||||
#echo 10
|
|
||||||
echo
|
|
||||||
echo "Ventilation"
|
|
280
mailCRANS.c
280
mailCRANS.c
|
@ -1,280 +0,0 @@
|
||||||
/*
|
|
||||||
* Mail a tous les adherents de CRANS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1999 Association CRANS.
|
|
||||||
*
|
|
||||||
* Auteur: Olivier Saut <Olivier.Saut@CRANS.ENS-Cachan.Fr>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/errno.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <paths.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
|
|
||||||
#define kPCGuestUID 502
|
|
||||||
#define kCorbeauUID 536
|
|
||||||
#define kNobodyUID 65534
|
|
||||||
#define kRealUsers 500
|
|
||||||
|
|
||||||
/* Prototypes */
|
|
||||||
int mk_tmpfile();
|
|
||||||
void edit();
|
|
||||||
int sendmail(char *name);
|
|
||||||
void help();
|
|
||||||
int isValidUID(uid_t uid);
|
|
||||||
void mySig_handler(int iInt);
|
|
||||||
|
|
||||||
/* Variables globales */
|
|
||||||
char *gTempname;
|
|
||||||
uid_t gCurrent_UID;
|
|
||||||
uid_t gUid_start;
|
|
||||||
uid_t gUid_stop;
|
|
||||||
int gVerbose;
|
|
||||||
int gSimulate;
|
|
||||||
|
|
||||||
/* Programme principal */
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
struct passwd *passwd_ent;
|
|
||||||
struct passwd *user;
|
|
||||||
char buf[1024];
|
|
||||||
extern char *optarg;
|
|
||||||
extern int optind;
|
|
||||||
int ch ;
|
|
||||||
struct stat begin, end;
|
|
||||||
sig_t previous_handler;
|
|
||||||
char tildefn[MAXPATHLEN];
|
|
||||||
int fd=-1;
|
|
||||||
|
|
||||||
|
|
||||||
gUid_start=kRealUsers;
|
|
||||||
gUid_stop=kNobodyUID;
|
|
||||||
gVerbose=0;
|
|
||||||
gSimulate=0;
|
|
||||||
while ((ch = getopt(argc, argv, "svhf:d:a:")) != -1)
|
|
||||||
switch (ch) {
|
|
||||||
case 'h':
|
|
||||||
help();
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
gVerbose=1;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
gVerbose=1;
|
|
||||||
gSimulate=1;
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
gTempname=optarg;
|
|
||||||
if ((fd = open(optarg, O_RDONLY, 0)) < 0) {
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"myname: %s: %s\n", optarg, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
gUid_start=atoi(optarg);
|
|
||||||
break;
|
|
||||||
case 'a':
|
|
||||||
gUid_stop=atoi(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
previous_handler = signal(SIGTERM & SIGINT,(sig_t) mySig_handler);
|
|
||||||
if(previous_handler==SIG_ERR) {
|
|
||||||
(void)fprintf(stderr,"Erreur lors de l'installation du sighandler.");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(gVerbose)
|
|
||||||
fprintf(stdout,"mailCRANS by OS. Version 0.1\n");
|
|
||||||
|
|
||||||
if(fd==-1) {
|
|
||||||
fd=mk_tmpfile();
|
|
||||||
user=getpwuid(getuid());
|
|
||||||
sprintf(buf,"From: %s\nSubject: \nReply-To: \nContent-Type: text/plain; charset=iso-8859-1", user->pw_name);
|
|
||||||
|
|
||||||
if (write (fd,(void *)buf,strlen(buf)) < 0) {
|
|
||||||
close(fd);
|
|
||||||
fprintf(stderr, "Erreur en écriture.");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) fsync(fd);
|
|
||||||
if(fstat(fd,&begin)) {
|
|
||||||
perror("Erreur stat(1)");
|
|
||||||
close(fd);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
(void) edit();
|
|
||||||
|
|
||||||
if(stat(gTempname,&end)) {
|
|
||||||
perror("Erreur stat(2)");
|
|
||||||
close(fd);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (begin.st_mtime == end.st_mtime) {
|
|
||||||
warnx("No changes made : exiting");
|
|
||||||
close(fd);
|
|
||||||
(void)unlink(gTempname);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setpwent();
|
|
||||||
|
|
||||||
while((int)(passwd_ent=(struct passwd *)getpwent())) {
|
|
||||||
gCurrent_UID=passwd_ent->pw_uid;
|
|
||||||
|
|
||||||
if(isValidUID(gCurrent_UID))
|
|
||||||
if(sendmail(passwd_ent->pw_name )) {
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
usleep(250000);
|
|
||||||
}
|
|
||||||
|
|
||||||
endpwent();
|
|
||||||
|
|
||||||
(void)unlink(gTempname);
|
|
||||||
/* Bon on efface le fichier parasite */
|
|
||||||
(void)strcpy((char *)tildefn,gTempname);
|
|
||||||
(void)strcat((char *)tildefn,"~");
|
|
||||||
|
|
||||||
if(!access(tildefn,F_OK))
|
|
||||||
(void)unlink(tildefn);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int isValidUID(uid_t uid) {
|
|
||||||
if(uid<gUid_start)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(uid>gUid_stop)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if((uid==kPCGuestUID)|| (uid==kCorbeauUID) || (uid==kNobodyUID))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mySig_handler(int iInt) {
|
|
||||||
(void) fprintf(stdout,"\n Signal %d intercepté.\n",iInt);
|
|
||||||
(void) fprintf(stderr,"Le programme s'est arreté sur l'uid : %d\n",gCurrent_UID);
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mk_tmpfile()
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
char p[MAXPATHLEN];
|
|
||||||
p[MAXPATHLEN-1]='\0';
|
|
||||||
|
|
||||||
strcpy(p, "/tmp/EAll.XXXXXX");
|
|
||||||
if ((fd = mkstemp(p)) == -1)
|
|
||||||
err(1, "%s", p);
|
|
||||||
gTempname = malloc(strlen(p));
|
|
||||||
(void)strncpy(gTempname,p,strlen(p));
|
|
||||||
if(gVerbose)
|
|
||||||
fprintf(stdout,"Tempfile name : %s\n",gTempname);
|
|
||||||
return (fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void edit()
|
|
||||||
{
|
|
||||||
int pstat;
|
|
||||||
int editpid;
|
|
||||||
char *p, *editor;
|
|
||||||
|
|
||||||
if (!(editor = getenv("EDITOR")))
|
|
||||||
editor = _PATH_VI;
|
|
||||||
if ((p = strrchr(editor, '/')))
|
|
||||||
++p;
|
|
||||||
else
|
|
||||||
p = editor;
|
|
||||||
|
|
||||||
if (!(editpid = fork())) {
|
|
||||||
errno = 0;
|
|
||||||
execlp(editor, p, gTempname, NULL);
|
|
||||||
_exit(errno);
|
|
||||||
}
|
|
||||||
for (;;) {
|
|
||||||
editpid = waitpid(editpid, (int *)&pstat, WUNTRACED);
|
|
||||||
errno = WEXITSTATUS(pstat);
|
|
||||||
(void) fprintf(stderr,"\n *** %d ***\n",WEXITSTATUS(pstat));
|
|
||||||
if (editpid == -1)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
else if (WIFSTOPPED(pstat))
|
|
||||||
raise(WSTOPSIG(pstat));
|
|
||||||
else if (WIFEXITED(pstat) && errno == 0)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
editpid = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int sendmail(char *pw_name) {
|
|
||||||
int res=0;
|
|
||||||
char *buff;
|
|
||||||
int length;
|
|
||||||
buff=malloc(1024);
|
|
||||||
|
|
||||||
buff[1023]='\0';
|
|
||||||
buff[0]='\0';
|
|
||||||
|
|
||||||
(void)strcat((char *)buff,(const char *)"cat ");
|
|
||||||
(void)strcat(buff,(const char *) gTempname);
|
|
||||||
(void)strcat(buff, " | sendmail ");
|
|
||||||
(void)strcat(buff, pw_name);
|
|
||||||
if(gVerbose)
|
|
||||||
fprintf(stdout,"\n ** %s ** \n", buff);
|
|
||||||
if(!gSimulate)
|
|
||||||
res=system(buff);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
void help() {
|
|
||||||
fprintf(stdout,"usage: mailCRANS [-v] [-s] [-f filename] [-{d,a} uid]\n");
|
|
||||||
fprintf(stdout," -v : mode bavard\n");
|
|
||||||
fprintf(stdout," -f filename : envoie le fichier en argument\n");
|
|
||||||
fprintf(stdout," (rajouter une ligne Subject: en première ligne du fichier pour avoir un sujet\n");
|
|
||||||
fprintf(stdout," -d uid : envoie à partir de l'UID argument\n");
|
|
||||||
fprintf(stdout," -a uid : arrete après l'UID argument\n");
|
|
||||||
fprintf(stdout," -s : mode simulation.");
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
# 5 retries (6 en tout), quiet.
|
|
||||||
if ! fping 138.231.136.2 -r 5 -q;
|
|
||||||
then
|
|
||||||
echo "irts AUTOTEST failed" | logger -s -p daemon.err -t "/id/netrestart"
|
|
||||||
/id/network reload
|
|
||||||
fi
|
|
9
redpopup
9
redpopup
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
|
||||||
PYTHONPATH=/usr/lib/python-1.5/
|
|
||||||
|
|
||||||
cd /etc/CRANS
|
|
||||||
echo $1 $2 $3 $4 $5 > /tmp/last.popup.log
|
|
||||||
exec python /etc/CRANS/code/redpopup.py $1 $2 $3 $4 $5 >&2 2>/tmp/last.popup.err
|
|
||||||
|
|
||||||
|
|
76
redpopup.py
76
redpopup.py
|
@ -1,76 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- python -*-
|
|
||||||
import sys,time,os,pickle,string,popen2,random
|
|
||||||
|
|
||||||
FORKLEN = 5
|
|
||||||
TIMEOUT = 15 # une machine a 15 secondes pour recevoir un popup !
|
|
||||||
|
|
||||||
def do_bomb(Machines):
|
|
||||||
time.sleep(random.random())
|
|
||||||
if len(Machines) < FORKLEN:
|
|
||||||
for mach in Machines:
|
|
||||||
begin = time.time()
|
|
||||||
print "ré-expédition SMBpopup à ",mach
|
|
||||||
fd = popen2.Popen3("/etc/CRANS/code/SMBMessage %s %s %s" % (from_whom,mach,msgfile))
|
|
||||||
while 1:
|
|
||||||
time.sleep(1)
|
|
||||||
if fd.poll() != -1: break # fini ! (cool)
|
|
||||||
if (time.time() - begin) > TIMEOUT: break
|
|
||||||
del fd
|
|
||||||
else:
|
|
||||||
Half = len(Machines) / 2
|
|
||||||
|
|
||||||
pid = os.fork()
|
|
||||||
if pid == 0:
|
|
||||||
# child
|
|
||||||
do_bomb(Machines[:Half])
|
|
||||||
else:
|
|
||||||
# parent
|
|
||||||
do_bomb(Machines[Half:])
|
|
||||||
try:
|
|
||||||
os.waitpid(pid,0)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
# à ce stade, on a éliminé toute récursion, tant pile que process...
|
|
||||||
# croisons les doigts !!!
|
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) < 4:
|
|
||||||
sys.stderr.write('Attend 3 arguments !\n')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
Zone = pickle.load(open(CFG_READ_DIR+"Zone.db","r"))
|
|
||||||
|
|
||||||
from_whom = sys.argv[1]
|
|
||||||
from_where = sys.argv[2]
|
|
||||||
msgfile = sys.argv[3]+"-red"
|
|
||||||
message = open(sys.argv[3],"r").readlines()
|
|
||||||
|
|
||||||
message.insert(0,("Message de %s (@%s) à ALL : \n-----\n" % (from_whom,from_where)))
|
|
||||||
open(msgfile,"w").writelines(message)
|
|
||||||
|
|
||||||
|
|
||||||
# pour gagner du temps, on n'envoie le message qu'aux machines qui sont
|
|
||||||
# (probablement) vivantes. Pour gagner encore plus de temps, on fait
|
|
||||||
# confiance au cache ARP (15 minutes)
|
|
||||||
|
|
||||||
Alive = []
|
|
||||||
arp = os.popen("arp -a","r")
|
|
||||||
while 1:
|
|
||||||
s = arp.readline()
|
|
||||||
if not s: break
|
|
||||||
mach = string.split(string.split(s)[0],'.')[0]
|
|
||||||
if mach[:5] == 'zamok': continue # évitons les boucles infininies...
|
|
||||||
if Zone.has_key(mach): Alive.append(mach)
|
|
||||||
print Alive
|
|
||||||
|
|
||||||
arp.close()
|
|
||||||
|
|
||||||
#maintenant, au boulot...
|
|
||||||
do_bomb(Alive)
|
|
||||||
unlink(msgfile)
|
|
||||||
unlink(sys.argv[3])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
15
save-etc
15
save-etc
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
freq="$1"
|
|
||||||
nb=$2
|
|
||||||
|
|
||||||
pref="/backups/tars/etc${freq}-"
|
|
||||||
suff=`date +"%Y-%m-%d--%H-%M-%S.tgz"`
|
|
||||||
tarball="${pref}${suff}"
|
|
||||||
|
|
||||||
umask 077
|
|
||||||
cd /
|
|
||||||
tar zcf ${tarball} etc usr/lib/cgi-bin usr/scripts root/scripts home/corbeau/scripts
|
|
||||||
rm `ls -t ${pref}* | tail +$nb`
|
|
||||||
|
|
||||||
#df
|
|
26
squid-vit-il
26
squid-vit-il
|
@ -1,26 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- Python -*-
|
|
||||||
|
|
||||||
# teste si notre squid fonctionne encore (sortof).
|
|
||||||
|
|
||||||
from socket import *
|
|
||||||
import sys
|
|
||||||
|
|
||||||
OK = 0
|
|
||||||
|
|
||||||
host = "localhost"
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
host = sys.argv[1]
|
|
||||||
|
|
||||||
s = socket(AF_INET,SOCK_STREAM)
|
|
||||||
try:
|
|
||||||
s.connect(host,3128)
|
|
||||||
s.send("GET squid-vit-il")
|
|
||||||
data = s.recv(4)
|
|
||||||
OK = ("HTTP" == data)
|
|
||||||
s.close()
|
|
||||||
except:
|
|
||||||
OK = 0
|
|
||||||
|
|
||||||
sys.exit(not OK)
|
|
||||||
|
|
26
surveille
26
surveille
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/zsh
|
|
||||||
# si le process $1 est mort, le relance
|
|
||||||
|
|
||||||
unset res
|
|
||||||
|
|
||||||
arg=$1
|
|
||||||
res=`ps xeaf | grep $arg | grep -v surveille | grep -v grep`
|
|
||||||
#res=`/etc/rc.d/init.d/$arg status | grep "running"`
|
|
||||||
|
|
||||||
if [ -z $res ]; then
|
|
||||||
if [ -f /var/run/dead.$arg ]; then
|
|
||||||
# waouh, on peut rien -- on a déjà essayé de relancer ce truc
|
|
||||||
# et il est déjà mort -- y'a sûrement un problème dans les fichiers
|
|
||||||
# de config !
|
|
||||||
# faudrait faire un "ls" quotidien de /var/run/dead.* ...
|
|
||||||
true
|
|
||||||
else
|
|
||||||
/etc/rc.d/init.d/$arg stop 2>/dev/null >/dev/null
|
|
||||||
/etc/rc.d/init.d/$arg start 2>/dev/null >/dev/null
|
|
||||||
logger "surveille a du relancer $1 !" 2>/dev/null >/dev/null
|
|
||||||
touch /var/run/dead.$arg
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
rm -f /var/run/dead.$arg 2>/dev/null >/dev/null
|
|
||||||
|
|
||||||
fi
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
ipx=false
|
|
||||||
|
|
||||||
function teste_ou_claque() {
|
|
||||||
if ! ping -c 1 $1 2>&1 >/dev/null
|
|
||||||
then
|
|
||||||
ifconfig $2 down 2>/dev/null >/dev/null
|
|
||||||
/usr/local/bin/mii-diag -R $2 2>/dev/null >/dev/null
|
|
||||||
ifconfig $2 up 2>/dev/null >/dev/null
|
|
||||||
if [ ! -z "$3" ]
|
|
||||||
then
|
|
||||||
route add default gw $3
|
|
||||||
fi
|
|
||||||
ipx=true
|
|
||||||
logger "surveille-reseau a du claquer $2 !" 2>&1 >/dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# pour l'instant, on n'a qu'un seul réseau (eth0) où se trouve de façon sûre
|
|
||||||
# une machine partenaire, toujours présente.
|
|
||||||
# les autres réseaux peuvent être ajoutés dès que l'on aura une victime à
|
|
||||||
# pinger (par exemple, une vieille sun ou un vieux 386sx/Linux de réserve,
|
|
||||||
# ne servant à rien sauf à faire du RC5.distributed.net (pour l'ego du root)
|
|
||||||
# et répondre aux pings)
|
|
||||||
|
|
||||||
|
|
||||||
teste_ou_claque 138.231.176.65 eth0 138.231.136.2
|
|
||||||
#teste_ou_claque zagadka eth1
|
|
||||||
#teste_ou_claque gandalf eth2
|
|
||||||
#teste_ou_claque bigouden eth3
|
|
||||||
|
|
||||||
$ipx && /etc/CRANS/rc.ipx >/dev/null 2>/dev/null
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
/etc/CRANS/sendmail-vit-il $1 && exit
|
|
||||||
|
|
||||||
killall -9 sendmail 2>/dev/null >/dev/null
|
|
||||||
echo "surveille-sendmail relance sendmail !!!" >> /var/log/messages
|
|
||||||
/usr/lib/sendmail -bd
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
/etc/CRANS/squid-vit-il $1 && exit
|
|
||||||
|
|
||||||
echo "surveille-squid relance Squid !!!" >> /var/log/messages
|
|
||||||
squid-new >/dev/null 2>/dev/null
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
/etc/CRANS/surveille-sendmail $HOST
|
|
||||||
/etc/CRANS/surveille-squid
|
|
||||||
/etc/CRANS/surveille httpd
|
|
||||||
/etc/CRANS/surveille smb
|
|
||||||
/etc/CRANS/surveille dhcpd
|
|
||||||
/etc/CRANS/surveille sshd2
|
|
||||||
/etc/CRANS/surveille ntpd
|
|
||||||
|
|
||||||
/etc/CRANS/surveille-reseau
|
|
||||||
# Et bientot
|
|
||||||
# /etc/CRANS/surveille-reseau.pl
|
|
||||||
|
|
||||||
|
|
||||||
killall -9 nwbind 2>/dev/null >/dev/null
|
|
||||||
#goret goret goret :-) mais on n'a pas besoin de la
|
|
||||||
#bindery[usine à gaz] NetWare
|
|
14
temp-avg
14
temp-avg
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# je pipe vers calculatrice pour enlever 30 °, ça donne plus de précision. Sam. (/1 fait truncate.)
|
|
||||||
|
|
||||||
#echo $(cat /proc/sys/dev/sensors/w83781d-i2c-0-2d/temp2 | tail -c 5 | head -c 2 )"/1-20"|bc
|
|
||||||
#echo $(cat /proc/sys/dev/sensors/w83781d-i2c-0-2d/temp1 | tail -c 5 | head -c 2 )"/1-20"|bc
|
|
||||||
#echo 10
|
|
||||||
#echo 12
|
|
||||||
|
|
||||||
echo $(cat /proc/sys/dev/sensors/w83781d*/temp1 | tail -c 5 | head -c 2 )
|
|
||||||
|
|
||||||
echo $(cat /proc/sys/dev/sensors/w83781d*/temp2 | tail -c 5 | head -c 2 )
|
|
||||||
echo
|
|
||||||
echo "Température°"
|
|
||||||
# passage de -30 a -20 le 3 Oct 23:30 car nouveau local -> nouvelle temperature..
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
$squidCacheDir = "/var/squid";
|
|
||||||
$squidCacheDirMaxSize = 1700000;
|
|
||||||
|
|
||||||
open(STDIN, "du -s $squidCacheDir |");
|
|
||||||
|
|
||||||
$line = <STDIN>;
|
|
||||||
chop($line);
|
|
||||||
|
|
||||||
#$line est sous la forme 12345678 $squidCacheDir
|
|
||||||
|
|
||||||
if ($line =~ /([\d]+)/){
|
|
||||||
if ($1 > $squidCacheDirMaxSize){
|
|
||||||
|
|
||||||
system("echo \"testSquid.pl relance squid \" >> /var/log/messages");
|
|
||||||
|
|
||||||
# ajoute par Aymeric pour essayer de comprendre ce qui se passe
|
|
||||||
system("df -k /var/squid >> /var/log/messages");
|
|
||||||
|
|
||||||
system("squid-new >/dev/null 2&>/dev/null &");
|
|
||||||
# J'ai rajouté un sujet pour filtrage par procmail OS :-)
|
|
||||||
system("echo \"[TEST] j'ai du relancer le squid qui
|
|
||||||
bouffait trop d'espace\"| mail -s \"testSquid\" root ");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# fait le 11/12/99 par Jerome KIEFFER
|
|
||||||
#retablie l'ipforwarding entre les interfaces de zamok si c'est descactive.
|
|
||||||
if [ `cat /proc/sys/net/ipv4/ip_forward` -eq `expr 0` ]
|
|
||||||
then
|
|
||||||
echo 1 >/proc/sys/net/ipv4/ip_forward
|
|
||||||
fi
|
|
13
watchdog
13
watchdog
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# oui emacs c'est bien du -*- python -*-
|
|
||||||
|
|
||||||
|
|
||||||
# c'est fait pour le "software watchdog"....
|
|
||||||
|
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
fd = open("/dev/watchdog","w+")
|
|
||||||
while 1:
|
|
||||||
fd.write('z')
|
|
||||||
sleep(15)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue