Forum Linux.debian/ubuntu Exim4 probleme de quota ..

Posté par  (site Web personnel) .
Étiquettes : aucune
0
22
sept.
2008
Bonjour, ne sachant plus trop quoi faire je me retourne sur mon forum preferé ..

J'essaye de mettre en place une solution de quota sur un serveur exim4 couplé à mySql.
Le soucis c'est que le systeme me retourne aucune erreur, mais le quota est toujours 'illimité'..

En furetant sur internet, je trouve pas d'autre moyen que celui ci:

Voici mon fichier exim4.conf


######################################################################
# MAIN CONFIGURATION SETTINGS #
######################################################################

# MySQL defines
MYSQL_SERVER=localhost
MYSQL_USER=exim
MYSQL_PASSWORD=SECRET
MYSQL_DB=exim
MYSQL_EMAILTABLE=emailtable
MYSQL_DOMAINTABLE=domaintable
MYSQL_DOMAINRTABLE=relaytable
MYSQL_WHITETABLE=whitelist
MYSQL_BLACKTABLE=blacklist
MYSQL_AUTHTABLE=boxauth
# Mailman vars
MAILMAN_HOME=/var/lib/mailman
MAILMAN_WRAP=MAILMAN_HOME/mail/wrapper
MAILMAN_UID=list
MAILMAN_GID=list

# MySQL queries
MYSQL_Q_ISAWAY=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND is_away='yes'
MYSQL_Q_AWAYTEXT=SELECT away_text FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}'
MYSQL_Q_FORWARD=SELECT forward FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND forward != ''
MYSQL_Q_CC=SELECT cc FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}'
MYSQL_Q_LOCAL=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND box != ''
MYSQL_Q_WCLOCAL=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='*' AND forward != ''
MYSQL_Q_WCLOCFW=SELECT forward FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='*' AND forward != ''
MYSQL_Q_LDOMAIN=SELECT DISTINCT domain FROM MYSQL_DOMAINTABLE WHERE domain='$domain'
MYSQL_Q_RDOMAIN=SELECT DISTINCT domain FROM MYSQL_DOMAINRTABLE WHERE domain='$domain'
MYSQL_Q_BOXNAME=SELECT box FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}'
MYSQL_Q_SPAMC=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND opt_spamscan='yes'
MYSQL_Q_VSCAN=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND opt_virscan='yes'
MYSQL_Q_SPAMPURGE=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND opt_spampurge='yes'
MYSQL_Q_DISABLED=SELECT domain FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND local_part='${quote_mysql:$local_part}' AND is_enabled='no'
MYSQL_Q_WHITELIST=SELECT DISTINCT MYSQL_WHITETABLE.address FROM MYSQL_WHITETABLE WHERE '${quote_mysql:$sender_address}' LIKE whitelist.address
MYSQL_Q_BLACKLIST=SELECT DISTINCT MYSQL_BLACKTABLE.address FROM MYSQL_BLACKTABLE WHERE '${quote_mysql:$sender_address}' LIKE blacklist.address
MYSQL_Q_AUTHPWD1=SELECT boxname FROM MYSQL_AUTHTABLE WHERE boxname='$2' AND boxpwd=encrypt('$3',boxpwd)
MYSQL_Q_AUTHPWD2=SELECT boxname FROM MYSQL_AUTHTABLE WHERE boxname='$1' AND boxpwd=encrypt('$2',boxpwd)

MYSQL_Q_QUOTA=SELECT quota FROM MYSQL_EMAILTABLE WHERE local_part='${quote_mysql:$local_part}' and domain='${quote_mysql:$domain}'


# MySQL connection
hide mysql_servers = "MYSQL_SERVER/MYSQL_DB/MYSQL_USER/MYSQL_PASSWORD"

# starting 'normal' config

domainlist qualify_domain = mysql;MYSQL_Q_LDOMAIN

domainlist local_domains = mysql;MYSQL_Q_LDOMAIN
domainlist relay_to_domains = mysql;MYSQL_Q_RDOMAIN
hostlist relay_from_hosts = 127.0.0.1

acl_smtp_rcpt = acl_check_rcpt


never_users = root
trusted_users = amavis : list

host_lookup = *
rfc1413_hosts = *
rfc1413_query_timeout = 15s

