مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-03-03 14:24:06 +00:00
Compare commits
3 الالتزامات
| المؤلف | SHA1 | التاريخ | |
|---|---|---|---|
|
|
4c27baee7f | ||
|
|
9399e32234 | ||
|
|
22dcd4901f |
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
".": "3.1.0"
|
".": "3.1.1"
|
||||||
}
|
}
|
||||||
|
|||||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
This file contains all the latest changes and updates to Postal.
|
This file contains all the latest changes and updates to Postal.
|
||||||
|
|
||||||
|
## [3.1.1](https://github.com/postalserver/postal/compare/3.1.0...3.1.1) (2024-03-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't override paths in dockerfile ([9399e32](https://github.com/postalserver/postal/commit/9399e3223467cdacd010e70b58ad6093e128213d))
|
||||||
|
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
* **smtp-sender:** add more tests for AUTH LOGIN ([22dcd49](https://github.com/postalserver/postal/commit/22dcd4901f188915cf4b3c758c6f2fc637a4e1e3))
|
||||||
|
|
||||||
## [3.1.0](https://github.com/postalserver/postal/compare/3.0.2...3.1.0) (2024-03-06)
|
## [3.1.0](https://github.com/postalserver/postal/compare/3.0.2...3.1.0) (2024-03-06)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ RUN echo $VERSION > VERSION
|
|||||||
|
|
||||||
# Set paths for when running in a container
|
# Set paths for when running in a container
|
||||||
ENV POSTAL_CONFIG_FILE_PATH=/config/postal.yml
|
ENV POSTAL_CONFIG_FILE_PATH=/config/postal.yml
|
||||||
ENV POSTAL_SIGNING_KEY_PATH=/config/signing.key
|
|
||||||
ENV SMTP_SERVER_TLS_CERTIFICATE_PATH=/config/smtp.cert
|
|
||||||
ENV SMTP_SERVER_TLS_PRIVATE_KEY_PATH=/config/smtp.key
|
|
||||||
|
|
||||||
# Set the CMD
|
# Set the CMD
|
||||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -16,7 +16,7 @@ gem "hashie"
|
|||||||
gem "highline", require: false
|
gem "highline", require: false
|
||||||
gem "kaminari"
|
gem "kaminari"
|
||||||
gem "klogger-logger"
|
gem "klogger-logger"
|
||||||
gem "konfig-config", "~> 2.0"
|
gem "konfig-config", "~> 3.0"
|
||||||
gem "mail"
|
gem "mail"
|
||||||
gem "moonrope"
|
gem "moonrope"
|
||||||
gem "mysql2"
|
gem "mysql2"
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ GEM
|
|||||||
concurrent-ruby (>= 1.0, < 2.0)
|
concurrent-ruby (>= 1.0, < 2.0)
|
||||||
json
|
json
|
||||||
rouge (>= 3.30, < 5.0)
|
rouge (>= 3.30, < 5.0)
|
||||||
konfig-config (2.1.1)
|
konfig-config (3.0.0)
|
||||||
hashie
|
hashie
|
||||||
loofah (2.22.0)
|
loofah (2.22.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
@@ -353,7 +353,7 @@ DEPENDENCIES
|
|||||||
jquery-rails
|
jquery-rails
|
||||||
kaminari
|
kaminari
|
||||||
klogger-logger
|
klogger-logger
|
||||||
konfig-config (~> 2.0)
|
konfig-config (~> 3.0)
|
||||||
mail
|
mail
|
||||||
moonrope
|
moonrope
|
||||||
mysql2
|
mysql2
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ module Postal
|
|||||||
|
|
||||||
string :signing_key_path do
|
string :signing_key_path do
|
||||||
description "Path to the private key used for signing"
|
description "Path to the private key used for signing"
|
||||||
default "config/postal/signing.key"
|
default "$config-file-root/signing.key"
|
||||||
|
transform { |v| Postal.substitute_config_file_root(v) }
|
||||||
end
|
end
|
||||||
|
|
||||||
string :smtp_relays do
|
string :smtp_relays do
|
||||||
@@ -253,12 +254,14 @@ module Postal
|
|||||||
|
|
||||||
string :tls_certificate_path do
|
string :tls_certificate_path do
|
||||||
description "The path to the SMTP server's TLS certificate"
|
description "The path to the SMTP server's TLS certificate"
|
||||||
default "config/postal/smtp.cert"
|
default "$config-file-root/smtp.cert"
|
||||||
|
transform { |v| Postal.substitute_config_file_root(v) }
|
||||||
end
|
end
|
||||||
|
|
||||||
string :tls_private_key_path do
|
string :tls_private_key_path do
|
||||||
description "The path to the SMTP server's TLS private key"
|
description "The path to the SMTP server's TLS private key"
|
||||||
default "config/postal/smtp.key"
|
default "$config-file-root/smtp.key"
|
||||||
|
transform { |v| Postal.substitute_config_file_root(v) }
|
||||||
end
|
end
|
||||||
|
|
||||||
string :tls_ciphers do
|
string :tls_ciphers do
|
||||||
@@ -502,4 +505,14 @@ module Postal
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class << self
|
||||||
|
|
||||||
|
def substitute_config_file_root(string)
|
||||||
|
return if string.nil?
|
||||||
|
|
||||||
|
string.gsub(/\$config-file-root/i, File.dirname(Postal.config_file_path))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ module Postal
|
|||||||
# by the schema itself. Otherwise, we might see a value returned that
|
# by the schema itself. Otherwise, we might see a value returned that
|
||||||
# looks correct but is actually the default rather than the value from
|
# looks correct but is actually the default rather than the value from
|
||||||
# config file.
|
# config file.
|
||||||
allow_any_instance_of(Konfig::SchemaAttribute).to receive(:default).and_return(nil)
|
allow_any_instance_of(Konfig::SchemaAttribute).to receive(:default) do |a|
|
||||||
|
a.array? ? [] : nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:source) { described_class.new(SOURCE_CONFIG) }
|
let(:source) { described_class.new(SOURCE_CONFIG) }
|
||||||
|
|||||||
@@ -55,6 +55,26 @@ module SMTPServer
|
|||||||
it "requests the username" do
|
it "requests the username" do
|
||||||
expect(client.handle("AUTH LOGIN")).to eq("334 VXNlcm5hbWU6")
|
expect(client.handle("AUTH LOGIN")).to eq("334 VXNlcm5hbWU6")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "requests a password after a username" do
|
||||||
|
client.handle("AUTH LOGIN")
|
||||||
|
expect(client.handle("xx")).to eq("334 UGFzc3dvcmQ6")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "authenticates and returns a response if the password is correct" do
|
||||||
|
client.handle("AUTH LOGIN")
|
||||||
|
client.handle("xx")
|
||||||
|
credential = create(:credential, type: "SMTP")
|
||||||
|
password = Base64.encode64(credential.key)
|
||||||
|
expect(client.handle(password)).to match(/235 Granted for/)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns an error when an invalid credential is provided" do
|
||||||
|
client.handle("AUTH LOGIN")
|
||||||
|
client.handle("xx")
|
||||||
|
password = Base64.encode64("xx")
|
||||||
|
expect(client.handle(password)).to eq("535 Invalid credential")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when a username is provided on the first line" do
|
context "when a username is provided on the first line" do
|
||||||
@@ -71,9 +91,7 @@ module SMTPServer
|
|||||||
expect(client.handle(password)).to match(/235 Granted for/)
|
expect(client.handle(password)).to match(/235 Granted for/)
|
||||||
expect(client.credential).to eq credential
|
expect(client.credential).to eq credential
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
context "when invalid credentials are provided" do
|
|
||||||
it "returns an error and resets the state" do
|
it "returns an error and resets the state" do
|
||||||
username = Base64.encode64("xx")
|
username = Base64.encode64("xx")
|
||||||
password = Base64.encode64("xx")
|
password = Base64.encode64("xx")
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم