Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
241ee2385f | ||
|
|
6beee1e2ba | ||
|
|
5d89ac6417 | ||
|
|
c4801fa8dc | ||
|
|
44e406c80f | ||
|
|
06caf72a34 | ||
| 19accb4c0e | |||
| 5718426164 | |||
| 86011bbacf | |||
| 2f2a283f7e | |||
| 2ff5c979b5 | |||
| 8fd4776f92 | |||
| ffc9ad66ed | |||
| 3de8864695 | |||
| 0fb4bdf279 | |||
| ae439aed2d | |||
| 3afefd1e28 | |||
| 29507b8851 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
client/web/index.html
|
client/web/index.html
|
||||||
build
|
build/*
|
||||||
|
|||||||
@ -6,7 +6,7 @@ MoniThor is a simple monitoring tools in bash.
|
|||||||
|
|
||||||
You can use it with netcat or cryptcat
|
You can use it with netcat or cryptcat
|
||||||
|
|
||||||
You can see result on the client from a web page (self hosted python web server)
|
You can see result on the client from a web page (self hosted python3 web server)
|
||||||
|
|
||||||
|
|
||||||
## Server Configuration
|
## Server Configuration
|
||||||
@ -160,7 +160,7 @@ sudo /etc/init.d/monithor-c start/stop
|
|||||||
|
|
||||||
### WEB
|
### WEB
|
||||||
|
|
||||||
The client start a python sumple http server on localhost on `WebPort`
|
The client start a python3 sumple http server on localhost on `WebPort`
|
||||||
|
|
||||||
```
|
```
|
||||||
/usr/local/bin/monithor-client.d/MoniThorWebServer
|
/usr/local/bin/monithor-client.d/MoniThorWebServer
|
||||||
|
|||||||
BIN
doc/monithor-client.1.gz
Normal file
BIN
doc/monithor-client.1.gz
Normal file
Binary file not shown.
@ -1,15 +1,15 @@
|
|||||||
monithor-client(1) -- Client bash de monitoring de système d'information
|
---
|
||||||
====
|
title: monithor-client
|
||||||
|
section: 1
|
||||||
|
author: Guillaume Astier Ruiz
|
||||||
|
date: 20220320
|
||||||
|
...
|
||||||
|
|
||||||
## SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
|
|
||||||
`/usr/local/bin/monithor-client [start/stop]`
|
|
||||||
|
|
||||||
`/etc/init.d/monithor-c [start/stop]`
|
`/etc/init.d/monithor-c [start/stop]`
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
## DESCRIPTION
|
|
||||||
|
|
||||||
monithor-client(1) permet de surveiller votre système d'information
|
monithor-client(1) permet de surveiller votre système d'information
|
||||||
|
|
||||||
@ -17,9 +17,9 @@ monithor-client(1) permet de surveiller votre système d'information
|
|||||||
|
|
||||||
- il peut aussi utiliser cryptcat (chiffré)
|
- il peut aussi utiliser cryptcat (chiffré)
|
||||||
|
|
||||||
- un serveur web en python est lancé sur votre machine de monitoring
|
- un serveur web en python3 est lancé sur votre machine de monitoring
|
||||||
|
|
||||||
## INIT.D
|
# INIT.D
|
||||||
|
|
||||||
le service peut être démarré et arrêté via system V
|
le service peut être démarré et arrêté via system V
|
||||||
|
|
||||||
@ -29,16 +29,14 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
- Arrêt
|
- Arrêt
|
||||||
|
|
||||||
`/etc/init.d/monithor-c start`
|
`/etc/init.d/monithor-c stop`
|
||||||
|
|
||||||
## CONFIGURATION SERVICE
|
# CONFIGURATION SERVICE
|
||||||
|
|
||||||
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
||||||
|
|
||||||
`$ cat etc/monithor-client/service.cfg `
|
`$ cat etc/monithor-client/service.cfg `
|
||||||
|
|
||||||
`RemoteIp=10.10.10.3:1666 `
|
|
||||||
|
|
||||||
`LocalPassword='Evil@MonitoR-666'`
|
`LocalPassword='Evil@MonitoR-666'`
|
||||||
|
|
||||||
`Crypted=no`
|
`Crypted=no`
|
||||||
@ -49,8 +47,6 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
`WebPort=80`
|
`WebPort=80`
|
||||||
|
|
||||||
* RemoteIp : correspond au couple adresse IP/Port de l'interface réseau utilisée
|
|
||||||
|
|
||||||
* LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"
|
* LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"
|
||||||
|
|
||||||
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
||||||
@ -59,9 +55,9 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
* TimeOut : correspond à la valeur en seconde (float) du temps maximal d'éxécution de chaque sonde
|
* TimeOut : correspond à la valeur en seconde (float) du temps maximal d'éxécution de chaque sonde
|
||||||
|
|
||||||
* WebPort : correpond au port utilisé pour lancer le serveur web python
|
* WebPort : correpond au port utilisé pour lancer le serveur web python3
|
||||||
|
|
||||||
## CONFIGURATION SONDE
|
# CONFIGURATION SONDE
|
||||||
|
|
||||||
- La configuration des sondes est stocké dans le répertoires :
|
- La configuration des sondes est stocké dans le répertoires :
|
||||||
|
|
||||||
BIN
doc/monithor-server.1.gz
Normal file
BIN
doc/monithor-server.1.gz
Normal file
Binary file not shown.
@ -1,15 +1,18 @@
|
|||||||
monithor-server(1) -- Serveur bash de monitoring de système d'information
|
---
|
||||||
====
|
title: monithor-server
|
||||||
|
section: 1
|
||||||
|
author: Guillaume Astier Ruiz
|
||||||
|
date: 20220320
|
||||||
|
...
|
||||||
|
|
||||||
## SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
|
`/usr/local/bin/monithor-d [start/stop]`
|
||||||
|
|
||||||
|
`/etc/init.d/monithor-d [start/stop]`
|
||||||
|
|
||||||
|
|
||||||
`/usr/local/bin/monithor-server [start/stop]`
|
# DESCRIPTION
|
||||||
|
|
||||||
`/etc/init.d/monithor-c [start/stop]`
|
|
||||||
|
|
||||||
|
|
||||||
## DESCRIPTION
|
|
||||||
|
|
||||||
monithor-server(1) permet d'accépter des requêtes venant d'un instance monithor-client
|
monithor-server(1) permet d'accépter des requêtes venant d'un instance monithor-client
|
||||||
|
|
||||||
@ -23,17 +26,17 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
- Démarrage
|
- Démarrage
|
||||||
|
|
||||||
`/etc/init.d/monithor-c start`
|
`/etc/init.d/monithor-d start`
|
||||||
|
|
||||||
- Arrêt
|
- Arrêt
|
||||||
|
|
||||||
`/etc/init.d/monithor-c start`
|
`/etc/init.d/monithor-d stop`
|
||||||
|
|
||||||
## CONFIGURATION SERVICE
|
# CONFIGURATION SERVICE
|
||||||
|
|
||||||
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
||||||
|
|
||||||
`LocalIp=10.10.10.4`
|
`RemoteIp=10.10.10.4`
|
||||||
|
|
||||||
`LocalPort=1666`
|
`LocalPort=1666`
|
||||||
|
|
||||||
@ -41,7 +44,7 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
`LocalPassword='Evil@MonitoR-666'`
|
`LocalPassword='Evil@MonitoR-666'`
|
||||||
|
|
||||||
* LocalIp : correspond à l'adresse IP de l'interface réseau en écoute
|
* RemoteIp : correspond à l'adresse IP de l'interface réseau en écoute du client de monitoring
|
||||||
|
|
||||||
* LocalPort : correspond au port de communication du client monithor
|
* LocalPort : correspond au port de communication du client monithor
|
||||||
|
|
||||||
@ -49,7 +52,7 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
||||||
|
|
||||||
## CONFIGURATION SONDE
|
# CONFIGURATION SONDE
|
||||||
|
|
||||||
- La configuration des sondes est stocké dans le répertoires :
|
- La configuration des sondes est stocké dans le répertoires :
|
||||||
|
|
||||||
@ -63,13 +66,13 @@ Chaque sonde est composé de cette manière :
|
|||||||
|
|
||||||
* SCRIPT : Script éxecuté sur l'instance avec le(s) argument(s) reçu(s) de monithor client
|
* SCRIPT : Script éxecuté sur l'instance avec le(s) argument(s) reçu(s) de monithor client
|
||||||
|
|
||||||
## SCRIPT
|
# SCRIPT
|
||||||
|
|
||||||
les scripts sont tous stocké dans le répertoire :
|
les scripts sont tous stocké dans le répertoire :
|
||||||
|
|
||||||
/usr/local/bin/monithor-server.d/
|
/usr/local/bin/monithor-server.d/
|
||||||
|
|
||||||
## Exemple :
|
# Exemple
|
||||||
|
|
||||||
* Configuration server :
|
* Configuration server :
|
||||||
|
|
||||||
@ -79,9 +82,9 @@ les scripts sont tous stocké dans le répertoire :
|
|||||||
|
|
||||||
* Configuration client :
|
* Configuration client :
|
||||||
|
|
||||||
`$ cat /etc/monithor-client/etc/monithor-client/conf/Card_10.10.10.3-1666.cfg`
|
`$ cat /etc/monithor-client/etc/monithor-client/conf/sample.cfg
|
||||||
|
|
||||||
`10.10.10.3:1666#part#/home/isen|50|80`
|
`#10.10.10.3:1666#part#/home/isen|50|80`
|
||||||
|
|
||||||
* Explication
|
* Explication
|
||||||
|
|
||||||
@ -95,6 +98,8 @@ SERVEUR exécute : /usr/local/bin/monithor-server.d/part-space.sh /home/isen 50
|
|||||||
|
|
||||||
SERVEUR renvoie les valeur récupéré à CLIENT
|
SERVEUR renvoie les valeur récupéré à CLIENT
|
||||||
|
|
||||||
|
Les lignes commençant par '#' sont à supprimer ou à décommenter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
30
generate.sh
30
generate.sh
@ -25,12 +25,15 @@ CheckDep() {
|
|||||||
|
|
||||||
GitVersion() {
|
GitVersion() {
|
||||||
|
|
||||||
LastTag=$(git tag | sed "s/^V//g" | cut -d"-" -f1 | sort | tail -n1)
|
LastTag=$(git tag | sed "s/^V//g" | cut -d"-" -f1 | sort -n -k2 -t. | tail -n1)
|
||||||
NewTag=${LastTag}-rebuild
|
NewTag=${LastTag}-rebuild
|
||||||
}
|
}
|
||||||
|
|
||||||
CpArchName() {
|
CpArchName() {
|
||||||
cp -Rf monithor-${1} /tmp/monithor-${1}_${2}_all
|
|
||||||
|
rm -Rf /tmp/monithor-*
|
||||||
|
cp -Rf ${Wai}/monithor-${1} /tmp/monithor-${1}_${2}_all
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,8 +45,11 @@ SedControl() {
|
|||||||
BuildDeb(){
|
BuildDeb(){
|
||||||
echo -n "Gen monithor-${1} [$2] : "
|
echo -n "Gen monithor-${1} [$2] : "
|
||||||
cd /tmp/ &> /dev/null
|
cd /tmp/ &> /dev/null
|
||||||
dpkg-deb --build --root-owner-group monithor-${1}_${2}_all &> /dev/null
|
Dist=$(lsb_release -a 2> /dev/null | grep Distributor |awk '{print $NF}' |tr '[:upper:]' '[:lower:]')
|
||||||
|
[[ $Dist == "ubuntu" ]] && Compress=' -Z gzip -S fixed '
|
||||||
|
dpkg-deb ${Compress} --build --root-owner-group monithor-${1}_${2}_all &> /dev/null
|
||||||
[[ "$?" -eq "0" ]] && echo "OK" || echo "FAILED"
|
[[ "$?" -eq "0" ]] && echo "OK" || echo "FAILED"
|
||||||
|
cp monithor-*deb ${Wai}/build
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,15 +59,25 @@ CleanTemp() {
|
|||||||
rm -Rf monithor-*
|
rm -Rf monithor-*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ManPage() {
|
||||||
|
|
||||||
|
mkdir -p /tmp/monithor-${1}_${2}_all/usr/share/man/man1/
|
||||||
|
|
||||||
|
pandoc -s -t man ${Wai}/doc/monithor-${1}.md -o /tmp/monithor-${1}_${2}_all/usr/share/man/man1/monithor-${1}.1
|
||||||
|
gzip /tmp/monithor-${1}_${2}_all/usr/share/man/man1/monithor-${1}.1
|
||||||
|
}
|
||||||
|
|
||||||
[[ ! -z $1 ]] && usage
|
[[ ! -z $1 ]] && usage
|
||||||
|
|
||||||
CheckDep
|
CheckDep
|
||||||
GitVersion
|
GitVersion
|
||||||
|
|
||||||
CpArchName server $NewTag
|
CpArchName server $NewTag
|
||||||
CpArchName client $NewTag
|
|
||||||
SedControl server $NewTag
|
SedControl server $NewTag
|
||||||
SedControl client $NewTag
|
ManPage server $NewTag
|
||||||
BuildDeb client $NewTag
|
|
||||||
BuildDeb server $NewTag
|
BuildDeb server $NewTag
|
||||||
CleanTemp
|
|
||||||
|
CpArchName client $NewTag
|
||||||
|
SedControl client $NewTag
|
||||||
|
ManPage client ${NewTag}
|
||||||
|
BuildDeb client $NewTag
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Package: monithor-client
|
Package: monithor-client
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Dependsd:netcat,cryptcat,screen,python,netcat,cryptcat,elinks
|
Dependsd:netcat,cryptcat,screen,python3,netcat,cryptcat,elinks
|
||||||
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
||||||
Description: monithor client (with simple http server python)
|
Description: monithor client (with simple http server python3)
|
||||||
|
|||||||
8
monithor-client/DEBIAN/postinst
Executable file
8
monithor-client/DEBIAN/postinst
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Update man page"
|
||||||
|
mkdir /var/cache/man/oldlocal/fr -p
|
||||||
|
mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
8
monithor-client/DEBIAN/postrm
Executable file
8
monithor-client/DEBIAN/postrm
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Update man page"
|
||||||
|
#mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
|
mkdir /var/cache/man/oldlocal/fr -p
|
||||||
@ -4,7 +4,7 @@
|
|||||||
# Provides: monithor-c
|
# Provides: monithor-c
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop:
|
# Default-Stop:
|
||||||
# Short-Description: MoniThor Server
|
# Short-Description: MoniThor client
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
@ -21,15 +21,20 @@ case "$1" in
|
|||||||
logger "monithor-client is running ..."
|
logger "monithor-client is running ..."
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
logger "Starting MoniThor Server"
|
logger "Starting MoniThor client "
|
||||||
/usr/local/bin/monithor-client start
|
/usr/local/bin/monithor-client start
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
logger "Stoping MoniThor server" "monithor-c" || true
|
logger "Stoping MoniThor client " "monithor-c" || true
|
||||||
/usr/local/bin/monithor-client stop
|
/usr/local/bin/monithor-client stop
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
logger "status MoniThor client " "monithor-c" || true
|
||||||
|
[ $(ps axf| grep MoniThor | grep SCREEN | wc -l) -gt 1 ] && echo "monithor-c is running" || echo "montihor-c is dead"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/monithor-c {start|stop|status}" || true
|
echo "Usage: /etc/init.d/monithor-c {start|stop|status}" || true
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
10.10.10.3:1666#file#/tmp/test
|
|
||||||
10.10.10.3:1666#part#/home/isen|50|80
|
|
||||||
10.10.10.3:1666#process#sshd
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
10.10.10.4:1666#file#/tmp/test
|
|
||||||
10.10.10.4:1666#part#/home/isen|50|80
|
|
||||||
10.10.10.4:1666#process#sshd
|
|
||||||
4
monithor-client/etc/monithor-client/conf/sample.cfg
Normal file
4
monithor-client/etc/monithor-client/conf/sample.cfg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#IP:PORT#SONDE#ARGUMENT
|
||||||
|
#Ex :
|
||||||
|
#10.10.10.3:1666#part#/home/isen|50|80
|
||||||
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
RemoteIp=10.10.10.3:1666
|
|
||||||
LocalPassword='Evil@MonitoR-666'
|
LocalPassword='Evil@MonitoR-666'
|
||||||
Crypted=no
|
Crypted=no
|
||||||
Rotation=1
|
Rotation=1
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
10.10.10.3:1666#file#/tmp/coucou
|
|
||||||
10.10.10.3:1666#file#/tmp/nop
|
|
||||||
10.10.10.3:1666#file#
|
|
||||||
10.10.10.3:1666#NotRealSondeName#reboot
|
|
||||||
10.10.10.4:1666#file#/tmp/coucou
|
|
||||||
10.10.10.4:1666#file#/tmp/nop
|
|
||||||
10.10.10.4:1666#file#
|
|
||||||
10.10.10.4:1666#NotRealSondeName#reboot
|
|
||||||
@ -1,12 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /etc/monithor-client/service.cfg
|
source /etc/monithor-client/service.cfg
|
||||||
Ip=$(echo $RemoteIp| cut -d":" -f1)
|
|
||||||
|
|
||||||
Exit () {
|
Exit () {
|
||||||
|
|
||||||
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
||||||
[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -16,15 +14,13 @@ if [[ $(id -u) != "0" ]]
|
|||||||
Exit root
|
Exit root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ! -z $(ifconfig | grep inet | awk '{print $2}' | grep $Ip) ]] && Exit Config
|
|
||||||
|
|
||||||
if [[ "$1" == "start" ]]
|
if [[ "$1" == "start" ]]
|
||||||
then
|
then
|
||||||
[[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor
|
[[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor
|
||||||
rm /tmp/Monitor* /tmp/webmonithor &> /dev/null
|
rm /tmp/Monitor* /tmp/webmonithor &> /dev/null
|
||||||
|
|
||||||
TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg|wc -l)
|
TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep .*\.cfg| wc -l)
|
||||||
for Conf in $(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg)
|
for Conf in $(ls -1 /etc/monithor-client/conf/ | grep .*\.cfg)
|
||||||
do
|
do
|
||||||
screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf}
|
screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf}
|
||||||
done
|
done
|
||||||
@ -33,7 +29,7 @@ fi
|
|||||||
|
|
||||||
if [[ "$1" == "stop" ]]
|
if [[ "$1" == "stop" ]]
|
||||||
then
|
then
|
||||||
killall python &> /dev/null
|
killall python3 &> /dev/null
|
||||||
rm /tmp/Monithor* &> /dev/null
|
rm /tmp/Monithor* &> /dev/null
|
||||||
touch /tmp/endmonitor
|
touch /tmp/endmonitor
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,19 @@ while [[ ! -f /tmp/endmonitor ]]
|
|||||||
GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp
|
GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp
|
||||||
sleep ${Rotation}
|
sleep ${Rotation}
|
||||||
else
|
else
|
||||||
while read DATA
|
while read DATA
|
||||||
do
|
do
|
||||||
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
|
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
|
||||||
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
|
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
|
||||||
Cmd=$(echo $DATA| cut -d"#" -f2)
|
Cmd=$(echo $DATA| cut -d"#" -f2)
|
||||||
Arg=$(echo $DATA| cut -d"#" -f3)
|
Arg=$(echo $DATA| cut -d"#" -f3)
|
||||||
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
|
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
|
||||||
Ret=$?
|
Ret=$?
|
||||||
GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp
|
if [[ ! -z $(echo $DATA | grep ^"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*#.*#" ) ]]
|
||||||
done < /etc/monithor-client/conf/${ConfFile}
|
then
|
||||||
|
GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp
|
||||||
|
fi
|
||||||
|
done < /etc/monithor-client/conf/${ConfFile}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ CheckAllEnd() {
|
|||||||
echo '
|
echo '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>MoniThor on '${RemoteIp}' </title>
|
<title>MoniThor on '$(hostname)' </title>
|
||||||
<meta http-equiv="refresh" content="1" />
|
<meta http-equiv="refresh" content="1" />
|
||||||
</head>
|
</head>
|
||||||
<title>MONITHOR</title>
|
<title>MONITHOR</title>
|
||||||
|
|||||||
@ -3,18 +3,20 @@
|
|||||||
|
|
||||||
pushd /var/www/html/monithor
|
pushd /var/www/html/monithor
|
||||||
source /usr/local/bin/monithor-client.d/MoniThorFnct
|
source /usr/local/bin/monithor-client.d/MoniThorFnct
|
||||||
python -m SimpleHTTPServer ${1} &
|
python3 -m http.server ${1} &
|
||||||
|
|
||||||
|
|
||||||
echo '<html>
|
echo '<html>
|
||||||
<head>
|
<head>
|
||||||
<title>MoniThor on '${RemoteIp}' </title>
|
<title>MoniThor on '$(hostname)' </title>
|
||||||
<meta http-equiv="refresh" content="1" />
|
<meta http-equiv="refresh" content="1" />
|
||||||
</head>
|
</head>
|
||||||
<title>MONITHOR</title>
|
<title>MONITHOR</title>
|
||||||
|
|
||||||
!!!! Initialization !!!!
|
!!!! Initialization !!!!
|
||||||
|
|
||||||
|
Warning : check the config /etc/monithor-client/conf/*cfg
|
||||||
|
|
||||||
' > index.html
|
' > index.html
|
||||||
|
|
||||||
while [[ ! -f /tmp/endmonitor ]]
|
while [[ ! -f /tmp/endmonitor ]]
|
||||||
|
|||||||
@ -1,98 +0,0 @@
|
|||||||
.\" generated with Ronn-NG/v0.9.1
|
|
||||||
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
|
||||||
.TH "MONITHOR\-CLIENT" "1" "March 2022" ""
|
|
||||||
.SH "NAME"
|
|
||||||
\fBmonithor\-client\fR \- Client bash de monitoring de système d'information
|
|
||||||
.SH "SYNOPSIS"
|
|
||||||
\fB/usr/local/bin/monithor\-client [start/stop]\fR
|
|
||||||
.P
|
|
||||||
\fB/etc/init\.d/monithor\-c [start/stop]\fR
|
|
||||||
.SH "DESCRIPTION"
|
|
||||||
monithor\-client(1) permet de surveiller votre système d'information
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
l'ensemble du service est basé sur l'ourverture d'une socket TCP via netcat
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
il peut aussi utiliser cryptcat (chiffré)
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
un serveur web en python est lancé sur votre machine de monitoring
|
|
||||||
.IP "" 0
|
|
||||||
.SH "INIT\.D"
|
|
||||||
le service peut être démarré et arrêté via system V
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Démarrage
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fB/etc/init\.d/monithor\-c start\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Arrêt
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fB/etc/init\.d/monithor\-c start\fR
|
|
||||||
.SH "CONFIGURATION SERVICE"
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Le fichier responsable de la gestion IP/PORT est : service\.cfg
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fB$ cat etc/monithor\-client/service\.cfg\fR
|
|
||||||
.P
|
|
||||||
\fBRemoteIp=10\.10\.10\.3:1666\fR
|
|
||||||
.P
|
|
||||||
\fBLocalPassword='Evil@MonitoR\-666'\fR
|
|
||||||
.P
|
|
||||||
\fBCrypted=no\fR
|
|
||||||
.P
|
|
||||||
\fBRotation=1\fR
|
|
||||||
.P
|
|
||||||
\fBTimeOut=2\fR
|
|
||||||
.P
|
|
||||||
\fBWebPort=80\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
RemoteIp : correspond au couple adresse IP/Port de l'interface réseau utilisée
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Rotation : correspond à la valeur en seconde (float) entre chaque éxécution complète des sondes
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
TimeOut : correspond à la valeur en seconde (float) du temps maximal d'éxécution de chaque sonde
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
WebPort : correpond au port utilisé pour lancer le serveur web python
|
|
||||||
.IP "" 0
|
|
||||||
.SH "CONFIGURATION SONDE"
|
|
||||||
.TP
|
|
||||||
La configuration des sondes est stocké dans le répertoires :
|
|
||||||
|
|
||||||
.P
|
|
||||||
/etc/monithor\-client/conf/
|
|
||||||
.P
|
|
||||||
Tous les fichiers *\.cfg sont lus\.
|
|
||||||
.TP
|
|
||||||
Chaque sonde est composée de cette manière :
|
|
||||||
|
|
||||||
.P
|
|
||||||
\fBIP:PORT#SONDE#arg1|arg2|arg3\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
IP:PORT : correspond à l'adresse et le prot de communication du erveur monithor\-server distant\.
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
SONDE : correspond au nom de sonde envoyé sur le serveur monithor\-server distant\.
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
# : séparateur entre le nom de la sonde et les arguments
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
arg1|arg2|arg3 : ensemble des arguments envoyé sur le serveur monithor\-server distant\. Le séparateur est "|"
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Exemple :
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fB$ cat etc/monithor\-client/conf/Card_10\.10\.10\.3\-1666\.cfg\fR
|
|
||||||
.P
|
|
||||||
\fB10\.10\.10\.3:1666#file#/tmp/test\fR
|
|
||||||
.P
|
|
||||||
\fB10\.10\.10\.3:1666#part#/home/isen|50|80\fR
|
|
||||||
.P
|
|
||||||
\fB10\.10\.10\.3:1666#process#sshd\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Multiple cible
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
Chaque fichier peut s'organiser par cible ou par type de sonde ou tout mélangé
|
|
||||||
@ -1,213 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv='content-type' content='text/html;charset=utf8'>
|
|
||||||
<meta name='generator' content='Ronn-NG/v0.9.1 (http://github.com/apjanke/ronn-ng/tree/0.9.1)'>
|
|
||||||
<title>monithor-client(1) - Client bash de monitoring de système d'information</title>
|
|
||||||
<style type='text/css' media='all'>
|
|
||||||
/* style: man */
|
|
||||||
body#manpage {margin:0}
|
|
||||||
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
|
||||||
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
|
||||||
.mp h2 {margin:10px 0 0 0}
|
|
||||||
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
|
||||||
.mp h3 {margin:0 0 0 4ex}
|
|
||||||
.mp dt {margin:0;clear:left}
|
|
||||||
.mp dt.flush {float:left;width:8ex}
|
|
||||||
.mp dd {margin:0 0 0 9ex}
|
|
||||||
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
|
||||||
.mp pre {margin-bottom:20px}
|
|
||||||
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
|
||||||
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
|
||||||
.mp img {display:block;margin:auto}
|
|
||||||
.mp h1.man-title {display:none}
|
|
||||||
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
|
||||||
.mp h2 {font-size:16px;line-height:1.25}
|
|
||||||
.mp h1 {font-size:20px;line-height:2}
|
|
||||||
.mp {text-align:justify;background:#fff}
|
|
||||||
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
|
||||||
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
|
||||||
.mp u {text-decoration:underline}
|
|
||||||
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
|
||||||
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
|
||||||
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
|
||||||
.mp b.man-ref {font-weight:normal;color:#434241}
|
|
||||||
.mp pre {padding:0 4ex}
|
|
||||||
.mp pre code {font-weight:normal;color:#434241}
|
|
||||||
.mp h2+pre,h3+pre {padding-left:0}
|
|
||||||
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
|
||||||
ol.man-decor {width:100%}
|
|
||||||
ol.man-decor li.tl {text-align:left}
|
|
||||||
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
|
||||||
ol.man-decor li.tr {text-align:right;float:right}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<!--
|
|
||||||
The following styles are deprecated and will be removed at some point:
|
|
||||||
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
|
||||||
|
|
||||||
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
|
||||||
.man-navigation should be used instead.
|
|
||||||
-->
|
|
||||||
<body id='manpage'>
|
|
||||||
<div class='mp' id='man'>
|
|
||||||
|
|
||||||
<div class='man-navigation' style='display:none'>
|
|
||||||
<a href="#NAME">NAME</a>
|
|
||||||
<a href="#SYNOPSIS">SYNOPSIS</a>
|
|
||||||
<a href="#DESCRIPTION">DESCRIPTION</a>
|
|
||||||
<a href="#INIT-D">INIT.D</a>
|
|
||||||
<a href="#CONFIGURATION-SERVICE">CONFIGURATION SERVICE</a>
|
|
||||||
<a href="#CONFIGURATION-SONDE">CONFIGURATION SONDE</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ol class='man-decor man-head man head'>
|
|
||||||
<li class='tl'>monithor-client(1)</li>
|
|
||||||
<li class='tc'></li>
|
|
||||||
<li class='tr'>monithor-client(1)</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2 id="NAME">NAME</h2>
|
|
||||||
<p class="man-name">
|
|
||||||
<code>monithor-client</code> - <span class="man-whatis">Client bash de monitoring de système d'information</span>
|
|
||||||
</p>
|
|
||||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
|
||||||
|
|
||||||
<p><code>/usr/local/bin/monithor-client [start/stop]</code></p>
|
|
||||||
|
|
||||||
<p><code>/etc/init.d/monithor-c [start/stop]</code></p>
|
|
||||||
|
|
||||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
|
||||||
|
|
||||||
<p><span class="man-ref">monithor-client<span class="s">(1)</span></span> permet de surveiller votre système d'information</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>l'ensemble du service est basé sur l'ourverture d'une socket TCP via netcat</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>il peut aussi utiliser cryptcat (chiffré)</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>un serveur web en python est lancé sur votre machine de monitoring</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="INIT-D">INIT.D</h2>
|
|
||||||
|
|
||||||
<p>le service peut être démarré et arrêté via system V</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Démarrage</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>/etc/init.d/monithor-c start</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Arrêt</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>/etc/init.d/monithor-c start</code></p>
|
|
||||||
|
|
||||||
<h2 id="CONFIGURATION-SERVICE">CONFIGURATION SERVICE</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Le fichier responsable de la gestion IP/PORT est : service.cfg</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>$ cat etc/monithor-client/service.cfg </code></p>
|
|
||||||
|
|
||||||
<p><code>RemoteIp=10.10.10.3:1666 </code></p>
|
|
||||||
|
|
||||||
<p><code>LocalPassword='Evil@MonitoR-666'</code></p>
|
|
||||||
|
|
||||||
<p><code>Crypted=no</code></p>
|
|
||||||
|
|
||||||
<p><code>Rotation=1</code></p>
|
|
||||||
|
|
||||||
<p><code>TimeOut=2</code></p>
|
|
||||||
|
|
||||||
<p><code>WebPort=80</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>RemoteIp : correspond au couple adresse IP/Port de l'interface réseau utilisée</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>Rotation : correspond à la valeur en seconde (float) entre chaque éxécution complète des sondes</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>TimeOut : correspond à la valeur en seconde (float) du temps maximal d'éxécution de chaque sonde</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>WebPort : correpond au port utilisé pour lancer le serveur web python</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="CONFIGURATION-SONDE">CONFIGURATION SONDE</h2>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>La configuration des sondes est stocké dans le répertoires :</dt>
|
|
||||||
<dd></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p>/etc/monithor-client/conf/</p>
|
|
||||||
|
|
||||||
<p>Tous les fichiers *.cfg sont lus.</p>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>Chaque sonde est composée de cette manière :</dt>
|
|
||||||
<dd></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p><code>IP:PORT#SONDE#arg1|arg2|arg3</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>IP:PORT : correspond à l'adresse et le prot de communication du erveur monithor-server distant.</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>SONDE : correspond au nom de sonde envoyé sur le serveur monithor-server distant.</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p># : séparateur entre le nom de la sonde et les arguments</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>arg1|arg2|arg3 : ensemble des arguments envoyé sur le serveur monithor-server distant. Le séparateur est "|"</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>Exemple :</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>$ cat etc/monithor-client/conf/Card_10.10.10.3-1666.cfg </code></p>
|
|
||||||
|
|
||||||
<p><code>10.10.10.3:1666#file#/tmp/test</code></p>
|
|
||||||
|
|
||||||
<p><code>10.10.10.3:1666#part#/home/isen|50|80</code></p>
|
|
||||||
|
|
||||||
<p><code>10.10.10.3:1666#process#sshd</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Multiple cible</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>Chaque fichier peut s'organiser par cible ou par type de sonde ou tout mélangé</p>
|
|
||||||
|
|
||||||
<ol class='man-decor man-foot man foot'>
|
|
||||||
<li class='tl'></li>
|
|
||||||
<li class='tc'>March 2022</li>
|
|
||||||
<li class='tr'>monithor-client(1)</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Package: monithor-server
|
Package: monithor-server
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Dependsd:netcat,cryptcat
|
Dependsd:netcat,cryptcat,screen,python3,netcat,cryptcat,elinks
|
||||||
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
||||||
Description: monithor Server (nrpe like in netcat/cryptcat and bash)
|
Description: monithor server (netcat & snort)
|
||||||
|
|||||||
8
monithor-server/DEBIAN/postinst
Executable file
8
monithor-server/DEBIAN/postinst
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Update man page"
|
||||||
|
#mkdir /var/cache/man/oldlocal/fr -p
|
||||||
|
#mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
8
monithor-server/DEBIAN/postrm
Executable file
8
monithor-server/DEBIAN/postrm
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Update man page"
|
||||||
|
#mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
|
mkdir -p /var/cache/man/oldlocal/fr
|
||||||
@ -30,6 +30,13 @@ case "$1" in
|
|||||||
/usr/local/bin/monithor-server stop
|
/usr/local/bin/monithor-server stop
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
logger "status MoniThor server" "monithor-d" || true
|
||||||
|
[ "$(ps axf| grep '/usr/local/bin/monithor-server'|grep -v grep)" ] && echo "monithor-d is running" || echo "montihor-d is dead"
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/monithor-d {start|stop|status}" || true
|
echo "Usage: /etc/init.d/monithor-d {start|stop|status}" || true
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
LocalIp=10.10.10.4
|
RemoteIp=10.10.10.4
|
||||||
LocalPort=1666
|
LocalPort=1666
|
||||||
########
|
########
|
||||||
Crypted=no
|
Crypted=no
|
||||||
|
|||||||
@ -8,7 +8,7 @@ source /etc/monithor-server/service.cfg
|
|||||||
Exit () {
|
Exit () {
|
||||||
|
|
||||||
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
||||||
[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
|
#[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -18,17 +18,17 @@ if [[ $(id -u) != "0" ]]
|
|||||||
Exit root
|
Exit root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z $(ifconfig | grep inet | awk '{print $2}' | grep $LocalIp) ]] && Exit Config
|
#[[ -z $(ifconfig | grep inet | awk '{print $2}' | grep $RemoteIp) ]] && Exit Config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[ "${Crypted}" == "yes" ]] && NcCmd="cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort} " || NcCmd="nc -l ${LocalIp} ${LocalPort}"
|
[[ "${Crypted}" == "yes" ]] && NcCmd="cryptcat -k ${LocalPassword} -l ${RemoteIp} -p ${LocalPort} " || NcCmd="nc -l ${RemoteIp} -p ${LocalPort}"
|
||||||
|
|
||||||
if [[ "${1}" == "start" ]]
|
if [[ "${1}" == "start" ]]
|
||||||
then
|
then
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
#coproc cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort}
|
#coproc cryptcat -k ${LocalPassword} -l ${RemoteIp} -p ${LocalPort}
|
||||||
coproc eval ${NcCmd}
|
coproc eval ${NcCmd}
|
||||||
while read -r cmd; do
|
while read -r cmd; do
|
||||||
logger "Running $cmd"
|
logger "Running $cmd"
|
||||||
|
|||||||
@ -1,98 +0,0 @@
|
|||||||
.\" generated with Ronn-NG/v0.9.1
|
|
||||||
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
|
||||||
.TH "MONITHOR\-SERVER" "1" "March 2022" ""
|
|
||||||
.SH "NAME"
|
|
||||||
\fBmonithor\-server\fR \- Serveur bash de monitoring de système d'information
|
|
||||||
.SH "SYNOPSIS"
|
|
||||||
\fB/usr/local/bin/monithor\-server [start/stop]\fR
|
|
||||||
.P
|
|
||||||
\fB/etc/init\.d/monithor\-c [start/stop]\fR
|
|
||||||
.SH "DESCRIPTION"
|
|
||||||
monithor\-server(1) permet d'accépter des requêtes venant d'un instance monithor\-client
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
l'ensemble du service est basé sur l'ourverture d'une socket TCP via netcat
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
il peut aussi utiliser cryptcat (chiffré)
|
|
||||||
.IP "" 0
|
|
||||||
.SH "INIT\.D"
|
|
||||||
le service peut être démarré et arrêté via system V
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Démarrage
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fB/etc/init\.d/monithor\-c start\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Arrêt
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fB/etc/init\.d/monithor\-c start\fR
|
|
||||||
.SH "CONFIGURATION SERVICE"
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Le fichier responsable de la gestion IP/PORT est : service\.cfg
|
|
||||||
.IP "" 0
|
|
||||||
.P
|
|
||||||
\fBLocalIp=10\.10\.10\.4\fR
|
|
||||||
.P
|
|
||||||
\fBLocalPort=1666\fR
|
|
||||||
.P
|
|
||||||
\fBCrypted=no\fR
|
|
||||||
.P
|
|
||||||
\fBLocalPassword='Evil@MonitoR\-666'\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
LocalIp : correspond à l'adresse IP de l'interface réseau en écoute
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
LocalPort : correspond au port de communication du client monithor
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
|
||||||
.IP "" 0
|
|
||||||
.SH "CONFIGURATION SONDE"
|
|
||||||
.TP
|
|
||||||
La configuration des sondes est stocké dans le répertoires :
|
|
||||||
|
|
||||||
.P
|
|
||||||
/etc/monithor\-server/sonde\.cfg
|
|
||||||
.P
|
|
||||||
Chaque sonde est composé de cette manière :
|
|
||||||
.P
|
|
||||||
\fBSONDE#SCRIPT\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
SONDE : Nom de la sonde envoyé par monithor server et reçu par monithor client
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
SCRIPT : Script éxecuté sur l'instance avec le(s) argument(s) reçu(s) de monithor client
|
|
||||||
.IP "" 0
|
|
||||||
.SH "SCRIPT"
|
|
||||||
les scripts sont tous stocké dans le répertoire :
|
|
||||||
.P
|
|
||||||
/usr/local/bin/monithor\-server\.d/
|
|
||||||
.SH "Exemple :"
|
|
||||||
.TP
|
|
||||||
Configuration server :
|
|
||||||
|
|
||||||
.P
|
|
||||||
\fBcat /etc/monithor\-server/sonde\.cfg\fR
|
|
||||||
.P
|
|
||||||
\fBpart#part\-space\.sh\fR
|
|
||||||
.TP
|
|
||||||
Configuration client :
|
|
||||||
|
|
||||||
.P
|
|
||||||
\fB$ cat /etc/monithor\-client/etc/monithor\-client/conf/Card_10\.10\.10\.3\-1666\.cfg\fR
|
|
||||||
.P
|
|
||||||
\fB10\.10\.10\.3:1666#part#/home/isen|50|80\fR
|
|
||||||
.IP "\[ci]" 4
|
|
||||||
Explication
|
|
||||||
.IP "" 0
|
|
||||||
.TS
|
|
||||||
allbox;
|
|
||||||
CLIENT envoi à SERVEUR : part#/home/isen 50 80
|
|
||||||
.TE
|
|
||||||
.P
|
|
||||||
SERVEUR compare la chaine part à son fichier de configuration /etc/monithor\-server/sonde\.cfg
|
|
||||||
.P
|
|
||||||
SERVEUR associe part#part\-space\.sh
|
|
||||||
.P
|
|
||||||
SERVEUR exécute : /usr/local/bin/monithor\-server\.d/part\-space\.sh /home/isen 50 80
|
|
||||||
.P
|
|
||||||
SERVEUR renvoie les valeur récupéré à CLIENT
|
|
||||||
@ -1,220 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv='content-type' content='text/html;charset=utf8'>
|
|
||||||
<meta name='generator' content='Ronn-NG/v0.9.1 (http://github.com/apjanke/ronn-ng/tree/0.9.1)'>
|
|
||||||
<title>monithor-server(1) - Serveur bash de monitoring de système d'information</title>
|
|
||||||
<style type='text/css' media='all'>
|
|
||||||
/* style: man */
|
|
||||||
body#manpage {margin:0}
|
|
||||||
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
|
||||||
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
|
||||||
.mp h2 {margin:10px 0 0 0}
|
|
||||||
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
|
||||||
.mp h3 {margin:0 0 0 4ex}
|
|
||||||
.mp dt {margin:0;clear:left}
|
|
||||||
.mp dt.flush {float:left;width:8ex}
|
|
||||||
.mp dd {margin:0 0 0 9ex}
|
|
||||||
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
|
||||||
.mp pre {margin-bottom:20px}
|
|
||||||
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
|
||||||
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
|
||||||
.mp img {display:block;margin:auto}
|
|
||||||
.mp h1.man-title {display:none}
|
|
||||||
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
|
||||||
.mp h2 {font-size:16px;line-height:1.25}
|
|
||||||
.mp h1 {font-size:20px;line-height:2}
|
|
||||||
.mp {text-align:justify;background:#fff}
|
|
||||||
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
|
||||||
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
|
||||||
.mp u {text-decoration:underline}
|
|
||||||
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
|
||||||
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
|
||||||
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
|
||||||
.mp b.man-ref {font-weight:normal;color:#434241}
|
|
||||||
.mp pre {padding:0 4ex}
|
|
||||||
.mp pre code {font-weight:normal;color:#434241}
|
|
||||||
.mp h2+pre,h3+pre {padding-left:0}
|
|
||||||
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
|
||||||
ol.man-decor {width:100%}
|
|
||||||
ol.man-decor li.tl {text-align:left}
|
|
||||||
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
|
||||||
ol.man-decor li.tr {text-align:right;float:right}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<!--
|
|
||||||
The following styles are deprecated and will be removed at some point:
|
|
||||||
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
|
||||||
|
|
||||||
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
|
||||||
.man-navigation should be used instead.
|
|
||||||
-->
|
|
||||||
<body id='manpage'>
|
|
||||||
<div class='mp' id='man'>
|
|
||||||
|
|
||||||
<div class='man-navigation' style='display:none'>
|
|
||||||
<a href="#NAME">NAME</a>
|
|
||||||
<a href="#SYNOPSIS">SYNOPSIS</a>
|
|
||||||
<a href="#DESCRIPTION">DESCRIPTION</a>
|
|
||||||
<a href="#INIT-D">INIT.D</a>
|
|
||||||
<a href="#CONFIGURATION-SERVICE">CONFIGURATION SERVICE</a>
|
|
||||||
<a href="#CONFIGURATION-SONDE">CONFIGURATION SONDE</a>
|
|
||||||
<a href="#SCRIPT">SCRIPT</a>
|
|
||||||
<a href="#EXEMPLE-">Exemple :</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ol class='man-decor man-head man head'>
|
|
||||||
<li class='tl'>monithor-server(1)</li>
|
|
||||||
<li class='tc'></li>
|
|
||||||
<li class='tr'>monithor-server(1)</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2 id="NAME">NAME</h2>
|
|
||||||
<p class="man-name">
|
|
||||||
<code>monithor-server</code> - <span class="man-whatis">Serveur bash de monitoring de système d'information</span>
|
|
||||||
</p>
|
|
||||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
|
||||||
|
|
||||||
<p><code>/usr/local/bin/monithor-server [start/stop]</code></p>
|
|
||||||
|
|
||||||
<p><code>/etc/init.d/monithor-c [start/stop]</code></p>
|
|
||||||
|
|
||||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
|
||||||
|
|
||||||
<p><span class="man-ref">monithor-server<span class="s">(1)</span></span> permet d'accépter des requêtes venant d'un instance monithor-client</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>l'ensemble du service est basé sur l'ourverture d'une socket TCP via netcat</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>il peut aussi utiliser cryptcat (chiffré)</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="INIT-D">INIT.D</h2>
|
|
||||||
|
|
||||||
<p>le service peut être démarré et arrêté via system V</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Démarrage</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>/etc/init.d/monithor-c start</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Arrêt</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>/etc/init.d/monithor-c start</code></p>
|
|
||||||
|
|
||||||
<h2 id="CONFIGURATION-SERVICE">CONFIGURATION SERVICE</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Le fichier responsable de la gestion IP/PORT est : service.cfg</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p><code>LocalIp=10.10.10.4</code></p>
|
|
||||||
|
|
||||||
<p><code>LocalPort=1666</code></p>
|
|
||||||
|
|
||||||
<p><code>Crypted=no</code></p>
|
|
||||||
|
|
||||||
<p><code>LocalPassword='Evil@MonitoR-666'</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>LocalIp : correspond à l'adresse IP de l'interface réseau en écoute</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>LocalPort : correspond au port de communication du client monithor</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="CONFIGURATION-SONDE">CONFIGURATION SONDE</h2>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>La configuration des sondes est stocké dans le répertoires :</dt>
|
|
||||||
<dd></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p>/etc/monithor-server/sonde.cfg</p>
|
|
||||||
|
|
||||||
<p>Chaque sonde est composé de cette manière :</p>
|
|
||||||
|
|
||||||
<p><code>SONDE#SCRIPT</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>SONDE : Nom de la sonde envoyé par monithor server et reçu par monithor client</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>SCRIPT : Script éxecuté sur l'instance avec le(s) argument(s) reçu(s) de monithor client</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="SCRIPT">SCRIPT</h2>
|
|
||||||
|
|
||||||
<p>les scripts sont tous stocké dans le répertoire :</p>
|
|
||||||
|
|
||||||
<p>/usr/local/bin/monithor-server.d/</p>
|
|
||||||
|
|
||||||
<h2 id="Exemple-">Exemple :</h2>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>Configuration server :</dt>
|
|
||||||
<dd></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p><code>cat /etc/monithor-server/sonde.cfg</code></p>
|
|
||||||
|
|
||||||
<p><code>part#part-space.sh</code></p>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>Configuration client :</dt>
|
|
||||||
<dd></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p><code>$ cat /etc/monithor-client/etc/monithor-client/conf/Card_10.10.10.3-1666.cfg</code></p>
|
|
||||||
|
|
||||||
<p><code>10.10.10.3:1666#part#/home/isen|50|80</code></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Explication</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>CLIENT envoi à SERVEUR : part#/home/isen</td>
|
|
||||||
<td>50</td>
|
|
||||||
<td>80</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p>SERVEUR compare la chaine part à son fichier de configuration /etc/monithor-server/sonde.cfg</p>
|
|
||||||
|
|
||||||
<p>SERVEUR associe part#part-space.sh</p>
|
|
||||||
|
|
||||||
<p>SERVEUR exécute : /usr/local/bin/monithor-server.d/part-space.sh /home/isen 50 80</p>
|
|
||||||
|
|
||||||
<p>SERVEUR renvoie les valeur récupéré à CLIENT</p>
|
|
||||||
|
|
||||||
<ol class='man-decor man-foot man foot'>
|
|
||||||
<li class='tl'></li>
|
|
||||||
<li class='tc'>March 2022</li>
|
|
||||||
<li class='tr'>monithor-server(1)</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user