check_spool_space = 50M
check_log_space = 20M
return_size_limit = 20k
message_size_limit = 30M

ignore_bounce_errors_after = 2d
timeout_frozen_after = 7d

deliver_queue_load_max = 8
queue_only_load = 10
remote_max_parallel = 15

#tls_certificate =
#tls_privatekey =
#tls_advertise_hosts = *

######################################################################
# ACL CONFIGURATION #
# Specifies access control lists for incoming SMTP mail #
######################################################################
begin acl

acl_check_rcpt:
accept hosts = :
deny domains = +local_domains
local_parts = ^[.] : ^.*[@%!/|]
deny domains = !+local_domains
local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
accept local_parts = postmaster
domains = +local_domains
require verify = sender
accept domains = +local_domains
endpass
verify = recipient
accept domains = +relay_to_domains
endpass
verify = recipient
accept hosts = +relay_from_hosts
accept authenticated = *
deny message = relay not permitted


######################################################################
# ROUTERS CONFIGURATION #
# Specifies how addresses are handled #
######################################################################
# THE ORDER IN WHICH THE ROUTERS ARE DEFINED IS IMPORTANT! #
# An address is passed to each router in turn until it is accepted. #
######################################################################

begin routers

fail_router:
driver = redirect
domains = ${lookup mysql {MYSQL_Q_DISABLED}{$value}}
data = ":fail:"
allow_fail

##uncomment, if you plan to use mailman (www.list.org)
#mailman_aliases:
# driver = redirect
# allow_fail
# allow_defer
# data = ${lookup{$local_part}lsearch{/etc/aliases.mailman}}
# file_transport = address_file
# pipe_transport = address_pipe

amavis_director:
driver = manualroute
domains = ${lookup mysql {MYSQL_Q_VSCAN}{$value}}
condition = "${if or { \
{eq{$received_protocol}{scanned-ok}} \
{eq{$received_protocol}{spam-scanned}} \
# if you like to scan mails from localhost too, then comment the following line (not good for big mailman lists...)
{eq{$sender_host_address}{127.0.0.1}} \
} \
{0}{1}}"
route_list = "* localhost byname"
transport = amavis
verify = false

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more

blacklist_router:
driver = manualroute
senders = ${lookup mysql {MYSQL_Q_BLACKLIST}{$value}}
condition = "${if !def:h_X-Spam-Flag: {1}{0}}"
headers_add = X-Spam-Flag: YES
route_list = * localhost
self = pass

system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
file_transport = address_file
pipe_transport = address_pipe

spamcheck_director:
driver = manualroute
domains = ${lookup mysql {MYSQL_Q_SPAMC}{$value}}
senders = ! ${lookup mysql {MYSQL_Q_WHITELIST}{$value}}
condition = ${if and { \
{!eq {$received_protocol}{spam-scanned}} \
{!eq {$received_protocol}{local}} \
} {1}{0}}
headers_remove = X-Spam-Flag
route_list = "* localhost byname"
transport = spamcheck
verify = false

spampurge_director:
driver = manualroute
domains = ${lookup mysql {MYSQL_Q_SPAMPURGE}{$value}}
condition = "${if eq{$h_X-Spam-Flag:}{YES} {1}{0}}"
route_list = "* localhost byname"
transport = devnull_transport
verify = false
vacation_director:
driver = accept
domains = ${lookup mysql {MYSQL_Q_ISAWAY}{$value}}
transport = vacation_autoreply
unseen

virtual_cc_director:
driver = redirect
data = ${lookup mysql {MYSQL_Q_CC}{$value}}
unseen

virtual_forward_director:
driver = redirect
data = ${lookup mysql {MYSQL_Q_FORWARD}{$value}}

virtual_local_mailbox:
driver = accept
domains = ${lookup mysql {MYSQL_Q_LOCAL}{$value}}
transport = virtual_local_md_delivery

virtual_wclocal_redirect:
driver = redirect
domains = ${lookup mysql {MYSQL_Q_WCLOCAL}{$value}}
data = ${lookup mysql {MYSQL_Q_WCLOCFW}{$value}}

######################################################################
# TRANSPORTS CONFIGURATION #
######################################################################
# ORDER DOES NOT MATTER #
# Only one appropriate transport is called for each delivery. #
######################################################################

