-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to implement security/authorization #296
Comments
until there is a sync-engine based security answer, one solution would be to VPN into your home network from the outside. |
Hi @Porco-Rosso, I would recommend:
Thanks! k |
Hi @khamidou Sorry for commenting on a closed issue. But with the rolling-out of nylas as a paid service, I would really like to get this working. As I understand your three suggestions are supposed to be employed together, not as separate options. I would really like to host the nylas-sync engine on my home server in a VM and be able to access it from outside my network securely. However, I do not want to have to rely on always connecting to my vpn in order to just receive and send emails. Is there any way I can achieve this? any insight would be much appreciated! PS: could you please re-open the issue? |
Thank you @khamidou for providing the missing link (for me) in getting this done. Hopefully this will help others, the following is what I have and it's working well. You definitely need to do your own research to figure out how to get everything working together. Run nylas-sync as a docker containerI use the following
Read the documentation for the container on how to add your accounts to the container Serve nylas-sync via an nginx proxy containerI use an alias to start/restart/update my nginx proxy container: alias dkr-proxy="docker stop proxy && docker rm proxy; docker pull jwilder/nginx-proxy && docker run --name proxy -d -p 80:80 -p 443:443 -v /var/run/docker.sock:/tmp/docker.sock -v ${HOME}/junk/.nginx-vhost.d/:/etc/nginx/vhost.d -v ${HOME}/junk/.nginx-htpasswd/:/etc/nginx/htpasswd -v ${HOME}/junk/.lets-encrypt/letsencrypt.sh/certs/all:/etc/nginx/certs --log-driver json-file --log-opt max-size=50k --net bridge -it jwilder/nginx-proxy" There are a few things to note in this alias:
# Require authentication for the /accounts uri.
location /accounts {
auth_basic "Only Beshoy!";
auth_basic_user_file /etc/nginx/htpasswd/REPLACE_WITH_HOST_NAME;
proxy_pass http://REPLACE_WITH_HOST_NAME;
}
$ htpasswd -c ${HOME}/junk/.nginx-htpasswd/REPLACE_WITH_HOST_NAME REPLACE_WITH_USERNAME proxy continued: lets-encrypt ssl certificates:There are a bunch of ways you can do this (if you want to use lets-encrypt certificates). You have to generate a new cert every three months which isn't ideal but they are free and they work well. My setup is too long to add here so I'll leave this to you to scour the internet for examples N1 ClientLast but not least, you need to tell your nylas client to use the ssl and to authenticate via the This probably goes without saying but don't forget to make sure your router is routing port 443 to the machine that is running all of this. I wish you luck in the setup. I ran into issues with the nylas sync container and getting lets-encrypt to (almost) be fully automated which slowed down the process a bit but once it's all up and running, it's quite stable. |
Thank you for finally figuring out how to add authentication! Going to try this out soon. |
if u ask me this is intensionally complicated. I started to dislike this nylas. looks evil |
@dcrystalj, I can't say that I agree with you.
I don't trust my e-mails to anyone -- it's why I opt to build and run it myself. The fact that that's an option causes me to appreciate the work Nylas does, and what they've provided us. There are dozens of e-mail apps out there but for Linux, none are as beautiful or work as well as N1. There are also other cloud-based e-mail providers that don't open source anything. If more companies ran like Nylas, the software world would be a much better place. |
well open source is future thats why nylas is interesting.
there could be one simple basic auth with username and password without ssl dont u think so? |
You don't have to do ssl. The issue with that however is your credentials are traveling through the net unencrypted and easily sniffed out. At that point, you probably don't even need to bother with the basic authentication. |
but i was able to load emails with sync-engine just by pointing my n1 client to correct ip and port without password. That is what bothers me |
If you're using the nginx proxy, port 5555 shouldn't be bound to the host machine. |
I got this working with a setup similar to this
with an nginx.con like this
with the N1 config.json containing APIRoot of "http://user:pass@localhost:5555" YOU CANNOT password protect anything other than /accounts or syncing fails, this maybe ok as it looks like the sync-engine has its own basic auth for everything but /accounts |
Hi,
I've recently set up a sync-engine instance on a home VM, how would I go about allowing N1 to connect to it from outside the network in a safe way?
As I understand correctly there is a security concern simply exposing port 5555, as anybody can query for accounts and account Ids.
I've seen #104 and #115 but still don't quite understand.
The text was updated successfully, but these errors were encountered: