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

Script should create world-readable verification files #32

Closed
wants to merge 1 commit into from
Closed

Script should create world-readable verification files #32

wants to merge 1 commit into from

Conversation

samueltardieu
Copy link
Contributor

The script should use a permissive umask (022) in order to create world-readable verification files.

Some would find this debatable, as the key file might be made readable for everyone as well. In this case, a better solution could be to change the mode of .well-known and .well-known/acme-challenge (0755 when they are created by the script), and on the verification file in any case (mode 0644).

@lucasRolff
Copy link

The files already is chowned to the user and group of the parent directory, so shouldn't be needed.
I also think by default it would create directories with 0755 permissions and files with 0644

Update: Saw the other issue you had 👍

@samueltardieu
Copy link
Contributor Author

Except that chown (which is not even guaranteed to work if the script is not run as root) does not guarantee correct permissions: it is often advised to have the pages of the webserver be owned by a different uid than the server runs under. This way, a malicious script run under the server uid would not be able to corrupt the pages. So you need world readable files, even with chown.

@Neilpang
Copy link
Member

@samueltardieu Can you please fix it?

Thanks.

@samueltardieu
Copy link
Contributor Author

(don't ask me how I could convert an issue into a pull request, I don't know it myself, this is a side effect of using the hub command-line script to create the pull-request, and this option looks obsolete anyway) :-)

@kevinoid
Copy link

I just ran into this issue for the reason @samueltardieu stated (I run acme.sh as a non-root user different from the owner of the webroot directory, which results in chown: Operation not permitted as described in #163).

I agree that writing files to .well-known with umask 022 should be sufficient. If world-readability is an issue, using umask 027 (and chown/chgrp to webroot owner if running as root) should also work.

I'm a fan of the approach in this patch, although I'd call umask before creating the files/dirs rather than chmod after. Obviously the patch is now a bit out of date. Is it worth updating? Is there disagreement about this approach or its implementation? If so, what's the alternative?

kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Feb 13, 2017
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Feb 13, 2017
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
@Neilpang Neilpang closed this Feb 15, 2017
@kevinoid
Copy link

@Neilpang Does this mean running as a user other than the webroot owner (and root) is an unsupported use case?

@Neilpang
Copy link
Member

@kevinoid
Please create a new issue Script should create world-readable verification files, I will fix it soon.

@kevinoid
Copy link

@Neilpang I'm sorry, but I don't understand. You want me to create a new issue with the same name as this issue? If so, why not reopen this one until it is fixed?

Alternatively, I could send a PR of the fix that I am using if you prefer.

@Neilpang
Copy link
Member

@kevinoid
This is a PR, not an issue. And the PR is outdated, so I want a new Issue.

Yes, if you have PR, please send me.

kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Feb 16, 2017
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Feb 16, 2017
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Feb 16, 2017
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Jul 29, 2017
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
kevinoid added a commit to kevinoid/acme.sh that referenced this pull request Nov 30, 2024
When acme.sh is run as a non-root user different from the owner of the
webroot directory it is unable to change the owner of the files in
.well-known to that user, causing permissions errors.  Avoid this by
making the files world-readable.

These files should pose no disclosure risk since they are sent in
cleartext during the HTTP Identifier Validation Challenge[1] and may
already be exposed by directory enumeration, depending on server
settings.  AFAIK they should be safe to expose as world-readable in all
cases.

1.  https://ietf-wg-acme.github.io/acme/#rfc.section.7.2

Fixes acmesh-official#32
Signed-off-by: Kevin Locke <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants