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

Expose command line option to configure umask for directories and files #190

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mlusetti
Copy link

@mlusetti mlusetti commented Apr 14, 2022

What is the purpose of this change? What does it change?

This will fix #189

Was the change discussed in an issue or in the forum before?

I proposed in #189

Checklist

  • I have enabled maintainer edits for this PR
  • I have added tests for all changes in this PR
  • I have added documentation for the changes (in the manual)
  • There's a new file in changelog/unreleased/ that describes the changes for our users (template here)
  • I have run gofmt on the code in all commits
  • All commit messages are formatted in the same style as the other commits in the repo
  • I'm done, this Pull Request is ready for review

@mlusetti
Copy link
Author

The test/lint check fail on code I haven't touched, so I guess is failing the same way in the master branch too

@fd0
Copy link
Member

fd0 commented Apr 15, 2022

I've fixed this in master (sorry about that) and also raised the min Go version to 1.15. Unfortunately you haven't enabled maintainer edits, so I'm unable to push the fixed commits. Can you please enable that? Thanks!

@mlusetti
Copy link
Author

I've fixed this in master (sorry about that) and also raised the min Go version to 1.15. Unfortunately you haven't enabled maintainer edits, so I'm unable to push the fixed commits. Can you please enable that? Thanks!

I've checked "Allow edits by maintainers" flag ... Should I do anything more ?

@fd0
Copy link
Member

fd0 commented Apr 15, 2022

Hm, no, that's exactly the setting. Maybe I did something wrong? I'll have a look

@fd0 fd0 force-pushed the filemode-dirmode-option-support branch from 408aa04 to 2624163 Compare April 15, 2022 08:28
@fd0
Copy link
Member

fd0 commented Apr 15, 2022

Sigh, PEBKAC, I tried to push to your "restic" repo, instead of the "rest-server" repo. 😁

@mlusetti
Copy link
Author

In my env it didn't fail to build on Go 1.15 and io/fs is not present in the source code

@mlusetti
Copy link
Author

I reworked your diff cause it has lost (a rebase?) my last commit

@mlusetti
Copy link
Author

Hi @fd0 do you think there's need for other changes in the diff ?

@MichaelEischer
Copy link
Member

@mlusetti I think fd0 intentionally removed the "make it go 1.14 buildable" commit as it is no longer necessary after rebasing to the current master branch.

@mlusetti
Copy link
Author

@mlusetti I think fd0 intentionally removed the "make it go 1.14 buildable" commit as it is no longer necessary after rebasing to the current master branch.

Thanks for your pointer but as far as I can see io/fs package is not in GOROOT in 1.15 too ... Am I missing something ?

@ianneub
Copy link

ianneub commented Oct 10, 2022

Is there anything that I could help with to get this PR merged? I could use this patch for a situation very similar to @mlusetti . I am trying to backup the restic files from a user that is different than the rest-server's user. Being able to set new file permissions to 660 for new files would allow this to work in my situation.

Thanks so much for everyone's efforts thus far on this patch and Restic in general!

@mlusetti
Copy link
Author

Any news on this one ?

To me is a simple diff which don't introduce backward incompatibilities nor change any default behaviors.

Thanks

@rawtaz
Copy link
Contributor

rawtaz commented Oct 25, 2022

I'm so stupid. I asked over two months ago in #189 what the more specific use case was, which @mlusetti kindly answered. @MichaelEischer also commented. But I looked for an answer here in this PR.

So, the use case is to be able to let groups read the repository files. This is pretty much in line with a similar change introduced in restic here: https://github.com/restic/restic/pull/3419/files - it allows for group access to the repository files.

Generally speaking our preference would be to have the same behavior here in rest-server to what we have there in restic, or at least restrict the options to the current default and group-readable. We feel the PR as it is now is too allowing basically, we'd like to meet the specific use case instead of opening up to potential mishaps, at least for now.

Copy link
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace the options with a --group-accessible-repositories (maybe someone can come up with a better name). So far it looks like that option should cover the reported use cases and is not prone to accidental misuse as the current options.

directories and files

add a changelog as requested by pull checklist

make it go1.14 buildable

expose command line option to configure umask for
directories and files

implement "group readable repos" instead
of custom DirMode & FileMode
@mlusetti mlusetti force-pushed the filemode-dirmode-option-support branch from ccbb37c to 843b03c Compare September 7, 2023 13:57
@mlusetti
Copy link
Author

mlusetti commented Sep 7, 2023

Tried to rebase commits since a lot has gone through master since the initial PR.
If you prefer we could close this PR and I'll file another one with the current impl branched from current master

Copy link
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to grant the users groups both read and write access. By setting a corresponding umask it should still be possible to prevent those groups from actually being able to write to the repository storage.

regarding the option name @rawtaz suggested a few possible variants like: --group-access, --group-accessible, --group-accessible-repos or --group-repos. I'd also throw in an additional --group-accessible-data. What do you think?

}
if opt.FileMode == 0 {
opt.FileMode = DefaultFileMode
// if opt.dirMode == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these comments.

const DefaultFileMode os.FileMode = 0600

// GroupReadableDirMode is the file mode used for directory creation if group readable
const GroupReadableDirMode os.FileMode = 0750
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer 0770 and 0660 an leave further restrictions to the umask used to run rest-server.

FsyncWarning *sync.Once
FsyncWarning *sync.Once

// If set, we will panic when an internal server error happens. This
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comment doesn't look like it belongs here.

@eloo
Copy link

eloo commented Mar 29, 2024

Hi there,

was the current state of this PR?
I'm right running in the same issue as i want to backup my PVC using VolSync to the restic-rest-server but the file permissions making it tricky to access the backup afterwards from my local machine.

I guess this PR would fix this because i can now use my shared group permissions to access the files.

Thanks

@MichaelEischer
Copy link
Member

@mlusetti Are you still interested in finishing this PR? Or does someone else want to take over?

@mlusetti
Copy link
Author

mlusetti commented Apr 3, 2024

@mlusetti Are you still interested in finishing this PR? Or does someone else want to take over?

Yep, currently I'm using a slightly modified version of the patch that suit my needs.

I can try to see if I've some spare cycle, no guarantees. If anyone faster that would be nice too.

@MichaelEischer
Copy link
Member

I can try to see if I've some spare cycle, no guarantees. If anyone faster that would be nice too.

Just open a new PR once you're ready and refer to this one. Then I'll close the old one.

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.

Expose command line option to configure FileMode and DirMode
6 participants