1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-12-01 05:43:04 +00:00

Add IP-based SMTP authentication (#1149)

هذا الالتزام موجود في:
Charlie Smurthwaite
2020-07-17 11:43:51 +01:00
ملتزم من قبل GitHub
الأصل 5c7802d218
التزام 9a3d568b27
9 ملفات معدلة مع 103 إضافات و14 حذوفات

عرض الملف

@@ -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