3 #include "OpenDKIM.hpp"
4 #include "OpenDMARC.hpp"
8 #include "imemstream.hpp"
15 #include <fmt/format.h>
16 #include <fmt/ostream.h>
18 #include <boost/algorithm/string.hpp>
19 #include <boost/iostreams/device/mapped_file.hpp>
21 using namespace std::string_literals
;
23 bool arc_verify(message::parsed
& msg
)
25 CHECK(!msg
.headers
.empty());
30 for (auto const& header
: msg
.headers
) {
31 arv
.header(header
.as_view());
37 LOG(INFO
) << "ARC status == " << arv
.chain_status_str();
38 LOG(INFO
) << "ARC custody == " << arv
.chain_custody_str();
40 return "fail"s
!= arv
.chain_status_str();
43 int main(int argc
, char* argv
[])
45 google::ParseCommandLineFlags(&argc
, &argv
, true);
47 auto const server_identity
= [] {
48 auto const id_from_env
{getenv("GHSMTP_SERVER_ID")};
50 return std::string
{id_from_env
};
52 auto const hostname
{osutil::get_hostname()};
53 if (hostname
.find('.') != std::string::npos
)
56 LOG(FATAL
) << "can't determine my server ID, set GHSMTP_SERVER_ID maybe";
60 auto const config_path
= osutil::get_config_dir();
62 for (int a
= 1; a
< argc
; ++a
) {
63 if (!fs::exists(argv
[a
]))
64 LOG(FATAL
) << "can't find mail file " << argv
[a
];
65 boost::iostreams::mapped_file_source file
;
68 CHECK(msg
.parse(std::string_view(file
.data(), file
.size())));
70 // std::cout << msg.as_string();