Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7cc40880fc | ||
|
6fbf265e6e | ||
|
f84127bcc7 | ||
|
8fecc58b97 |
137
sio2/sisr/30-web/default-ssl.conf
Normal file
137
sio2/sisr/30-web/default-ssl.conf
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<IfModule mod_ssl.c>
|
||||||
|
<VirtualHost _default_:443>
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
#ServerName wordpress
|
||||||
|
DocumentRoot /var/www/html/
|
||||||
|
|
||||||
|
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||||
|
# error, crit, alert, emerg.
|
||||||
|
# It is also possible to configure the loglevel for particular
|
||||||
|
# modules, e.g.
|
||||||
|
#LogLevel info ssl:warn
|
||||||
|
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
|
||||||
|
# For most configuration files from conf-available/, which are
|
||||||
|
# enabled or disabled at a global level, it is possible to
|
||||||
|
# include a line for only one particular virtual host. For example the
|
||||||
|
# following line enables the CGI configuration for this host only
|
||||||
|
# after it has been globally disabled with "a2disconf".
|
||||||
|
#Include conf-available/serve-cgi-bin.conf
|
||||||
|
|
||||||
|
# SSL Engine Switch:
|
||||||
|
# Enable/Disable SSL for this virtual host.
|
||||||
|
SSLEngine on
|
||||||
|
|
||||||
|
# A self-signed (snakeoil) certificate can be created by installing
|
||||||
|
# the ssl-cert package. See
|
||||||
|
# /usr/share/doc/apache2/README.Debian.gz for more info.
|
||||||
|
# If both key and certificate are stored in the same file, only the
|
||||||
|
# SSLCertificateFile directive is needed.
|
||||||
|
SSLCertificateFile /etc/apache2/server.crt
|
||||||
|
SSLCertificateKeyFile /etc/apache2/server.key
|
||||||
|
|
||||||
|
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||||
|
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
||||||
|
|
||||||
|
# Server Certificate Chain:
|
||||||
|
# Point SSLCertificateChainFile at a file containing the
|
||||||
|
# concatenation of PEM encoded CA certificates which form the
|
||||||
|
# certificate chain for the server certificate. Alternatively
|
||||||
|
# the referenced file can be the same as SSLCertificateFile
|
||||||
|
# when the CA certificates are directly appended to the server
|
||||||
|
# certificate for convinience.
|
||||||
|
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
|
||||||
|
|
||||||
|
# Certificate Authority (CA):
|
||||||
|
# Set the CA certificate verification path where to find CA
|
||||||
|
# certificates for client authentication or alternatively one
|
||||||
|
# huge file containing all of them (file must be PEM encoded)
|
||||||
|
# Note: Inside SSLCACertificatePath you need hash symlinks
|
||||||
|
# to point to the certificate files. Use the provided
|
||||||
|
# Makefile to update the hash symlinks after changes.
|
||||||
|
#SSLCACertificatePath /etc/ssl/certs/
|
||||||
|
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
|
||||||
|
|
||||||
|
# Certificate Revocation Lists (CRL):
|
||||||
|
# Set the CA revocation path where to find CA CRLs for client
|
||||||
|
# authentication or alternatively one huge file containing all
|
||||||
|
# of them (file must be PEM encoded)
|
||||||
|
# Note: Inside SSLCARevocationPath you need hash symlinks
|
||||||
|
# to point to the certificate files. Use the provided
|
||||||
|
# Makefile to update the hash symlinks after changes.
|
||||||
|
#SSLCARevocationPath /etc/apache2/ssl.crl/
|
||||||
|
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
|
||||||
|
|
||||||
|
# Client Authentication (Type):
|
||||||
|
# Client certificate verification type and depth. Types are
|
||||||
|
# none, optional, require and optional_no_ca. Depth is a
|
||||||
|
# number which specifies how deeply to verify the certificate
|
||||||
|
# issuer chain before deciding the certificate is not valid.
|
||||||
|
#SSLVerifyClient require
|
||||||
|
#SSLVerifyDepth 10
|
||||||
|
|
||||||
|
# SSL Engine Options:
|
||||||
|
# Set various options for the SSL engine.
|
||||||
|
# o FakeBasicAuth:
|
||||||
|
# Translate the client X.509 into a Basic Authorisation. This means that
|
||||||
|
# the standard Auth/DBMAuth methods can be used for access control. The
|
||||||
|
# user name is the `one line' version of the client's X.509 certificate.
|
||||||
|
# Note that no password is obtained from the user. Every entry in the user
|
||||||
|
# file needs this password: `xxj31ZMTZzkVA'.
|
||||||
|
# o ExportCertData:
|
||||||
|
# This exports two additional environment variables: SSL_CLIENT_CERT and
|
||||||
|
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
|
||||||
|
# server (always existing) and the client (only existing when client
|
||||||
|
# authentication is used). This can be used to import the certificates
|
||||||
|
# into CGI scripts.
|
||||||
|
# o StdEnvVars:
|
||||||
|
# This exports the standard SSL/TLS related `SSL_*' environment variables.
|
||||||
|
# Per default this exportation is switched off for performance reasons,
|
||||||
|
# because the extraction step is an expensive operation and is usually
|
||||||
|
# useless for serving static content. So one usually enables the
|
||||||
|
# exportation for CGI and SSI requests only.
|
||||||
|
# o OptRenegotiate:
|
||||||
|
# This enables optimized SSL connection renegotiation handling when SSL
|
||||||
|
# directives are used in per-directory context.
|
||||||
|
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
|
||||||
|
<FilesMatch "\.(cgi|shtml|phtml|php)$">
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
</FilesMatch>
|
||||||
|
<Directory /usr/lib/cgi-bin>
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# SSL Protocol Adjustments:
|
||||||
|
# The safe and default but still SSL/TLS standard compliant shutdown
|
||||||
|
# approach is that mod_ssl sends the close notify alert but doesn't wait for
|
||||||
|
# the close notify alert from client. When you need a different shutdown
|
||||||
|
# approach you can use one of the following variables:
|
||||||
|
# o ssl-unclean-shutdown:
|
||||||
|
# This forces an unclean shutdown when the connection is closed, i.e. no
|
||||||
|
# SSL close notify alert is send or allowed to received. This violates
|
||||||
|
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
|
||||||
|
# this when you receive I/O errors because of the standard approach where
|
||||||
|
# mod_ssl sends the close notify alert.
|
||||||
|
# o ssl-accurate-shutdown:
|
||||||
|
# This forces an accurate shutdown when the connection is closed, i.e. a
|
||||||
|
# SSL close notify alert is send and mod_ssl waits for the close notify
|
||||||
|
# alert of the client. This is 100% SSL/TLS standard compliant, but in
|
||||||
|
# practice often causes hanging connections with brain-dead browsers. Use
|
||||||
|
# this only for browsers where you know that their SSL implementation
|
||||||
|
# works correctly.
|
||||||
|
# Notice: Most problems of broken clients are also related to the HTTP
|
||||||
|
# keep-alive facility, so you usually additionally want to disable
|
||||||
|
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
|
||||||
|
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
|
||||||
|
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
|
||||||
|
# "force-response-1.0" for this.
|
||||||
|
# BrowserMatch "MSIE [2-6]" \
|
||||||
|
# nokeepalive ssl-unclean-shutdown \
|
||||||
|
# downgrade-1.0 force-response-1.0
|
||||||
|
|
||||||
|
</VirtualHost>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
23
sio2/sisr/30-web/wordpress.conf
Normal file
23
sio2/sisr/30-web/wordpress.conf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#<VirtualHost *:80>
|
||||||
|
# ServerName wordpress
|
||||||
|
# redirect permanent / https://192.168.0.34/wordpress
|
||||||
|
# DocumentRoot /var/www/wordpress
|
||||||
|
|
||||||
|
|
||||||
|
# <Directory /var/www/wordpress/>
|
||||||
|
# AllowOverride All
|
||||||
|
# </Directory>
|
||||||
|
|
||||||
|
|
||||||
|
#</VirtualHost>
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName wordpress
|
||||||
|
DocumentRoot /var/www/html/
|
||||||
|
<Directory /var/www/html/>
|
||||||
|
AllowOverride all
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
ErrorLog /var/log/apache2/error.wordpress.log
|
||||||
|
CustomLog /var/log/apache2/access.wordpress.log combined
|
||||||
|
redirect permanent / https://192.168.0.34/
|
||||||
|
</VirtualHost>
|
98
sio2/sisr/30-web/wp-config.php
Normal file
98
sio2/sisr/30-web/wp-config.php
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* La configuration de base de votre installation WordPress.
|
||||||
|
*
|
||||||
|
* Ce fichier est utilisé par le script de création de wp-config.php pendant
|
||||||
|
* le processus d’installation. Vous n’avez pas à utiliser le site web, vous
|
||||||
|
* pouvez simplement renommer ce fichier en « wp-config.php » et remplir les
|
||||||
|
* valeurs.
|
||||||
|
*
|
||||||
|
* Ce fichier contient les réglages de configuration suivants :
|
||||||
|
*
|
||||||
|
* Réglages MySQL
|
||||||
|
* Préfixe de table
|
||||||
|
* Clés secrètes
|
||||||
|
* Langue utilisée
|
||||||
|
* ABSPATH
|
||||||
|
*
|
||||||
|
* @link https://fr.wordpress.org/support/article/editing-wp-config-php/.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ** Réglages MySQL - Votre hébergeur doit vous fournir ces informations. ** //
|
||||||
|
/** Nom de la base de données de WordPress. */
|
||||||
|
define( 'DB_NAME', 'wordpress' );
|
||||||
|
|
||||||
|
/** Utilisateur de la base de données MySQL. */
|
||||||
|
define( 'DB_USER', 'wordpress_user' );
|
||||||
|
|
||||||
|
/** Mot de passe de la base de données MySQL. */
|
||||||
|
define( 'DB_PASSWORD', 'qdrhh45' );
|
||||||
|
|
||||||
|
/** Adresse de l’hébergement MySQL. */
|
||||||
|
define( 'DB_HOST', 'localhost' );
|
||||||
|
|
||||||
|
/** Jeu de caractères à utiliser par la base de données lors de la création des tables. */
|
||||||
|
define( 'DB_CHARSET', 'utf8' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de collation de la base de données.
|
||||||
|
* N’y touchez que si vous savez ce que vous faites.
|
||||||
|
*/
|
||||||
|
define( 'DB_COLLATE', '' );
|
||||||
|
|
||||||
|
/**#@+
|
||||||
|
* Clés uniques d’authentification et salage.
|
||||||
|
*
|
||||||
|
* Remplacez les valeurs par défaut par des phrases uniques !
|
||||||
|
* Vous pouvez générer des phrases aléatoires en utilisant
|
||||||
|
* {@link https://api.wordpress.org/secret-key/1.1/salt/ le service de clés secrètes de WordPress.org}.
|
||||||
|
* Vous pouvez modifier ces phrases à n’importe quel moment, afin d’invalider tous les cookies existants.
|
||||||
|
* Cela forcera également tous les utilisateurs à se reconnecter.
|
||||||
|
*
|
||||||
|
* @since 2.6.0
|
||||||
|
*/
|
||||||
|
define( 'AUTH_KEY', 'mettez une phrase unique ici' );
|
||||||
|
define( 'SECURE_AUTH_KEY', 'mettez une phrase unique ici' );
|
||||||
|
define( 'LOGGED_IN_KEY', 'mettez une phrase unique ici' );
|
||||||
|
define( 'NONCE_KEY', 'mettez une phrase unique ici' );
|
||||||
|
define( 'AUTH_SALT', 'mettez une phrase unique ici' );
|
||||||
|
define( 'SECURE_AUTH_SALT', 'mettez une phrase unique ici' );
|
||||||
|
define( 'LOGGED_IN_SALT', 'mettez une phrase unique ici' );
|
||||||
|
define( 'NONCE_SALT', 'mettez une phrase unique ici' );
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Préfixe de base de données pour les tables de WordPress.
|
||||||
|
*
|
||||||
|
* Vous pouvez installer plusieurs WordPress sur une seule base de données
|
||||||
|
* si vous leur donnez chacune un préfixe unique.
|
||||||
|
* N’utilisez que des chiffres, des lettres non-accentuées, et des caractères soulignés !
|
||||||
|
*/
|
||||||
|
$table_prefix = 'wp_';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pour les développeurs : le mode déboguage de WordPress.
|
||||||
|
*
|
||||||
|
* En passant la valeur suivante à "true", vous activez l’affichage des
|
||||||
|
* notifications d’erreurs pendant vos essais.
|
||||||
|
* Il est fortement recommandé que les développeurs d’extensions et
|
||||||
|
* de thèmes se servent de WP_DEBUG dans leur environnement de
|
||||||
|
* développement.
|
||||||
|
*
|
||||||
|
* Pour plus d’information sur les autres constantes qui peuvent être utilisées
|
||||||
|
* pour le déboguage, rendez-vous sur le Codex.
|
||||||
|
*
|
||||||
|
* @link https://fr.wordpress.org/support/article/debugging-in-wordpress/
|
||||||
|
*/
|
||||||
|
define( 'WP_DEBUG', false );
|
||||||
|
|
||||||
|
/* C’est tout, ne touchez pas à ce qui suit ! Bonne publication. */
|
||||||
|
|
||||||
|
/** Chemin absolu vers le dossier de WordPress. */
|
||||||
|
if ( ! defined( 'ABSPATH' ) )
|
||||||
|
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
|
||||||
|
|
||||||
|
/** Réglage des variables de WordPress et de ses fichiers inclus. */
|
||||||
|
require_once( ABSPATH . 'wp-settings.php' );
|
10
sio2/sisr/35-script/bash/script/crsamba1
Executable file
10
sio2/sisr/35-script/bash/script/crsamba1
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
fich='user.txt'
|
||||||
|
while read ligne
|
||||||
|
do
|
||||||
|
echo "${ligne}"
|
||||||
|
done < "${fich}"
|
||||||
|
exit 0
|
||||||
|
|
15
sio2/sisr/35-script/bash/script/crsamba2
Executable file
15
sio2/sisr/35-script/bash/script/crsamba2
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
if [[ $# != 1 ]]; then
|
||||||
|
echo "usage : $0 <fichier>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fich="$1"
|
||||||
|
while read ligne
|
||||||
|
do
|
||||||
|
echo "${ligne}"
|
||||||
|
done < "${fich}"
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
19
sio2/sisr/35-script/bash/script/crsamba3
Executable file
19
sio2/sisr/35-script/bash/script/crsamba3
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
if [[ $# != 1 ]]; then
|
||||||
|
echo "usage : $0 <fichier>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fich="$1"
|
||||||
|
if ! [[ -r "${fich}" ]]; then
|
||||||
|
echo "$0 : erreur ouverture fichier ${fich}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
while read ligne
|
||||||
|
do
|
||||||
|
echo "${ligne}"
|
||||||
|
done < "${fich}"
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
22
sio2/sisr/35-script/bash/script/crsamba4
Executable file
22
sio2/sisr/35-script/bash/script/crsamba4
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
if [[ $# != 1 ]]; then
|
||||||
|
echo "usage : $0 <fichier>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fich="$1"
|
||||||
|
if ! [[ -r "${fich}" ]]; then
|
||||||
|
echo "$0 : erreur ouverture fichier ${fich}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
while read ligne
|
||||||
|
do
|
||||||
|
login=$(echo "${ligne}" |cut -f1 -d':')
|
||||||
|
nom=$(echo "${ligne}" |cut -f2 -d':')
|
||||||
|
echo "$login"
|
||||||
|
echo "$nom"
|
||||||
|
done < "${fich}"
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
28
sio2/sisr/35-script/bash/script/crsamba5
Executable file
28
sio2/sisr/35-script/bash/script/crsamba5
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
if [[ $# != 1 ]]; then
|
||||||
|
echo "usage : $0 <fichier>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fich="$1"
|
||||||
|
if ! [[ -r "${fich}" ]]; then
|
||||||
|
echo "$0 : erreur ouverture fichier ${fich}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
while read ligne
|
||||||
|
do
|
||||||
|
login=$(echo "${ligne}" |cut -f1 -d':')
|
||||||
|
nom=$(echo "${ligne}" |cut -f2 -d':')
|
||||||
|
getent passwd "${login}" >> /dev/null
|
||||||
|
if [[ $? != 0 ]] ; then
|
||||||
|
useradd -m -d /home/${login} -c "${nom}" -s /bin/bash ${login}
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "utilisateur ${login} existant"
|
||||||
|
fi
|
||||||
|
done < "${fich}"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
31
sio2/sisr/35-script/bash/script/crsamba7
Executable file
31
sio2/sisr/35-script/bash/script/crsamba7
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
PATH=${PATH}:/usr/sbin
|
||||||
|
if [[ $# != 1 ]]; then
|
||||||
|
echo "usage : $0 <fichier>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fich="$1"
|
||||||
|
if ! [[ -r "${fich}" ]]; then
|
||||||
|
echo "$0 : erreur ouverture fichier ${fich}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
while read ligne
|
||||||
|
do
|
||||||
|
login=$(echo "${ligne}" |cut -f1 -d':')
|
||||||
|
nom=$(echo "${ligne}" |cut -f2 -d':')
|
||||||
|
getent passwd "${login}" >> /dev/null
|
||||||
|
if [[ $? != 0 ]] ; then
|
||||||
|
useradd -m -d /home/${login} -c "${nom}" -s /bin/bash ${login}
|
||||||
|
pw=$(pwgen 4 1)
|
||||||
|
echo "${login}:${pw}"|chpasswd
|
||||||
|
echo "${login}:${pw}" >> "${fich}.pwd"
|
||||||
|
else
|
||||||
|
echo "$0 : utilisateur ${login} existant"
|
||||||
|
fi
|
||||||
|
done < "${fich}"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
1
sio2/sisr/35-script/bash/script/fichier.pwd
Normal file
1
sio2/sisr/35-script/bash/script/fichier.pwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
28
sio2/sisr/35-script/bash/script/rmsamba
Executable file
28
sio2/sisr/35-script/bash/script/rmsamba
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
if [ $# != 1 ]
|
||||||
|
then
|
||||||
|
echo "usage : $0 <fichier>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fich="$1"
|
||||||
|
if ! [[ -r "${fich}" ]]; then
|
||||||
|
echo "$0 : erreur ouverture fichier ${fich}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
while read -r ligne
|
||||||
|
do
|
||||||
|
login=$(echo "${ligne}" |cut -f1 -d':')
|
||||||
|
|
||||||
|
echo "${login}"
|
||||||
|
getent passwd "${login}" >> /dev/null
|
||||||
|
if [[ $? = 0 ]]
|
||||||
|
then
|
||||||
|
userdel -r "${login}"
|
||||||
|
fi
|
||||||
|
done < "${fich}"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
4
sio2/sisr/35-script/bash/script/user.txt
Normal file
4
sio2/sisr/35-script/bash/script/user.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
lucien
|
||||||
|
claudine
|
||||||
|
robert
|
||||||
|
marcelle
|
4
sio2/sisr/35-script/bash/script/user2.txt
Normal file
4
sio2/sisr/35-script/bash/script/user2.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
lucien:Lucien Dubois
|
||||||
|
claudine:Claudine Duparc
|
||||||
|
robert:Robert Macaire
|
||||||
|
marcelle:Marcelle Desforets
|
26
sio2/sisr/35-script/bash/script/user2.txt.pwd
Normal file
26
sio2/sisr/35-script/bash/script/user2.txt.pwd
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
:
|
||||||
|
lucien:1XfC
|
||||||
|
claudine:PT2M
|
||||||
|
robert:K4PJ
|
||||||
|
marcelle:i4WH
|
||||||
|
claudine:7Giq
|
||||||
|
robert:VO4u
|
||||||
|
marcelle:3b8S
|
||||||
|
claudine:7qzL
|
||||||
|
robert:NvV6
|
||||||
|
marcelle:7QnY
|
||||||
|
lucien:e5Hz
|
||||||
|
claudine:j9Un
|
||||||
|
robert:ZnJ6
|
||||||
|
marcelle:B7nR
|
189759
sio2/sisr/35-script/python/access.log
Normal file
189759
sio2/sisr/35-script/python/access.log
Normal file
File diff suppressed because it is too large
Load Diff
19
sio2/sisr/35-script/python/log.py
Normal file
19
sio2/sisr/35-script/python/log.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#/usr/bin/python3
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
group = {}
|
||||||
|
regexp = '^(\S+) (\S+) (\S+) \[([^]]+)\] "(\w+) (\S+).*" (\d+) (\S+)'
|
||||||
|
for line in sys.stdin:
|
||||||
|
line = line.rstrip ( )
|
||||||
|
match = re.match (regexp, line)
|
||||||
|
if match:
|
||||||
|
print (match.group(1)," ",match.group(8))
|
||||||
|
ip = match.group(1)
|
||||||
|
vol = match.group(8)
|
||||||
|
if ip in group:
|
||||||
|
group[ip] = group[ip] + vol
|
||||||
|
else:
|
||||||
|
group[ip] = vol
|
||||||
|
for key in group.keys():
|
||||||
|
print (key, " ", group[key])
|
||||||
|
|
41
sio2/sisr/35-script/python/passusr.py
Normal file
41
sio2/sisr/35-script/python/passusr.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/lib/python3
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
nbarg = len(sys.argv)
|
||||||
|
if nbarg != 2:
|
||||||
|
print ("Nombre d'argument invalide")
|
||||||
|
exit (1)
|
||||||
|
filename = sys.argv[1]
|
||||||
|
try:
|
||||||
|
fh = open(filename, "r")
|
||||||
|
except:
|
||||||
|
print ("Fichier ", filename," inconnu")
|
||||||
|
exit (2)
|
||||||
|
else:
|
||||||
|
line = fh.readline ()
|
||||||
|
while line:
|
||||||
|
nouvline = line.rstrip()
|
||||||
|
login,nomlong = nouvline.split(':')
|
||||||
|
cmd = "sudo useradd -m -d /home/"+login+" -c \'"+ nomlong+"\' -s /bin/bash "+ login
|
||||||
|
res = os.system ("getent passwd "+login)
|
||||||
|
if res != 0:
|
||||||
|
passw = ["pwgen", "4","1"]
|
||||||
|
#passw = "pwgen 4 1"
|
||||||
|
os.system (cmd)
|
||||||
|
#mdp = str(os.system (passw))
|
||||||
|
#print (mdp)
|
||||||
|
mdp = subprocess.run(passw,capture_output=True)
|
||||||
|
mdp2 = mdp.stdout.decode("utf-8")
|
||||||
|
mdp3 = mdp2.rstrip()
|
||||||
|
print (mdp3)
|
||||||
|
ch3 = "echo "+login+":"+mdp3+"|sudo chpasswd"
|
||||||
|
print (ch3)
|
||||||
|
os.system (ch3)
|
||||||
|
os.system ("sudo echo "+login+":"+mdp3+" >> "+filename+".pwd")
|
||||||
|
else:
|
||||||
|
print ("Utilisateur "+login+" déjà éxistant")
|
||||||
|
os.system ("sudo userdel -r "+login)
|
||||||
|
line = fh.readline()
|
||||||
|
|
||||||
|
fh.close()
|
2
sio2/sisr/35-script/python/user.txt
Normal file
2
sio2/sisr/35-script/python/user.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
adupont:Albert Dupont
|
||||||
|
jduroy:Jeannette Duroy
|
4
sio2/sisr/35-script/python/user.txt.pwd
Normal file
4
sio2/sisr/35-script/python/user.txt.pwd
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
adupont:0PSg
|
||||||
|
jduroy:2Sdc
|
||||||
|
adupont:Ksw4
|
||||||
|
jduroy:C0px
|
Reference in New Issue
Block a user