begin transports

remote_smtp:
driver = smtp

devnull_delivery:
driver = appendfile
file = /dev/null
group = mail

address_pipe:
driver = pipe
return_output

address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add

address_reply:
driver = autoreply

amavis:
driver = pipe
command = "/usr/sbin/amavis <${sender_address}> ${pipe_addresses}"
message_prefix =
message_suffix =
check_string =
escape_string =
# for debugging change return_output to true
return_output = false
return_path_add = false
user = amavis
group = mail
path = "/bin:/sbin:/usr/bin:/usr/sbin"
current_directory = "/var/amavis"
spamcheck:
driver = pipe
command = /usr/sbin/exim -oMr spam-scanned -bS
use_bsmtp = true
transport_filter = "/usr/bin/spamc"
home_directory = "/tmp"
current_directory = "/tmp"
user = Debian-exim
group = Debian-exim
log_output = true
return_fail_output = true
return_path_add = false
message_prefix =
message_suffix =

virtual_local_md_delivery:
driver = appendfile
directory = /var/spool/virtual_mail/${lookup mysql {MYSQL_Q_BOXNAME}{$value}}
create_directory
delivery_date_add
envelope_to_add
return_path_add
user = Debian-exim
group = Debian-exim
mode = 0660
directory_mode = 0770
quota = 5M
quota_warn_threshold = 80%
quota_warn_message = "\
To: $local_part@$domain\n\
Subject: Your mailbox at $domain\n\n\
This message is automatically created by the mail delivery software\n\
at $domain.\n\n\
The size of your mailbox has exceeded a warning threshold that is\n\
set by the system administrator. Please remove mails from your\n\
mailbox in order to avoid possible rejection of incoming mail.\n\n\
Feel free to contact our tech support if you encounter any problems.\n\n\
----------------------------------------------------------------\n\n\"


vacation_autoreply:
driver = autoreply
to = ${sender_address}
from = "vacation@${domain}"
subject = "Absence du correspondant ${local_part}@${domain}"
text = ${lookup mysql {MYSQL_Q_AWAYTEXT}{$value}}

devnull_transport:
driver = appendfile
file = /dev/null
user = Debian-exim

######################################################################
# RETRY CONFIGURATION #
######################################################################

begin retry

# This single retry rule applies to all domains and all errors. It specifies
# retries every 15 minutes for 2 hours, then increasing retry intervals,
# starting at 1 hour and increasing each time by a factor of 1.5, up to 16
# hours, then retries every 6 hours until 4 days have passed since the first
# failed delivery.

# Domain Error Retries
# ------ ----- -------

* * F,2h,15m; G,16h,1h,1.5; F,4d,6h



######################################################################
# REWRITE CONFIGURATION #
######################################################################

# There are no rewriting specifications in this default configuration file.
begin rewrite



######################################################################
# AUTHENTICATION CONFIGURATION #
######################################################################

# There are no authenticator specifications in this default configuration file.

begin authenticators

fixed_plain:
driver = plaintext
public_name = PLAIN
server_condition = ${lookup mysql{MYSQL_Q_AUTHPWD1}{1}fail}
server_set_id = $2

fixed_login:
driver = plaintext
public_name = LOGIN
server_prompts = "Username:: : Password::"
server_condition = ${lookup mysql{MYSQL_Q_AUTHPWD2}{1}fail}
server_set_id = $1

######################################################################
# CONFIGURATION FOR local_scan() #
######################################################################

# If you have built Exim to include a local_scan() function that contains
# tables for private options, you can define those options here. Remember to
# uncomment the "begin" line. It is commented by default because it provokes
# an error with Exim binaries that are not built with LOCAL_SCAN_HAS_OPTIONS
# set in the Local/Makefile.

# begin local_scan




Evidemment si je met n'importe quoi comme quota dans transport, j'ai bien une erreur dans le exim4/main.log, mais si je respecte la doc j'ai aucune erreur, par contre il ne prend jamais en compte mon quota.

Par exemple:

smtp:/# authtest box1007
Authentication succeeded.
Authenticated: box1007 (uid 102, gid 104)
Home Directory: /var/spool/virtual_mail/
Maildir: box1007
Quota: (none)
Encrypted Password: ULgsxCYFURSFQ
Cleartext Password: (none)
Options: (none)


