<html>
<head>
<meta content="text/html; charset=ISO-8859-2"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Szia,<br>
<br>
a pop3 proxyban ez elég egyszerű, mert amúgy is parsolja a
usernevet:<br>
<br>
class UserPolicyPop3Proxy(Pop3Proxy):<br>
def config(self):<br>
Pop3Proxy.config(self)<br>
self.banned_users = ("alma", "korte")<br>
self.request["PASS"] = (POP3_REQ_POLICY, self.checkUser)<br>
<br>
def checkUser(self, command):<br>
if self.username in self.banned_users:<br>
proxyLog(self, "pop3.policy", 3, "User
administratively prohibited; username='%s'", self.username)<br>
self.response_param = "User administratively
prohibited."<br>
return POP3_REQ_REJECT<br>
return POP3_REQ_ACCEPT<br>
<br>
Az SMTP sokkal bonyolultabb, de ha PLAIN auth történik, akkor
kezelhető az alábbi proxyval<br>
<br>
import base64<br>
<br>
class UserPolicySmtpProxy(SmtpProxy):<br>
def config(self):<br>
SmtpProxy.config(self)<br>
self.banned_users = ("alma", "korte", "test")<br>
self.request["AUTH"] = (SMTP_REQ_POLICY, self.checkUser)<br>
<br>
def checkUser(self, cmd, param):<br>
if param[:5] != "PLAIN":<br>
self.error_code = "550"<br>
self.error_info = "Only PLAIN authentication is
supported."<br>
return SMTP_REQ_REJECT<br>
base64str = param[6:]<br>
try:<br>
plain = base64.b64decode(base64str)<br>
except TypeError, e:<br>
proxyLog(self, SMTP_ERROR, 3, "Unable to decode PLAIN
auth request; req='%s', error='%s'", (base64str, e) )<br>
return SMTP_REQ_REJECT<br>
try:<br>
(empty, username, password) = plain.split('\0')<br>
except ValueError,e:<br>
proxyLog(self, SMTP_ERROR, 3, "Unable to parse PLAIN
auth request; req='%s', error='%s'", (plain, e) )<br>
return SMTP_REQ_REJECT<br>
if username in self.banned_users:<br>
proxyLog(self, SMTP_POLICY, 3, "User administratively
prohibited; username='%s'", username)<br>
self.error_info = "User administratively prohibited."<br>
return SMTP_REQ_REJECT<br>
return SMTP_REQ_ACCEPT<br>
<br>
Erre gondoltál?<br>
<br>
Üdv,<br>
Balint<br>
<br>
<div class="moz-signature">
<style>
a {color: #004b81}
a.disc { color: #ea7b17}
</style><span style="font-size: 12px"><span style="color: rgb(0, 75,
129);"><span style="color: rgb(234, 123, 23);"><span
style="font-size: 12px"><br>
</span>
</span></span></span></div>
On 12/11/2013 09:51 AM, Tamas Barina wrote:<br>
</div>
<blockquote cite="mid:001201cef64e$3f0d6ed0$bd284c70$@barina.hu"
type="cite">
<pre wrap="">Sziasztok,
Van valamai ilyesmire lehetoseg itt:
Pop3, smtp:
Ha a username != valaki1, valaki2 akkor rejectelje a kapcsolatot?
Tamas Barina
_______________________________________________
zorp-hu mailing list
<a class="moz-txt-link-abbreviated" href="mailto:zorp-hu@lists.balabit.hu">zorp-hu@lists.balabit.hu</a>
<a class="moz-txt-link-freetext" href="https://lists.balabit.hu/mailman/listinfo/zorp-hu">https://lists.balabit.hu/mailman/listinfo/zorp-hu</a>
</pre>
</blockquote>
<br>
</body>
</html>