sandstorm-io / sandstorm

Sandstorm is a self-hostable web productivity suite. It's implemented as a security-hardened web app package manager.
https://sandstorm.io
Other
6.7k stars 706 forks source link

Amazon SES SMTP string does not work #1217

Open aravindet opened 8 years ago

aravindet commented 8 years ago

My SMTP URL is smtp://AKIA<aws smtp user>:<base 64 password>@email-smtp.us-west-2.amazonaws.com:465. Attempting to send a test email gives an Internal Server Error with the following stack trace in the logs:

Exception while invoking method 'testSend' Error: getaddrinfo ENOTFOUND
    at Object.Future.wait (/programs/server/node_modules/fibers/future.js:398:15)
    at smtpSend (packages/sandstorm-email/email.js:101:1)
    at Object.SandstormEmail.rawSend (packages/sandstorm-email/email.js:184:1)
    at Object.SandstormEmail.send (packages/sandstorm-email/email.js:161:1)
    at [object Object].Meteor.methods.testSend (app/shared/admin.js:915:22)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)
    at packages/ddp/livedata_server.js:648:1
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
    at packages/ddp/livedata_server.js:647:1
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
    - - - - -
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)

dig email-smtp.us-west-2.amazonaws.com on the server running sandstorm resolves to the correct IP.

paulproteus commented 8 years ago

Hi Aravind,

Thanks for noticing this and reporting it.

Sometimes this happens when Sandstorm can't resolve any hostnames. This relates to Sandstorm's self-containerizing and how it interacts with /etc/resolv.conf. So first, some quick questions:

What is the output of these two commands:

sandstorm --version

ls -l /etc/resolv.conf

on your system?

aravindet commented 8 years ago
Sandstorm version 132

and

lrwxrwxrwx 1 root root 29 Mar 25  2015 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

where the symlinked file is

-rw-r--r-- 1 root root 210 Oct 20 10:16 /run/resolvconf/resolv.conf

I started sandstorm as root*, and ps gives me:

root      7330     1  0 Dec01 ?        00:00:00 service sandstorm start
root      7331  7330  0 Dec01 ?        00:00:00 service sandstorm start
root      7332  7330  0 Dec01 ?        00:00:00 service sandstorm start
sandsto+  7333  7332  0 Dec01 ?        00:00:00 service sandstorm start
root      7396  7332  0 Dec01 ?        00:00:00 service sandstorm start
sandsto+  7397  7332  0 Dec01 ?        00:00:47 /bin/node sandstorm-main.js

Perhaps relevant: I installed sandstorm with the bash install script from your server but I may have been logged in as root at the time. Everything under /opt/sandstorm is owned by root.

sandstorm start as root works, but as a regular user it gives me:

*** Uncaught exception ***
sandstorm/util.c++:55: failed: open(name.cStr(), flags, mode): Permission denied; name = ../var/pid/sandstorm.pid
stack: 0x4fa730 0x4fa6d9 0x4fa6ca 0x43ca41 0x43d6c5

Not sure if that is expected behavior.