-
Notifications
You must be signed in to change notification settings - Fork 62
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
fix file ownership for tighter security [JIRA: TOOLS-232] [JIRA: RIAK-2381] #196
Conversation
Merge latest changes into 2.0
create jira issue |
Are you planning on fixing perms on other platforms too? |
Yes, other affected platforms will be fixed - just working out some details on which ones need it internally. |
For Centos 7: Reviewed ownership for /usr/sbin files - also were owned by riak. 12fee7a fixes that.
For FreeBSD:
|
e70f7b8
to
981c495
Compare
…instead of {{platform_base_dir}} so it's writable for the riak user
- Changes to make sure we install as many things as possible as root:root or root:wheel, rather than package_install_user:package_install_group. - Updates to make it more clear when using variables that they will be writable by the package_install_user. - Always use `package_data_dir` as home directory for user, as package_base_dir should not be writable or owned by package user and more. Erlang cookie file `.erlang.cookie` is created in the home directory, so it must be writable.
63afdf2
to
4a1aaca
Compare
8d4ae5a
to
dc8a0ea
Compare
I'm not entirely clear on why this is necessary, because it seems like the @owner/@group directives that the Makefile generates should take care of it for us. But this should hopefully fix the issue that Doug and I saw where the SMF files were getting installed as the user that built the package instead of root.
@@ -127,29 +133,29 @@ packing_list_files: $(BUILD_STAGE_DIR) templates | |||
echo "@comment Packing /opt/local/etc files" >> +CONTENTS && \ | |||
echo "@cwd /opt/local" >> +CONTENTS && \ | |||
echo "@owner root" >> +CONTENTS && \ | |||
echo "@group {{package_install_user}}" >> +CONTENTS && \ | |||
echo "@group riak" >> +CONTENTS && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change intentional? I think it should stay as package_install_user since node_package isn't supposed to be riak-specific, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, clearly not intentional - thanks for catching it. You mind pushing a fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'll get right on it. Heh, and sorry for my denseness, I guess you're right it clearly wasn't intentional :).
👍 b92e7ba |
fix file ownership for tighter security [JIRA: TOOLS-232] [JIRA: RIAK-2381]
Need to audit file ownership across packages in general - follow conventions of other packages and install as few things as possible as riak:riak (since most systems install executables/libraries as root:root or root:wheel)
Specific issues found:
init.d script in RPM should be owned by root:root not riak:riak - can create a potential security issue.
As a workaround, you should ensure that your init.d scripts are owned by root:root not riak:riak.
on FreeBSD systems using older pkg_add (vs. pkgng) /usr/local/sbin/riak should be owned by root:wheel rather than {{package_install_user}}:{{package_install_group}}
Many installers install most/all of the riak binaries/libraries as riak:riak - change to root:wheel, root:bin, or root:root where appropriate
.erlang.cookie
file is written wherever theriak
user's home directory is. There were several packages that had set it to be {{platform_base_dir}} rather than {{platform_data_dir}}, and {{platform_base_dir}} really should not be writable to the service user. Make sure that any configuration files are readable by riak - in a few cases, this means groupriak
with appropriate (640) permissions - in others, the default is to install 644 so the files are world-readable. Not changing this for now.riak start
and make sure it starts cleanly.riak-admin ping
riak-admin test
to make sure you can actually write/read datariak-admin attach-direct
Todo list for testing: