ACME TLS implementation using TLS-ALPN-01 - closes #160
This commit is contained in:
28
tests/resources/docker/Docker.pebble
Normal file
28
tests/resources/docker/Docker.pebble
Normal file
@@ -0,0 +1,28 @@
|
||||
FROM golang:1.18-alpine as builder
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
WORKDIR /pebble-src
|
||||
|
||||
RUN apk update && apk add --no-cache git
|
||||
RUN git clone https://github.com/letsencrypt/pebble/ /pebble-src
|
||||
RUN go build -o /go/bin/pebble ./cmd/pebble
|
||||
|
||||
## main
|
||||
FROM alpine:3.15.4
|
||||
|
||||
COPY --from=builder /go/bin/pebble /usr/bin/pebble
|
||||
COPY --from=builder /pebble-src/test/ /test/
|
||||
|
||||
CMD [ "/usr/bin/pebble" ]
|
||||
|
||||
EXPOSE 14000
|
||||
EXPOSE 15000
|
||||
|
||||
# Build:
|
||||
# docker build -f Docker.pebble -t pebble
|
||||
|
||||
# Run:
|
||||
# docker run -d -p 14000:14000 -p 15000:15000 pebble
|
||||
# docker run -d --name pebble -p 14000:14000 -p 15000:15000 pebble pebble -config /test/config/pebble-config.json -strict
|
||||
|
||||
28
tests/resources/docker/docker-compose-pebble.yaml
Normal file
28
tests/resources/docker/docker-compose-pebble.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
# curl --request POST --data '{"ip":"192.168.5.2"}' http://localhost:8055/set-default-ipv4
|
||||
version: '3'
|
||||
services:
|
||||
pebble:
|
||||
image: letsencrypt/pebble:latest
|
||||
command: pebble -config /test/config/pebble-config.json -strict -dnsserver 10.30.50.3:8053
|
||||
ports:
|
||||
- 14000:14000 # HTTPS ACME API
|
||||
- 15000:15000 # HTTPS Management API
|
||||
networks:
|
||||
acmenet:
|
||||
ipv4_address: 10.30.50.2
|
||||
challtestsrv:
|
||||
image: letsencrypt/pebble-challtestsrv:latest
|
||||
command: pebble-challtestsrv -defaultIPv6 "" -defaultIPv4 10.30.50.3
|
||||
ports:
|
||||
- 8055:8055 # HTTP Management API
|
||||
networks:
|
||||
acmenet:
|
||||
ipv4_address: 10.30.50.3
|
||||
|
||||
networks:
|
||||
acmenet:
|
||||
driver: bridge
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: 10.30.50.0/24
|
||||
@@ -276,7 +276,7 @@ async fn init_imap_tests(store_id: &str, delete_if_exists: bool) -> IMAPTest {
|
||||
.replace("{TMP}", &temp_dir.path.display().to_string()),
|
||||
)
|
||||
.unwrap();
|
||||
let servers = config.parse_servers().unwrap();
|
||||
let mut servers = config.parse_servers().unwrap();
|
||||
let stores = config.parse_stores().await.failed("Invalid configuration");
|
||||
let directory = config
|
||||
.parse_directory(&stores, store_id.into())
|
||||
@@ -289,9 +289,16 @@ async fn init_imap_tests(store_id: &str, delete_if_exists: bool) -> IMAPTest {
|
||||
let smtp = SMTP::init(&config, &servers, &stores, &directory, delivery_tx)
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
let jmap = JMAP::init(&config, &stores, &directory, delivery_rx, smtp.clone())
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
let jmap = JMAP::init(
|
||||
&config,
|
||||
&stores,
|
||||
&directory,
|
||||
std::mem::take(&mut servers.certificates),
|
||||
delivery_rx,
|
||||
smtp.clone(),
|
||||
)
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
let imap: Arc<IMAP> = IMAP::init(&config)
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
|
||||
@@ -390,7 +390,7 @@ async fn init_jmap_tests(store_id: &str, delete_if_exists: bool) -> JMAPTest {
|
||||
.replace("{TMP}", &temp_dir.path.display().to_string()),
|
||||
)
|
||||
.unwrap();
|
||||
let servers = config.parse_servers().unwrap();
|
||||
let mut servers = config.parse_servers().unwrap();
|
||||
let stores = config.parse_stores().await.failed("Invalid configuration");
|
||||
let directory = config
|
||||
.parse_directory(&stores, store_id.into())
|
||||
@@ -403,9 +403,16 @@ async fn init_jmap_tests(store_id: &str, delete_if_exists: bool) -> JMAPTest {
|
||||
let smtp = SMTP::init(&config, &servers, &stores, &directory, delivery_tx)
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
let jmap = JMAP::init(&config, &stores, &directory, delivery_rx, smtp.clone())
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
let jmap = JMAP::init(
|
||||
&config,
|
||||
&stores,
|
||||
&directory,
|
||||
std::mem::take(&mut servers.certificates),
|
||||
delivery_rx,
|
||||
smtp.clone(),
|
||||
)
|
||||
.await
|
||||
.failed("Invalid configuration file");
|
||||
let (shutdown_tx, _) = servers.spawn(|server, shutdown_rx| {
|
||||
match &server.protocol {
|
||||
ServerProtocol::Smtp | ServerProtocol::Lmtp => {
|
||||
|
||||
@@ -296,11 +296,11 @@ impl utils::listener::SessionManager for SessionManager {
|
||||
TokioIo::new(
|
||||
session
|
||||
.instance
|
||||
.tls_acceptor
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.acceptor
|
||||
.accept(session.stream)
|
||||
.await
|
||||
.unwrap_tls()
|
||||
.await
|
||||
.unwrap(),
|
||||
),
|
||||
service_fn(|mut req: hyper::Request<body::Incoming>| {
|
||||
|
||||
@@ -37,7 +37,10 @@ use store::{
|
||||
};
|
||||
use tokio::net::TcpSocket;
|
||||
|
||||
use utils::config::{Config, DynValue, KeyLookup, Listener, Rate, Server, ServerProtocol};
|
||||
use utils::{
|
||||
config::{Config, DynValue, KeyLookup, Listener, Rate, Server, ServerProtocol},
|
||||
listener::TcpAcceptor,
|
||||
};
|
||||
|
||||
use ahash::AHashMap;
|
||||
|
||||
@@ -449,7 +452,7 @@ fn parse_servers() {
|
||||
linger: None,
|
||||
nodelay: true,
|
||||
}],
|
||||
tls: None,
|
||||
acceptor: TcpAcceptor::Plain,
|
||||
tls_implicit: false,
|
||||
max_connections: 8192,
|
||||
},
|
||||
@@ -477,7 +480,7 @@ fn parse_servers() {
|
||||
nodelay: true,
|
||||
},
|
||||
],
|
||||
tls: None,
|
||||
acceptor: TcpAcceptor::Plain,
|
||||
tls_implicit: true,
|
||||
max_connections: 1024,
|
||||
},
|
||||
@@ -495,7 +498,7 @@ fn parse_servers() {
|
||||
linger: None,
|
||||
nodelay: true,
|
||||
}],
|
||||
tls: None,
|
||||
acceptor: TcpAcceptor::Plain,
|
||||
tls_implicit: true,
|
||||
max_connections: 8192,
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ use smtp::{
|
||||
};
|
||||
use utils::{
|
||||
config::ServerProtocol,
|
||||
listener::{limiter::ConcurrencyLimiter, ServerInstance},
|
||||
listener::{limiter::ConcurrencyLimiter, ServerInstance, TcpAcceptor},
|
||||
};
|
||||
|
||||
use super::TestConfig;
|
||||
@@ -368,7 +368,7 @@ impl TestServerInstance for ServerInstance {
|
||||
hostname: "mx.example.org".to_string(),
|
||||
protocol: ServerProtocol::Smtp,
|
||||
data: "220 mx.example.org at your service.\r\n".to_string(),
|
||||
tls_acceptor: None,
|
||||
acceptor: TcpAcceptor::Plain,
|
||||
is_tls_implicit: false,
|
||||
limiter: ConcurrencyLimiter::new(100),
|
||||
shutdown_rx,
|
||||
|
||||
Reference in New Issue
Block a user