Skip to content
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

Can't seem to use relative path to ssl_server_cert #81

Open
swrobel opened this issue Apr 9, 2014 · 5 comments
Open

Can't seem to use relative path to ssl_server_cert #81

swrobel opened this issue Apr 9, 2014 · 5 comments

Comments

@swrobel
Copy link

swrobel commented Apr 9, 2014

remote_syslog: #<Errno::ENOENT: No such file or directory @ rb_sysopen - ssl/papertrail.crt

I have the papertrail certificate in my application's code and I'm attempting to access it by giving the relative path to the file. I can't give an absolute path, since my deploy directory depends on the environment, application, etc. Anyway, hardcoding paths sucks. I think it has something to do with this comment regarding Daemonize setting the path to /
https://github.com/papertrail/remote_syslog/blob/master/lib/remote_syslog/cli.rb#L171

@troy
Copy link
Contributor

troy commented Apr 9, 2014

I'm actually not 100% sure that a relative path for the key won't work. Is it possible that the working directory remote_syslog was started in - that is, what ssl/ would be relative to - is not the app root (or wherever ssl/ is). Couple ideas for how to identify the working directory:

  • make remote_syslog spit out the directory before it runs this line. A simple way would be to edit tls_endpoint.rb on that system and have it puts Dir.getwd (Dir.getwd), which is that process's working directory.
  • find the script that's starting remote_syslog and have it output the working directory. If this is an init script, it may be /, ~root, or a similar system-related path.
  • as a last resort, try invoking remote_syslog as a user while in the directory containing ssl/ (with the same arguments is used by the init script).

If one or more of those confirm that the wd is the directory containing ssl/, we're into other options:

  • are you able to create a symlink somewhere else in the filesystem, as many deployments scripts do? For example, capistrano creates a current symlink to the current release version.
  • if the provisioning system doesn't support creating a symlink, consider putting the file outside the deploy directory or writing the config file or invocation arguments (which specify the path to the cert) as part of the deployment

@swrobel
Copy link
Author

swrobel commented Apr 9, 2014

I tried your 3rd suggestion, "as a last resort, try invoking remote_syslog as a user while in the directory containing ssl/ (with the same arguments is used by the init script)."

Still get not found even when running it from within the ssl/ dir within my app simply using the following command:
bundle exec remote_syslog -c ../config/remote_syslog.yml --dest-port <port> --tls

I also tried adding puts Dir.getwd in the source but it doesn't seem to get output to the command line. It also seemed to me that this was a better place to put it so I tried it there as well - no luck. I've tried adding an additional puts in cli.rb and that comes out, so it isn't that I'm modifying in the wrong gem dir or something.

@troy
Copy link
Contributor

troy commented Apr 11, 2014

I'm out of easy ideas too. I had one question. You mentioned:

Still get not found even when running it from within the ssl/ dir within my app

Were you in the directory containing ssl/ or in the ssl/ directory itself? I'm guessing that it was just wording, but wanted to confirm.

@swrobel
Copy link
Author

swrobel commented Apr 11, 2014

I've tried it from both

@troy
Copy link
Contributor

troy commented Apr 11, 2014

Okay. If you can get it to spit out the wd, it may well be / but there's a chance it'll be something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants