Browse Source
Serverless AWS deployments should not need an SMTP service or SMTP credentials just to send Vaultwarden mail. Allow mail delivery through Amazon SES when USE_AWS_SES is enabled, while preserving the existing SMTP and sendmail transports. Add the ses feature and an aws umbrella feature. Keep mail config validation strict by requiring SMTP_FROM for SES, and treat SES as a configured mail transport for email 2FA. Send MIME messages through the SESv2 SendEmail raw content path. Share AWS SDK configuration with S3 so AWS clients use the same reqwest-backed connector and credential loading behavior.pull/5910/head
9 changed files with 127 additions and 24 deletions
@ -0,0 +1,26 @@ |
|||||
|
use aws_config::{AppName, BehaviorVersion}; |
||||
|
use tokio::sync::OnceCell; |
||||
|
|
||||
|
use crate::http_client::aws::AwsReqwestConnector; |
||||
|
|
||||
|
fn aws_reqwest_connector() -> AwsReqwestConnector { |
||||
|
let reqwest_client = reqwest::Client::builder().build().expect("Failed to build reqwest client"); |
||||
|
|
||||
|
AwsReqwestConnector { |
||||
|
client: reqwest_client, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
pub(crate) async fn aws_sdk_config() -> &'static aws_config::SdkConfig { |
||||
|
static AWS_CONFIG: OnceCell<aws_config::SdkConfig> = OnceCell::const_new(); |
||||
|
|
||||
|
AWS_CONFIG |
||||
|
.get_or_init(async || { |
||||
|
aws_config::defaults(BehaviorVersion::latest()) |
||||
|
.app_name(AppName::new("vaultwarden").expect("Failed to build AWS app name")) |
||||
|
.http_client(aws_reqwest_connector()) |
||||
|
.load() |
||||
|
.await |
||||
|
}) |
||||
|
.await |
||||
|
} |
||||
Loading…
Reference in new issue