Neztore / tls-rpt-monitor

Stupid. Simple. TLS Report monitoring. Intended to be used with MTA-STS or DANE, for simplified reporting.
MIT License
6 stars 2 forks source link

SyntaxError: Unexpected reserved word: "await" #5

Closed tdmarchetta closed 7 months ago

tdmarchetta commented 8 months ago
tdmarchetta@yellowfish:~/docker/tls-rpt-monitor/tls-rpt-monitor$ npm start

> tls-rpt-monitor@1.1.0 start
> node index.mjs

file:///home/tdmarchetta/docker/tls-rpt-monitor/tls-rpt-monitor/config.mjs:6
  const contents = await readFile(filePath, {encoding: 'utf8'});
                   ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)

I do apologize if this is an easy solution. I am just not able to figure this out. I do appreciate any assistance.

Neztore commented 8 months ago

Hi there,

What is your node version? (node -v) - config.mjs uses of top-level await which requires Node.js version v14.8.0 or newer.

tdmarchetta commented 8 months ago

Hi @Neztore

v12.22.9

Neztore commented 8 months ago

That version is too low, so does not support the feature. I see one of your paths includes "docker", are you using the dockerfile within the repo? It should be using at least Node 21.

Node v12 is no longer supported by the Node.js foundation so I would recommend upgrading your version if you have installed it a different way.

tdmarchetta commented 8 months ago

@Neztore Thank you for your help. I was able to get it up and running. Now I just have to figure out how to point the MTA-STA to HTTPS.

image

I'm making some assumptions that you expect there to be a web proxy on the front of this web service. Right?

Neztore commented 8 months ago

It should be used with a proxy - Nginx for example can handle https with letsencrypt and proxy to the application server via. http. The RFC (and mechanism by which MTA-STS provides protection) requires HTTPS to be used.

You could modify the code to add https support directly, but it is not currently supported (please feel free to open a PR if desired). A reverse proxy would also provide functionality such as caching, ratelimiting.

The page you have sent is returned when requests are made to the index. POST requests are received on the path /v1/tls-rpt.

An example record is:

_smtp._tls v=TLSRPTv1;rua=https://example.com/v1/tls-rpt
tdmarchetta commented 8 months ago

@Neztore Thank you for taking the time to build this. This is a very useful. I think the only thing I don't understand. is the configurations for the smtp settings What file do you enter those into?

Once I have this up and running and in production. I would like to help out any way I can with this project. Would you be open to letting me help with documentation?

Neztore commented 8 months ago

Please see below from the README.md. SMTP settings should be set as an environment variable. You can do this via. your process manager (such as pm2) or if you are using Docker, in your Dockerfile. These are environment variables and not in config.json for security reasons.

Please feel free to contribute to documentation - Pull requests are welcome.

image

tdmarchetta commented 8 months ago

@Neztore Okay, I will puzzle this together and figure this out little by little. Is this service capable of handling multiple domains, or is it limited to handling a single domain?

Neztore commented 8 months ago

It can handle many domains - the Express application code makes no use of Host information, so you can use a proxy to point any domain at it. The section at the end of the readme describes how to configure it to handle multiple domains. Personally, I use the same domain and URL for all of my domains - and use an "otherwise" to send all of the emails to the same place.

Neztore commented 7 months ago

Closing this issue as completed. Let me know if you have any other issues.