simonrob / email-oauth2-proxy

An IMAP/POP/SMTP proxy that transparently adds OAuth 2.0 authentication for email clients that don't support this method.
Apache License 2.0
797 stars 86 forks source link

Running GUI as Windows Service #202

Closed GGSMK closed 10 months ago

GGSMK commented 10 months ago

thanks for this awesome app!

We need to use the GUI version because we use SMTP. But the authentication shouldn´t come up again if my understanding is correct. So would it be safe to run the no-gui version as a service?

simonrob commented 10 months ago

I'm not sure why SMTP in particular requires the GUI in your case (and why the no-GUI auth options aren't suitable), but either way, it is not needed again until your provider requires re-authentication. Whether (and when) this happens is down to the service you are using – for example, with O365 there are all sorts of options for admins to configure this. I'd go ahead and try running it as a service – it is typical on the order of months before re-authentication is needed.

D4rki91 commented 8 months ago

Hey, can someone explain me how I can register the proxy as a service at Windows? Do I have to convert my proxy autostart bat to exe and register it with sc.exe?

GGSMK commented 8 months ago

i ended up using either winsw or NSSM.

D4rki91 commented 8 months ago

Im also trying to get it running with NSSM right now but the service is always unexpected closing. Can you provide me an example of your solution please?

D4rki91 commented 8 months ago

This is my attempt thats not working.

nssm install YourServiceName C:\Path\to\python.exe nssm set YourServiceName AppDirectory "C:\email-oauth2-proxy-main" nssm set YourServiceName AppParameters "C:\email-oauth2-proxy-main\emailproxy.py --local-server-auth --debug" nssm start YourServiceName

GGSMK commented 8 months ago

Sorry i do not have access to my solution anymore. From what i can remember i enabled logging in nssm and figured it out based on the logs. Hope it helps!