Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
b7be885670 | |||
66ba6ac484 | |||
c11548b778 | |||
b76adc7830 | |||
b5db0b93ef | |||
2ee8d4fa6b |
@ -36,10 +36,11 @@ sudo iptables -A INPUT -p udp --sport 80 -j ACCEPT
|
||||
|
||||
# NAT sur la carte exterieur (pouvoir curl une machine de l'autre coter)
|
||||
sudo iptables -t nat -A POSTROUTING -o "${IFEXT}" -j MASQUERADE -s 10.0.0.0/16
|
||||
sudo iptables -t nat -A POSTROUTING -o "${IFEXT}" -j MASQUERADE -s 172.16.0.0/16
|
||||
#sudo iptables -L -t nat # pour controler
|
||||
sudo iptables -A FORWARD -j ACCEPT
|
||||
|
||||
# Acces DNS sortante
|
||||
sudo iptables -A OUTPUT -p udp --dport 80 -j ACCEPT
|
||||
sudo iptables -A INPUT -p udp --sport 80 -j ACCEPT
|
||||
sudo iptables -A FORWARD -p udp --dport 53 -j ACCEPT
|
||||
sudo iptables -A FORWARD -p udp --sport 53 -j ACCEPT
|
||||
|
||||
|
10
Sio1/SISR1/40-ShellEtBash/crsamba1
Executable file
10
Sio1/SISR1/40-ShellEtBash/crsamba1
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
fich=users.txt
|
||||
while read ligne
|
||||
do
|
||||
echo "${ligne}"
|
||||
done < $fich
|
21
Sio1/SISR1/40-ShellEtBash/crsamba2
Executable file
21
Sio1/SISR1/40-ShellEtBash/crsamba2
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -e
|
||||
#set -u
|
||||
|
||||
fich=$1
|
||||
|
||||
if [[ $# -ne 1 ]] ; then
|
||||
echo "usage : $0 <fichier>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "${fich}" ]] ; then
|
||||
echo "$0 : erreur ouverture ${fich}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
while read ligne
|
||||
do
|
||||
echo "${ligne}"
|
||||
done < $fich
|
22
Sio1/SISR1/40-ShellEtBash/crsamba4
Executable file
22
Sio1/SISR1/40-ShellEtBash/crsamba4
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -e
|
||||
#set -u
|
||||
|
||||
if [[ $# -ne 1 ]] ; then
|
||||
echo "usage : $0 <fichier>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "$1" ]] ; then
|
||||
echo "$0 : erreur ouverture ${fich}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fich=$1
|
||||
while read ligne
|
||||
do
|
||||
echo "${ligne}"|cut -d: -f1
|
||||
done < $fich
|
30
Sio1/SISR1/40-ShellEtBash/crsamba5
Executable file
30
Sio1/SISR1/40-ShellEtBash/crsamba5
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -e
|
||||
#set -u
|
||||
|
||||
if [[ $# -ne 1 ]] ; then
|
||||
echo "usage : $0 <fichier>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "$1" ]] ; then
|
||||
echo "$0 : erreur ouverture ${fich}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
fich=$1
|
||||
while read ligne
|
||||
do
|
||||
login=$(echo "${ligne}"|cut -d: -f1)
|
||||
nom=$(echo "${ligne}"|cut -d: -f2)
|
||||
#echo "${login} ${nom}"
|
||||
getent passwd "${login}" >> /dev/null
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
sudo useradd --create-home --home-dir /home/"${login}" --shell /bin/bash --comment "${nom}" "${login}"
|
||||
else
|
||||
echo "$0 : utilisateur ${login} existe deja"
|
||||
fi
|
||||
|
||||
done < $fich
|
||||
|
33
Sio1/SISR1/40-ShellEtBash/crsamba7
Executable file
33
Sio1/SISR1/40-ShellEtBash/crsamba7
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -e
|
||||
#set -u
|
||||
|
||||
if [[ $# -ne 1 ]] ; then
|
||||
echo "usage : $0 <fichier>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "$1" ]] ; then
|
||||
echo "$0 : erreur ouverture ${fich}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
fich=$1
|
||||
while read ligne
|
||||
do
|
||||
login=$(echo "${ligne}"|cut -d: -f1)
|
||||
nom=$(echo "${ligne}"|cut -d: -f2)
|
||||
#echo "${login} ${nom}"
|
||||
getent passwd "${login}" >> /dev/null
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
sudo useradd --create-home --home-dir /home/"${login}" --shell /bin/bash --comment "${nom}" "${login}"
|
||||
mdp=$(pwgen 6 1)
|
||||
#echo "${mdp}"
|
||||
echo "${login}:${mdp}"|chpasswd
|
||||
echo "${login}:${mdp}" >> "${fich}.pwd"
|
||||
else
|
||||
echo "$0 : utilisateur ${login} existe deja"
|
||||
fi
|
||||
done < $fich
|
||||
|
27
Sio1/SISR1/40-ShellEtBash/rsamba
Executable file
27
Sio1/SISR1/40-ShellEtBash/rsamba
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -e
|
||||
set -u
|
||||
|
||||
if [[ $# -ne 1 ]] ; then
|
||||
echo "usage : $0 <fichier>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "$1" ]] ; then
|
||||
echo "$0 : erreur ouverture ${fich}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
fich=$1
|
||||
|
||||
while read -r ligne
|
||||
do
|
||||
login=$(echo "${ligne}"|cut -d: -f1)
|
||||
getent passwd "${login}" > /dev/null
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
sudo userdel --remove "${login}"
|
||||
echo "Utilisateur ${login} supprime"
|
||||
fi
|
||||
|
||||
done < "${fich}"
|
4
Sio1/SISR1/40-ShellEtBash/users.txt
Normal file
4
Sio1/SISR1/40-ShellEtBash/users.txt
Normal file
@ -0,0 +1,4 @@
|
||||
lucien:Lucien Aymar
|
||||
claudine:Claudine Dupont
|
||||
robert:Robert Michel
|
||||
marcelle:Marcelle Parde
|
8
Sio1/SISR1/40-ShellEtBash/users.txt.pwd
Normal file
8
Sio1/SISR1/40-ShellEtBash/users.txt.pwd
Normal file
@ -0,0 +1,8 @@
|
||||
lucien:naid0O
|
||||
claudine:ooC8oh
|
||||
robert:Ax0aiy
|
||||
marcelle:iv7Oot
|
||||
lucien:Mie8sh
|
||||
claudine:loHe1t
|
||||
robert:Phoo5i
|
||||
marcelle:WuaL5i
|
Reference in New Issue
Block a user