]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding syslog capability
authorJean-Marc Pigeon <jmp@safe.c>
Sat, 30 Aug 2025 09:05:31 +0000 (05:05 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Sat, 30 Aug 2025 09:05:31 +0000 (05:05 -0400)
dbg/mailleur.conf [new file with mode: 0644]
www/mailleur.php
www/subrou.php [new file with mode: 0644]
www/unienv.php
www/unipos.php

diff --git a/dbg/mailleur.conf b/dbg/mailleur.conf
new file mode 100644 (file)
index 0000000..106b010
--- /dev/null
@@ -0,0 +1,80 @@
+#file used to set environment configuration
+#------------------------------------------------
+#Defining application name
+APPNAME=mailleur
+#root working directoy definition for the whole application
+ROOTBASE="/"
+#defining local default domain
+DFLTDOMAIN="safe.ca"
+#defining the local REALM
+#Caution! the realm is hardcoded within data-base
+#and USED too to hash the user passwd
+#Changing this value coule be a trouble make 
+#(entering again ALL user password)
+REALM="mailleur-email"
+#------------------------------------------------
+#list of listening port to do SMTP protocole
+#format
+#protocol|ipnum|port|iteration[,protocol|ipnum|port|iteration]++
+#example
+#stmtps|ipnum|465|5    -> protocol smtps|IP number|port 465|5 iterations
+#|ipnum|||             -> smtp|ipnum|25|2
+#||,smtps||465|2       -> smtp|0.0.0.0|25|2 + smtps||465|2
+#||                    -> smtp|0.0.0.0|25|2
+#Examples
+#SMTPPORTS="|127.127.10.25|1025|,smtps|127.127.10.25|1026|1"
+#SMTPPORTS="|127.127.10.25|1025|"
+#SMTPPORTS="smtps|127.127.10.25|1065|1"
+#Defaults
+SMTPPORTS="|||5,smtps||465|3,smtp||587|2"
+#------------------------------------------------
+#SSL Security level default value
+#CIPHER_LIST="DEFAULT"
+#SSL_SECURITY=2
+#------------------------------------------------
+#Defining SERVER mode Certificate data
+CA_ROOT_SRV="/etc/pki/tls/make-ca/ca-bundle.crt"
+CA_VERIFY_SRV=0        #to check PEER/client remote certificate
+#If certificate set via do_dns_tlsa.sh (letsencrypt)
+#CA_CERT_SRV="/etc/certbot/mailleur/mailleur-fullchain.pem"
+#CA_KEY_SRV="/etc/certbot/mailleur/mailleur-key.pem"
+#If certificate are self signed (default installation)
+#CA_CERT_SRV="/etc/pki/mailleur/mailleur-cert.pem"
+#CA_KEY_SRV="/etc/pki/mailleur/mailleur-key.pem"
+#Symbolic link set at installation
+CA_CERT_SRV="/etc/mailleur/pki/mailleur-cert.pem"
+CA_KEY_SRV="/etc//mailleur/pki/mailleur-key.pem"
+#------------------------------------------------
+#Defining CLIENT mode Certificate data
+CA_ROOT_CLT="/etc/pki/tls/make-ca/ca-bundle.crt"
+CA_VERIFY_CLT=0        #to check PEER/server remote certificate
+#If certificate set via do_dns_tlsa.sh (letsencrypt)
+#CA_CERT_CLT="/etc/certbot/mailleur/mailleur-fullchain.pem"
+#CA_KEY_CLT="/etc/certbot/mailleur/mailleur-key.pem"
+#If certificate are self signed (default installation)
+#CA_CERT_CLT="/etc/pki/mailleur/mailleur-cert.pem"
+#CA_KEY_CLT="/etc/pki/mailleur/mailleur-key.pem"
+#Symbolic link set at installation
+CA_CERT_CLT="/etc/mailleur/pki/mailleur-cert.pem"
+CA_KEY_CLT="/etc/mailleur/pki/mailleur-key.pem"
+#------------------------------------------------
+#Configured for Postgresql database
+#DB_TYPE can be either POSTGRESQL,MYSQL, default POSTGRESQL
+DB_TYPE=POSTGRESQL
+DB_NAME=mailleur
+DB_HOST=localhost
+DB_PORT=5432
+DB_LANG="UTF-8"
+#------------------------------------------------
+#Dovecot storage directory
+DOV_MAILDIR="/var/spool/mailleur/mails"
+#------------------------------------------------
+#The list of public blacklist serveur
+BLACKLISTER=/etc/mailleur/blacklister.conf
+#the list of IP from which we accept to relay email
+RELAYABLE=/etc/mailleur/relayed.conf
+#------------------------------------------------
+#Minimal credit level to which remote is rejected at once
+#if credit is equal or below that level
+RJCTCRED=-50
+#------------------------------------------------
index c545d9e14fc77433264489cc88672581a7d736c5..387480f069e0659abb6df8eb9354c451ff19c284 100644 (file)
@@ -4,6 +4,7 @@
 function body($action,$logname,$pass)
 
 {
+include_once "subrou.php";
 include_once "unienv.php";
 include_once "scrfun.php";
 include_once "devsql.php";
@@ -11,6 +12,8 @@ $footer=footer("mailleur");
 $dbtype=getenv("DB_TYPE");
 $conn=sql_connect();
 sql_close($conn);
+rou_alert(0,"This a syslog message");
+rou_closelog();
 
 
 $STR  = <<<EOT
@@ -34,6 +37,7 @@ DBTYPE=$dbtype; DBPORT=$dbport
 sql_connect=$mode
 </FONT></STRONG></CENTER>
 </FONT></STRONG></CENTER>
+<BR>
 $footer
 </BODY>
 </HTML>
diff --git a/www/subrou.php b/www/subrou.php
new file mode 100644 (file)
index 0000000..feb369f
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+//==============================================================
+//
+//     To manage very low level function
+//
+//==============================================================
+global $debug;
+
+
+$debug=0;
+
+//==============================================================
+//     Open a syslog channel
+//==============================================================
+function rou_openlog()
+
+{
+openlog("Mailleur (PHP)",LOG_PID,LOG_DAEMON);
+}
+
+//==============================================================
+//     close a syslog channel
+//==============================================================
+
+function rou_closelog()
+
+{
+closelog();
+}
+//==============================================================
+//     log data on syslog channel
+//==============================================================
+function rou_alert($dbglvl,$report)
+
+{
+if ($debug>=$dbglvl)
+  syslog(LOG_INFO,"$report");
+}
+
+rou_openlog();
+?>
index 48fb5bbdc91ac0851d3c36b087a6e301287dbfdc..0e42e8c315fefefe011fb2744c8cab36d62a047e 100644 (file)
@@ -12,7 +12,7 @@ $env_file_path="/etc/mailleur/mailleur.conf";
 $phase=0;
 $proceed=true;
 while ($proceed==true) {
-  //echo ("unienv.c:loadenv JMPDBG phase='$phase'\n");
+  rou_alert(2,"unienv.c:loadenv JMPDBG phase='$phase'");
   switch ($phase) {
     case 0     :               //checking if file exist
       if(!is_file($env_file_path)){
index a92126ad3588f5242b3c3d5d6b0e5b68cc970af2..a9c630d3ed650a3837ad8071c687157994961873 100644 (file)
@@ -32,4 +32,3 @@ return 0;
 }
 ?>
 
-?>