مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
Add IP-based SMTP authentication (#1149)
هذا الالتزام موجود في:
ملتزم من قبل
GitHub
الأصل
5c7802d218
التزام
9a3d568b27
@@ -312,8 +312,18 @@ module Postal
|
||||
end
|
||||
|
||||
else
|
||||
# This is unaccepted mail
|
||||
'530 Authentication required'
|
||||
# User is trying to relay but is not authenticated. Try to authenticate by IP address
|
||||
@credential = Credential.where(:type => 'SMTP-IP').all.sort_by { |c| c.ipaddr&.prefix || 0 }.reverse.find do |credential|
|
||||
credential.ipaddr.include?(@ip_address)
|
||||
end
|
||||
|
||||
if @credential
|
||||
# Retry with credential
|
||||
@credential.use
|
||||
rcpt_to(data)
|
||||
else
|
||||
'530 Authentication required'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم