-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from typetetris/add-minimal-tls-support
Add TLS and STARTTLS support.
- Loading branch information
Showing
12 changed files
with
361 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ data Command | |
| NOOP | ||
| RSET | ||
| QUIT | ||
| STARTTLS | ||
deriving (Show, Eq) | ||
|
||
type ReplyCode = Int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let | ||
# Nixpkgs source to take test environment from. | ||
nixpkgs-src = import ./nixpkgs-commit.nix; | ||
|
||
# Nixpkgs set with our smtp-mail. | ||
nixpkgs = import ./nixpkgs.nix; | ||
|
||
# Certificates for ssl in tests. | ||
certs = import "${nixpkgs-src}/nixos/tests/common/acme/server/snakeoil-certs.nix"; | ||
|
||
# Lets use the existing test machinery of nixos, but with our nixpkgs | ||
python-test = import "${nixpkgs-src}/nixos/tests/make-test-python.nix"; | ||
|
||
in | ||
python-test { | ||
name = "smtp-mail"; | ||
|
||
machine = { pkgs, ... }: { | ||
imports = [ "${nixpkgs-src}/nixos/tests/common/user-account.nix" ]; | ||
services.postfix = { | ||
enable = true; | ||
enableSubmission = true; | ||
enableSubmissions = true; | ||
sslCACert = certs.ca.cert; | ||
sslCert = certs."acme.test".cert; | ||
sslKey = certs."acme.test".key; | ||
submissionOptions = { | ||
smtpd_sasl_auth_enable = "yes"; | ||
smtpd_client_restrictions = "permit"; | ||
milter_macro_daemon_name = "ORIGINATING"; | ||
}; | ||
submissionsOptions = { | ||
smtpd_sasl_auth_enable = "yes"; | ||
smtpd_client_restrictions = "permit"; | ||
milter_macro_daemon_name = "ORIGINATING"; | ||
}; | ||
}; | ||
|
||
security.pki.certificateFiles = [ | ||
certs.ca.cert | ||
]; | ||
|
||
networking.extraHosts = '' | ||
127.0.0.1 acme.test | ||
''; | ||
|
||
environment.systemPackages = let | ||
in [ nixpkgs.haskellPackages.integration-test ]; | ||
}; | ||
|
||
testScript = '' | ||
machine.wait_for_unit("postfix.service") | ||
machine.succeed("integration-test") | ||
''; | ||
} |
Oops, something went wrong.