Smart-proxy-win-service wont start

I'm unable to start an msproxy service on a Windows 2012R2 box.

After following the documentation on installing ruby, compiling, and
finally getting to the point where I can successfully run ruby
bin\smart-proxy, I attempted to create a service yet I don't seem to be
able to.

I've used both the register-service.rb as well as new-service powershell
cmdlets to manually create a service.

Both create a service that never properly starts, nor generates any logs.
Manually running as a local user will generate a log that simply dumps:

2017-06-10 22:52:19 -0700 Service is initializing
2017-06-10 22:52:22 -0700 Daemon failure: Service_Main thread exited
abnormally
C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/win32-service-0.8.8/lib/win32/daemon.rb:280:in
mainloop' C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/win32-service-0.8.8/lib/win32/daemon.rb:215:inmainloop'
C:/Program Files/Foreman-SmartProxy/bin/smart-proxy-win-service:39:in
`<main>'

Again, running smart-proxy works just fine, only the service fails.

Anyone able to get the win proxy to actually work? Side thought: what a
horrific install process, why isn't this just a choco package and module
… so it can be installed/configured via puppet like the rest of foreman?

> I'm unable to start an msproxy service on a Windows 2012R2 box.
>
> After following the documentation on installing ruby, compiling, and
> finally getting to the point where I can successfully run ruby
> bin\smart-proxy, I attempted to create a service yet I don't seem to be
> able to.
>
> I've used both the register-service.rb as well as new-service powershell
> cmdlets to manually create a service.

Keep in mind you might have some permission issues.

You are starting smart-proxy most likely as domain admin for testing?

If you want to run smart-proxy with DNS and/or DHCP, and your proxy
needs to connect to the network. I've created a special user for that
purpose, you'll want this user to be member of DHCP Administrators and
DNS Administrators at least.

Then, test this user by:
runas /user=<doamin>&lt;smartproxyuser> cmd

And use this terminal to run smart proxy. Once all checks out, smart
proxy should run. Take care it can read settings and write log files ect.

Our Service command line:
C:\Ruby200-x64\bin\ruby -C c:/TheForeman/smart-proxy
"c:\TheForeman\smart-proxy\bin\smart-proxy-win-service"

There was an issue with the service, IIRC it needs to be called via
bundle exec, starting with 1.14.

>
> Both create a service that never properly starts, nor generates any logs.
> Manually running as a local user will generate a log that simply dumps:
>
> 2017-06-10 22:52:19 -0700 Service is initializing
> 2017-06-10 22:52:22 -0700 Daemon failure: Service_Main thread exited
> abnormally
> C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/win32-service-0.8.8/lib/win32/daemon.rb:280:in
> mainloop&#39; &gt; C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/win32-service-0.8.8/lib/win32/daemon.rb:215:in &gt;mainloop'
> C:/Program Files/Foreman-SmartProxy/bin/smart-proxy-win-service:39:in
> `<main>'
>
> Again, running smart-proxy works just fine, only the service fails.
>
> Anyone able to get the win proxy to actually work? Side thought: what a
> horrific install process, why isn't this just a choco package and module
> … so it can be installed/configured via puppet like the rest of foreman?

Indeed, it is - I think PR's are welcome!

Our smart-proxy is running fine since I use foreman - all versions from 1.8.

··· On 11.06.2017 07:57, Justin DynamicD wrote:


Daniel Helgenberger (helge000)
daniel@helgenberger.net

First off: Thanks for the reply.

Keep in mind you might have some permission issues.
>
> You are starting smart-proxy most likely as domain admin for testing?
>
If you want to run smart-proxy with DNS and/or DHCP, and your proxy
> needs to connect to the network. I've created a special user for that
> purpose, you'll want this user to be member of DHCP Administrators and
> DNS Administrators at least.
>
>
This was done as well as making sure the service account had the"run as
service" permissions on the host as being a local admin during the test
process (not something I'd normally do, but I got annoyed).

> Then, test this user by:
> runas /user=<doamin>&lt;smartproxyuser> cmd
>
> And use this terminal to run smart proxy. Once all checks out, smart
> proxy should run. Take care it can read settings and write log files ect.
>
> Our Service command line:
> C:\Ruby200-x64\bin\ruby -C c:/TheForeman/smart-proxy
> "c:\TheForeman\smart-proxy\bin\smart-proxy-win-service"
>
>
This is very similar to my call, only I'm piggy backing on a sensu ruby
that is installed … I may try swinging it over embedded puppet or a
standalone like you have.

>
> There was an issue with the service, IIRC it needs to be called via
> bundle exec, starting with 1.14.
> Indeed, it is - I think PR's are welcome!
>
> Our smart-proxy is running fine since I use foreman - all versions from
> 1.8.
>
>
If I can figure out how to get this working I may take the extra step of
putting the whole thing in a container otherwise at least a puppet module.
Just been beating my head on this one for awhile.

Thanks for the insight, Ill try comming off the sensu-ruby and double check
permissions.

UPDATE: did eventually get it to work, and permissions, in the end, were
the cause.

I had to grant permissions to the certificates in the puppet directory to
the service account, as puppet, when installed, appears to block
inheritance to that folder and sub-folders. So the service account needed
to be explicitly added back (those who use a custom cert would never run
into this, but I was using the puppet cert and thus the problem).

Thanks for the tip.