parent
5600f758b2
commit
8ee2c98c04
@ -0,0 +1,6 @@
|
||||
FROM php:7.4-apache
|
||||
RUN apt update && apt install -y --no-install-recommends sqlite3 git && apt clean && rm -rf /var/lib/apt/lists/*
|
||||
RUN mkdir -p /etc/postfix/
|
||||
COPY . /var/www/html/
|
||||
RUN chmod +x /var/www/html/outils/genenv.sh
|
||||
RUN /var/www/html/outils/genenv.sh
|
@ -1,3 +1,6 @@
|
||||
# Courtail
|
||||
|
||||
Interface WEB d'administration pour le serveur de courriel : https://doc.ycharbi.fr/index.php/Serveur_de_courriels
|
||||
|
||||
## Dépendances du projet
|
||||
`apt install --no-install-recommends sqlite3 php php-sqlite3 apache2 git`
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
echo "<p>Coucou</p>";
|
||||
$db = new PDO("sqlite:/etc/postfix/postfix.sqlite");
|
||||
$db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
try {
|
||||
|
||||
$res = $db -> query('SELECT * FROM postfix_alias_vitruels;');
|
||||
|
||||
|
||||
print '<table>';
|
||||
foreach ($res as $row) {
|
||||
|
||||
print '<tr><td>' . $row['courriel'] . '</td><td>' . $row['destination'] . '</td></tr>';
|
||||
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
|
||||
print ("exception " . $e->getMessage());
|
||||
|
||||
}
|
||||
?>
|
@ -0,0 +1,24 @@
|
||||
-- Alias (ne doivent pas apparaître)
|
||||
INSERT INTO postfix_alias (alias,destination,active) VALUES ("toto","test1",1);
|
||||
INSERT INTO postfix_alias (alias,destination,active) VALUES ("tata","test2",0);
|
||||
INSERT INTO postfix_alias (alias,destination,active) VALUES ("titi","test3",1);
|
||||
|
||||
-- Alias virtuels
|
||||
INSERT INTO postfix_alias_vitruels (courriel,destination,active) VALUES ("toto@exemple.fr","test1@exemple.fr",1);
|
||||
INSERT INTO postfix_alias_vitruels (courriel,destination,active) VALUES ("tata@exemple.fr","test2@exemple.fr",0);
|
||||
INSERT INTO postfix_alias_vitruels (courriel,destination,active) VALUES ("titi@exemple.fr","test3@exemple.fr",1);
|
||||
|
||||
-- Domaines secondaires
|
||||
INSERT INTO postfix_domaines (domaine,active) VALUES ("toto.fr",1);
|
||||
INSERT INTO postfix_domaines (domaine,active) VALUES ("tata.fr",1);
|
||||
INSERT INTO postfix_domaines (domaine,active) VALUES ("titi.fr",0);
|
||||
|
||||
-- Listes noires destinataires
|
||||
INSERT INTO postfix_liste_noire_destinataires (courriel,action,active) VALUES ("root@mail.exemple.fr","REJECT",1);
|
||||
INSERT INTO postfix_liste_noire_destinataires (courriel,action,active) VALUES ("git@mail.exemple.fr","REJECT",1);
|
||||
INSERT INTO postfix_liste_noire_destinataires (courriel,action,active) VALUES ("liste@mail.exemple.fr","REJECT",1);
|
||||
|
||||
-- Listes noires expéditeurs
|
||||
INSERT INTO postfix_liste_noire_expediteurs (courriel,code_retour,message,active) VALUES ("tata@tutu.fr",554,"Parle à ma main, ma tête est malade.",0);
|
||||
INSERT INTO postfix_liste_noire_expediteurs (courriel,code_retour,message,active) VALUES ("bob@foo.com",554,"Parle à ma main, ma tête est malade.",1);
|
||||
INSERT INTO postfix_liste_noire_expediteurs (courriel,code_retour,message,active) VALUES ("roland@bar.org",554,"Parle à ma main, ma tête est malade.",1);
|
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
chemin_script=$(dirname "$0")
|
||||
|
||||
mkdir -p /etc/postfix/
|
||||
rm -f /etc/postfix/postfix.sqlite
|
||||
|
||||
# Création des tables
|
||||
sqlite3 /etc/postfix/postfix.sqlite < "${chemin_script}"/postfix.sql
|
||||
|
||||
# Création des données
|
||||
sqlite3 /etc/postfix/postfix.sqlite < "${chemin_script}"/données.sql
|
@ -0,0 +1,30 @@
|
||||
CREATE TABLE IF NOT EXISTS postfix_alias (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
alias TEXT NOT NULL UNIQUE,
|
||||
destination TEXT NOT NULL,
|
||||
active INTEGER
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS postfix_alias_vitruels (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
courriel TEXT NOT NULL UNIQUE,
|
||||
destination TEXT NOT NULL,
|
||||
active INTEGER
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS postfix_domaines (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
domaine TEXT NOT NULL UNIQUE,
|
||||
active INTEGER
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS postfix_liste_noire_destinataires (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
courriel TEXT NOT NULL UNIQUE,
|
||||
action TEXT NOT NULL,
|
||||
active INTEGER
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS postfix_liste_noire_expediteurs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
courriel TEXT NOT NULL UNIQUE,
|
||||
code_retour INTEGER NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
active INTEGER
|
||||
);
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
docker build -t courtail ../
|
||||
docker run -it -p 8080:80 courtail:latest
|
Loading…
Reference in new issue