Bien sur, derriere aucun quota est pris en compte par les webmails etc . Je suis vraiment a court d'idée, une aide serait la bienvenue.

Merci !
  • # Add:

    Posté par  (site Web personnel) . Évalué à 1.

    Quand je recois un mail pour lui tout va bien, voici le log


    2008-09-22 09:46:03 1KhhzX-0005C1-Hl <= sylvain@domaine.com H=smtp19.orange.fr [80.12.242.1] P=esmtp S=1008 id=1222073220.6606.144.camel@ubuntu
    2008-09-22 09:46:03 1KhhzX-0005Co-J5 <= sylvain@domaine.com U=Debian-exim P=spam-scanned S=1410 id=1222073220.6606.144.camel@ubuntu
    2008-09-22 09:46:03 1KhhzX-0005Co-J5 => bibi <bibi@domaine.com> R=virtual_local_mailbox T=virtual_local_md_delivery
    2008-09-22 09:46:03 1KhhzX-0005Co-J5 Completed
    2008-09-22 09:46:03 1KhhzX-0005C1-Hl => bibi@domaine.com R=spamcheck_director T=spamcheck H=localhost
    2008-09-22 09:46:03 1KhhzX-0005C1-Hl Completed


    Merci encore ..
    • [^] # Re: Add:

      Posté par  . Évalué à 2.

      differend quota

      ton quota dans le transport c'est eventuellement la taille maxi d'un email (entrant/sortant)
      qui serait stocké dans /var/spool/virtual_mail/${lookup mysql {MYSQL_Q_BOXNAME}{$value}}

      cela n'a aucun rapport avec un email qui serait stocké dans le repertoire utilisateur (Maildir)
      afin que ce dernier soit ensuite lu par le webmail.

      tu approches du but, encore un peu de lecture pourra t'aider,
      quota disque si tu stocke tes fichiers sur le disque dur
      quota mysql (ou exim dans mysql) si tes emails sont stockés dans la base de données
      • [^] # Re: Add:

        Posté par  (site Web personnel) . Évalué à 2.

        Merci de ta réponse.

        En faite apres plusieurs test, les commandes quota sont bien prise en compte, si par exemple je met quota=1K, j'ai bien une erreur lors de la reception de l'email comme quoi ca exceed le quota.

        Mes emails sont stockés sur le disque, mais je comprend pas trop ta remarque, meme si j'ai compris le fond.

        Toute les recherches que je fais sur les quota me donne ce genre de chose:
        http://www.flatmtn.com/article/setting-exim#Exim4-6.3
        Qui utilise la methode que j'ai decrit au dessus, sinon je tombe sur des méthodes comme ca:
        http://eole.orion.education.fr/wiki/index.php/Scribe_1.0-quo(...)

        qui sorte du cadre 'integré à exim'.

        Merci de ton aide encore
        • [^] # Re: Add:

          Posté par  (site Web personnel) . Évalué à 2.

          Je précise que ca marche toujours pas, mon message du dessus semble dire l'inverse au début .

          Je precise, si je reduis le quota à quota = 1K, quand je recois un mail ca marche, il refuse car je depasse le quota ( et donc d'apres ce que tu dis ca serait en faite le quota du message en cours et non toute la boite.

          Car malgré ca, j'ai toujours Quota (none) dans imap sur les comptes et qui ont donc un quota illimité en disque : /

          Merci.
          • [^] # Re: Add:

            Posté par  . Évalué à 2.

            Car malgré ca, j'ai toujours Quota (none) dans imap sur les comptes et qui ont donc un quota illimité en disque : /


            il te faut donc trouver un tutoriel qui explique comment faire des quotas disques (50Mo par exemple)

            les quotas emails concernant ensuite seulement la capacité de recevoir/envoyer des emails
            (25Mo par mois par exemple)
  • # re

    Posté par  (site Web personnel) . Évalué à 2.

    Resolu, fallait gratter du coté de courier et authmysql ensuite configurer exim pour maildir et voila :)

Suivre le flux des commentaires

Note : les commentaires appartiennent à ceux qui les ont postés. Nous n’en sommes pas responsables.