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

Change the default owner of packaged files. See #129 #139

Merged
merged 2 commits into from
Jan 30, 2014

Conversation

aparkinson
Copy link
Contributor

I've introduced appUser to complement daemonUser with the default value of root (This should be changed at a later date). daemonUser defaults to the value of appUser and there is further scope to introduce appGroup etc...

Any Linux Generic Mappings use appUser as the owner of any files.

This is still WIP but I would like a sanity check on the present work...

@@ -83,6 +83,9 @@ object Keys extends DebianKeys {
def target = sbt.Keys.target
def streams = sbt.Keys.streams

// file ownership
def appUser = linux.Keys.appUser
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should take the chance and add appGroup, too

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sorting that out now while I'm rearranging which user accounts need creating in postinst

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm currently trying to sort things out with the debian policy.

The postinst and postrm looks very promising. However I have no experience with the magic setuid (this is the s in chmod) and dpkg-statoverride.

      # 5. adjust file and directory permissions
       if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
       then
           chown -R $SERVER_USER:adm $SERVER_HOME
           chmod u=rwx,g=rxs,o= $SERVER_HOME
       fi

Choose a reason for hiding this comment

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

+1 for appGroup (should be used for %files at rpm build script

Copy link
Member

Choose a reason for hiding this comment

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

File group name should automatically be used for RPM %files.

Did I miss something about the setuid bit? I've used this in the past when you have something like ping which needs to run as root, but you want to allow users to run the exe. However, I'm not sure I see why we'd want that here. Is it in the debian best practices?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's described here. However I think, even it is considered best-practices, we should not use it.
http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html#s-bpp-lower-privs

@muuki88
Copy link
Contributor

muuki88 commented Jan 26, 2014

I think this is a good start. We may add the appGroup and then go for the full functionality setPackageMappingPermissions.

packageMappingWithRename(compressedManPages:_*).gzipped withUser Users.Root withGroup Users.Root withPerms "0644",
packageMappingWithRename(configFiles:_*) withConfig() withUser Users.Root withGroup Users.Root withPerms "0644",
packageMappingWithRename(remaining:_*) withUser Users.Root withGroup Users.Root withPerms "0644"
packageMappingWithRename((binaries ++ directories):_*) withUser user withGroup user withPerms "0755",
Copy link
Member

Choose a reason for hiding this comment

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

might be nice to specify group too, and have it default to the user....

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@jsuereth
Copy link
Member

This is looking great. +1 for the tests as well.

@jsuereth
Copy link
Member

SO, I think assuming we plan to have a follow-up pull request for daemonGroup setting, this PR is good to merge from me. @muuki88 any addiitonal comments?

@aparkinson
Copy link
Contributor Author

@jsuereth I haven't quite finished this request

  • Currently ownership of directories is still with the root user - I see this as a blocker
  • It would be nice to have appGroup

muuki88 added a commit that referenced this pull request Jan 30, 2014
…-files

Change the default owner of packaged files. See #129
@muuki88 muuki88 merged commit 17db3ca into sbt:master Jan 30, 2014
@muuki88
Copy link
Contributor

muuki88 commented Jan 30, 2014

Looking forward for the next one :)

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

Successfully merging this pull request may close these issues.

4 participants