Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Allow certificates to be in subfolders of /ssl/ #19

Closed
penenkel opened this issue Dec 29, 2018 · 5 comments
Closed

Allow certificates to be in subfolders of /ssl/ #19

penenkel opened this issue Dec 29, 2018 · 5 comments

Comments

@penenkel
Copy link

Problem/Motivation

I would like to place my certificates in a subfolder of /ssl/ and specifying a corresponding (relative) path in the options.

Actual behavior

Unfortunatly this is not supported. 40-nginx.sh fails with a sed error. My interpretation is that the sed command used to fill the config template cannot handle the slashes in a path.

Steps to reproduce

Simply specify a relative path instead of a filename in the options (and activate ssl of cause) and restart the addon. (To reproduce this you don't actually have to place a certfile at the specified location, as it will fail long before it would be used.)

Proposed changes

The error is caused by the following line in mqtt/rootfs/etc/cont-init.d/40-nginx.sh:
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx-ssl.conf

which modifies the followinf line in the config template mqtt/rootfs/etc/nginx/nginx-ssl.conf:
ssl_certificate /ssl/%%certfile%%;

As you can see specifiing a path relative to /ssl/ should work, at least from the perspective of the config file. Only the templating via sed fails. I'm hoping there is a relativly easy fix by modifing the sed statement.

@addons-assistant
Copy link

👋 Thanks for opening your first issue here! If you're reporting a 🐛 bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.

@frenck
Copy link
Member

frenck commented Dec 30, 2018

I would strongly advise against it.
First of all, it is documented.
Secondly, Hass.io is going to change the way it handles certificates soon. We should be careful not to make changes that become incompatible.

@penenkel
Copy link
Author

@frenck Well, yes, it is documented, this is more of a feature request than a bug ticket.

Your second point holds more water IMHO. If there are plans to change/improve the overall certificate handling I'm quite willing to wait.

@ludeeus
Copy link
Collaborator

ludeeus commented Dec 30, 2018

I will follow @frenck's advise and not change the current options to allow this.
This should and will be handled by hassio in the future.
As a workaround untill then you can create symlinks for the certs so they are in /ssl/

@ludeeus ludeeus closed this as completed Dec 30, 2018
@addons-assistant
Copy link

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@addons-assistant addons-assistant bot locked as resolved and limited conversation to collaborators Jan 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants