Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

limit outgoing email size but not incoming

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


ntserafica at gmail

Nov 25, 2009, 6:29 PM

Post #1 of 6 (2328 views)
Permalink
limit outgoing email size but not incoming

Is it possible that I impose restriction on senders not to send emails more than 5mb email? I have read databytes and I
imposed it to one of my server with 15mb. However, I want to implement it to another server but this time it must be
3mb. As I know, both incoming and outgoing will reject emails more than 3mb and I don't want to do that. I want to
accept incoming emails regardless of any size but I want to limit my outgoing smtp to 3mb.


hugo.monteiro at fct

Nov 25, 2009, 7:10 PM

Post #2 of 6 (2219 views)
Permalink
Re: limit outgoing email size but not incoming [In reply to]

packets wrote:
> Is it possible that I impose restriction on senders not to send emails
> more than 5mb email? I have read databytes and I
> imposed it to one of my server with 15mb. However, I want to implement
> it to another server but this time it must be
> 3mb. As I know, both incoming and outgoing will reject emails more
> than 3mb and I don't want to do that. I want to
> accept incoming emails regardless of any size but I want to limit my
> outgoing smtp to 3mb.
>
>


You can specify a different DATABYTES env var for each tcpserver rule
that you have. The existence of that env variable will overwrite the
default value set in the databytes file, if any.

Regards,

Hugo Monteiro.

--
ci.fct.unl.pt:~# cat .signature

Hugo Monteiro
Email : hugo.monteiro [at] fct
Telefone : +351 212948300 Ext.15307
Web : http://hmonteiro.net

Centro de Informática
Faculdade de Ciências e Tecnologia da
Universidade Nova de Lisboa
Quinta da Torre 2829-516 Caparica Portugal
Telefone: +351 212948596 Fax: +351 212948548
www.ci.fct.unl.pt apoio [at] fct

ci.fct.unl.pt:~# _


kollo-qmail at muenster

Nov 25, 2009, 11:35 PM

Post #3 of 6 (2217 views)
Permalink
RE: limit outgoing email size but not incoming [In reply to]

Hello.

> 3mb. As I know, both incoming and outgoing will reject emails more
> than 3mb and I don't want to do that. I want to
> accept incoming emails regardless of any size but I want to limit my
> outgoing smtp to 3mb.

Well, you can do like Hugo Monteiro suggested.
Without patching qmail sources there will be no other way.

If your sender do smtp-auth, it may be a way to alter qmails code
to redefine databytes with a given value if the auth request was
successful. Depending of your qmail you have to change more than
one function in different modules.

Greets
Phil.


lists-qmail at maexotic

Nov 26, 2009, 12:37 AM

Post #4 of 6 (2208 views)
Permalink
Re: limit outgoing email size but not incoming [In reply to]

On Thu, Nov 26, 2009 at 10:29:17AM +0800, packets wrote:
> As I know, both incoming and outgoing will reject emails more than
> 3mb and I don't want to do that.

This is not correct.
DATABYTES only affects incoming messages per qmail-smtpd.
Messages created locally or uploaded and sent eg. via a webmail system
are *NOT* affected.

Next you have to define what you mean by incoming and outgoing.
Do you mean by "incoming" *every* message from *every* user that
would be delivered to a local address/mailbox?
And outgoing would be every message for a non-local user/mailbox?
How about messages coming in for a local user that has a forward to an
external address?
Next is error handling.
At what point do you want to reject the message? Somehow the message has
to be uploaded to your server. Do you want to reject it at that point?
If not, how will you handle the already injected message? Bounce it back
to the sender?

I guess to accomplish what you want I'd modify qmail-smtpd.c in
smtp_rcpt().

Change
------------------------------------------------------------------------
if (!stralloc_0(&rcptto)) die_nomem();
out("250 ok\r\n");
}
------------------------------------------------------------------------
to
------------------------------------------------------------------------
if (!stralloc_0(&rcptto)) die_nomem();
if (addrallowed()) databytes = 0;
out("250 ok\r\n");
}
------------------------------------------------------------------------

What does it do?
For every connection that delivers a message to a local recipient
(addrallowed() results in true) databytes is set to unlimited (aka
turned off).
If you now set DATABYTES to 3MB then every connection that requires a relay
operation will be restricted to 3 MB, every connection with a local
delivery will not.

CAVEAT!!! SMTP allows more than one recipient with one message.
the modification turns off DATABYTES if *ANY ONE* of multiple
recipients of the message is local. So if there is a message
of size 5 MB with 1 local and 1 remote recipient it will be accepted and
delivered remote, even with the 5 MB size.

Hope that helps,

\Maex


kyle-qmail at memoryhole

Nov 26, 2009, 7:36 AM

Post #5 of 6 (2209 views)
Permalink
Re: limit outgoing email size but not incoming [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Thursday, November 26 at 08:35 AM, quoth Philipp Kolloczek:
> Well, you can do like Hugo Monteiro suggested. Without patching
> qmail sources there will be no other way.

Well, now, that's just an open challenge.

You can also do it with a qmail-queue wrapper (a convenient one is
qmail-qfilter). If you rename qmail-queue and qmail-qfilter
appropriately, you can make it apply to locally (e.g.
/usr/sbin/sendmail) produced email as well.

~Kyle
- --
It only takes 20 years for a liberal to become a conservative without
changing a single idea.
-- Robert Anton Wilson
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iQIbBAEBCAAGBQJLDqBPAAoJECuveozR/AWeD94P9ic2QkO3/wmWI6lGIifEOyl7
OkqDBLj8SXA3qm5KbNCG0lDaw8b5H/xDSjbz3CSh5xyzfh1lGStFRDrfTj5p2xmS
MEXJWEH6HH0wIzjCuev6Zxm8kMOSaCQcxHHN7xTUHQzoay+VZ48E35Z0bB/sXbCe
JNYg8UG9hMvUtk9DqmhDWFFKh0liO/elOHXnnGpFW6eAC8TpuIVRY8uDEym4yLQi
+IP9de9yOshotvolA3aGphrR/KNk1+w3YMDz/uMXql29gve1OdummUf7heYeTiAJ
xi9Ja//9AtYZkCtcMJprGBgPhXsW7AfaCrzm5PQyhQ0PER/ysD6tOGDM4sZEVouT
i6CrNI5Xc6rw78rH4sbcdOzIrLV3f9tWVhTz9HkRCMSGsZYUfIAFRJPG5YS34BbL
uYihGv18A5ez0SnwEcsfRx3AADgsUGODd/JZiRG94w1CJtr5NDJhpL/13Oa3Cmpz
iU/ZzIZmzQjS4USKleACpS0XUl7Z+6/7bGLmIV26W/CByeIENq2ByNFLZWcniLO+
9aXvVC7B4Mm16+YjjdffY/DHPEB8E+UUbFiXvN+l9IXlmlSh3R9pKiIxNsRjVzzz
RYz/AZLMOL7cxNENIG0nhoLn23RyQ3D+oxOyOvly29NZX91wMqcXKxK1PelkWpQW
HdEsxwGFLMterv3RORk=
=f5lG
-----END PGP SIGNATURE-----


kyle-qmail at memoryhole

Nov 26, 2009, 7:39 AM

Post #6 of 6 (2210 views)
Permalink
Re: limit outgoing email size but not incoming [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Thursday, November 26 at 09:37 AM, quoth Markus Stumpf:
> Next you have to define what you mean by incoming and outgoing.

This is key (especially since, without something like SMTP-AUTH, it
could be pretty easy for a spammer to work around).

Another way to do it is to place the restriction in a wrapper around
qmail-remote, forcing a failure to deliver if the remote message is
too big. This clearly delineates between "incoming" and "outgoing"
(because incoming messages never go through qmail-remote), but means
that the too-large messages get into the queue even though they'll
never be delivered.

~Kyle
- --
Nothing gives one person so great advantage over another as to remain
always cool and unruffled under all circumstances.
-- Thomas Jefferson to Francis Eppes, 1816
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iQIcBAEBCAAGBQJLDqEpAAoJECuveozR/AWetY8QAJvOeMqJRp+Azfn58O9e5nEd
ChpD7fR+ZQlHg/Ox+iRjZH2n5Hrb8ZSXY60AivD88TN6JukPVQHTmQjw3Oh3ydzV
BqDciQBt3vCvVLpTOfUT23biwdh2/jNgENK/xjG1VIDofjJHOXXQ19XcOt2u5ReS
Khb9slaIbo2MS0e69FUJxeuI+GpRNd4t0xfWpQ9LdsLno396Yer9MwqREvyZkqmD
BOTElj1+LuWMtO1gD4nqQ/ysOf/NFnapC3NAEvGDKWc5tbvbWVoLE3tAPWnKD9zK
xSlJL1rK9TNBvscwTAUG0+4opHa2dx4Ne0gFI9SFttBZRr9s+leqb21ukE6EFkEm
YY1CVNAurEFq3Gtmf0RtK/sGcTIccR1El1z32v9cFTDWnfjHCyvg4YPOQwIUAzFL
Xc2hoBu18h7QkrG8N0vnF5LwaUtaiyDGc0T2EZ/MCmKobIlXVfzDBSQukc4Oq50B
M+Z2VVsIoGizCqQ43zAUYRdaFLWaS49gepr42MP+Ua+b4Jl2drKIIBR7XLRy4s0u
UTVspP3+Abo06zLmaWstQKqpxr1Pyl7DwSbRFYNzSovbPThIUSRioSWK4165me86
jIA4u2EFk78l2avgiErSVwniUyygt46pW0jV8WNThGynJAFMA+Veym/4h0Y6dSSB
723MCyQJX2AgkZtdEMts
=6kre
-----END PGP SIGNATURE-----

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.