-
Notifications
You must be signed in to change notification settings - Fork 16
Run tendrl in SELinux enabled #244
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| = Enable SELinux for tendrl | ||
|
|
||
| SELinux should be enabled in tendrl for the system which controled by selinux. | ||
|
|
||
| == Problem description | ||
|
|
||
| Tendrl could be installed in a system where SELinux could be already enforced. | ||
| Currenlty Tendrl requires selinux to be in disable state. If tendrl disables | ||
| the selinux which may brack the existing policy(security concerns) of the system | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/brack/break/ |
||
| which runs selinux enabled. | ||
|
|
||
| A SELinux-enabled system that runs in permissive mode is not protected by SELinux. | ||
| which will leads to privilege escalation issue. This allows the system | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/will leads/will lead/ |
||
| to be attacked if it does not managed by Selinux completely. A normal user | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/does not managed/is not managed/ |
||
| with no specific privileges on the system who is trying to interact with one of | ||
| the root-running processes that can suddenly misbehave and give the user | ||
| root access or allows the user to launch root access commands. | ||
|
|
||
| Currently tendrl services like gluster-integration, node-agent, api, | ||
| monitoring-integration services are running as unconfined services. | ||
| ex1: system_u:system_r:unconfined_service_t:s0 18240 ? 02:51:40 tendrl-node-age | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep examples in |
||
| ex2: system_u:system_r:unconfined_service_t:s0 18240 ? 02:51:40 tendrl-api | ||
| Unconfined Service issue:- This will leads the 'privileges of the process' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/will leads/will lead/ |
||
| being attacked easily. Tendrl process that run as root are prone to be attacked | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/process that run/processes that run/ |
||
| to get root access on the system. | ||
|
|
||
| Tendrl services does not belong to any selinux domain. Proper selinux domain should | ||
| be assigned to every tendrl services to identify what is allowed for this service. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/every tendrl services/every tendrl service/ |
||
|
|
||
| Currently tendrl does not have enough confined rules for files being used by | ||
| its process. Contexts for files used by tendrl should also be specified clearly. | ||
| So that the resource can be used with the restricted gated privilege. | ||
| The file or directory created in a directory should also acquire same context. | ||
|
|
||
| When the system runs SELinux in permissive mode, users are able to | ||
| label files incorrectly. Files created with SELinux in permissive mode are not | ||
| labeled correctly while files created while SELinux is disabled are not labeled | ||
| at all. This behavior causes problems when changing to enforcing mode. | ||
| Also there are some application that know about SELinux status can change their | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/some application/few applications/ |
||
| behavior when selinux is in permissive mode. | ||
|
|
||
| == Use Cases | ||
|
|
||
| * Enable SELinux security system for tendrl | ||
| * Retain the existing security measures in an already enabled SELinux system | ||
|
|
||
| == Proposed change | ||
|
|
||
| * Running a tendrl related services in a Specific Security Context | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/a tendrl related services/tendrl related services/ |
||
| Tendrl can have a selinux policies for all tendrl related services | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/a selinux policies/selinux policies/ |
||
| Each tendrl proces can be assigned to an unique security context which, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/an/a/ |
||
| just like with the user under which the process runs, helps Linux in | ||
| identifying what the application should and shouldn't be allowed to do. | ||
|
|
||
| * Marking only the required type as permissive | ||
| In addition to have SELinux policies for tendrl, it would better to mark | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/would better/would be better/ |
||
| only the required type as permissive initially; instead of making the | ||
| entire system permissive, tendrl could make only the purticular domain as permissive. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/purticular/particular/ |
||
| Over the release iterations, testing various test cases, SELinux can be | ||
| compleatly enforced. Because it's inevitable to completely block any new | ||
| avc errors which might come on any new updates to tendrl. | ||
|
|
||
| === Alternatives | ||
|
|
||
| None | ||
|
|
||
| === Data model impact: | ||
|
|
||
| None | ||
|
|
||
| === Impacted Modules: | ||
|
|
||
| ==== Tendrl API impact: | ||
|
|
||
| SELinux policy files will be added in to this tendrl-api module. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/will be added in to this tendrl-api/will be added for tendrl-api/ |
||
| This set of policies will be used at tendrl server. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/This/These/
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you say tendrl-server, how integration services like
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope ceph and gluster have its own selinux policy we can use for the nodes. |
||
|
|
||
| Sample Policy: | ||
| policy_module(tendrl, 1.0.0) | ||
|
|
||
| ######################################## | ||
| # | ||
| # Declarations | ||
| # | ||
|
|
||
| type tendrl_t; | ||
| type tendrl_exec_t; | ||
| init_daemon_domain(tendrl_t, tendrl_exec_t) | ||
|
|
||
| type tendrl_conf_t; | ||
| files_config_file(tendrl_conf_t) | ||
|
|
||
| type tendrl_log_t; | ||
| logging_log_file(tendrl_log_t) | ||
|
|
||
| type tendrl_var_lib_t; | ||
| files_type(tendrl_var_lib_t) | ||
|
|
||
| type tendrl_var_run_t; | ||
| files_pid_file(tendrl_var_run_t) | ||
|
|
||
| type tendrl_unit_file_t; | ||
| systemd_unit_file(tendrl_unit_file_t) | ||
|
|
||
| type tendrl_custom_port_t; | ||
| corenet_port(tendrl_custom_port_t) | ||
|
|
||
| permissive tendrl_t; | ||
|
|
||
| ######################################## | ||
| # | ||
| # tendrl local policy | ||
| # | ||
| allow tendrl_t self:capability { sys_rawio sys_admin net_admin }; | ||
| allow tendrl_t self:fifo_file rw_fifo_file_perms; | ||
| allow tendrl_t self:unix_stream_socket create_stream_socket_perms; | ||
| allow tendrl_t self:tcp_socket { accept listen }; | ||
| - - - | ||
| optional_policy(` | ||
| unconfined_domain(tendrl_t) | ||
| ') | ||
|
|
||
| ==== Tendrl commons impact: | ||
|
|
||
| SELinux policy files will be added in to this tendrl-commons module. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/added to this tendrl-commons/added to tendrl-commons/ |
||
| This will be used for every nodes participating in the tendrl. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this include the storage nodes (gluster nodes) as well ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Initially we will be having a common policy for tendrl nodes and server. |
||
|
|
||
| Sample tendrl AVCs: | ||
| type=AVC msg=audit(1502404324.889:1973): avc: denied { connectto } for | ||
| pid=22078 comm="gluster" path="/run/glusterd.socket" | ||
| scontext=system_u:system_r:collectd_t:s0 | ||
| tcontext=system_u:system_r:glusterd_t:s0 tclass=unix_stream_socket | ||
|
|
||
| type=AVC msg=audit(1502404325.445:1975): avc: denied { read write } for | ||
| pid=22129 comm="lvm" name="lvm" dev="tmpfs" ino=12517 | ||
| scontext=system_u:system_r:collectd_t:s0 | ||
| tcontext=system_u:object_r:lvm_lock_t:s0 tclass=dir | ||
|
|
||
| type=AVC msg=audit(1502404325.447:1976): avc: denied { add_name } for | ||
| pid=22129 comm="lvm" name="V_cl_dhcp43-71:aux" | ||
| scontext=system_u:system_r:collectd_t:s0 | ||
| tcontext=system_u:object_r:lvm_lock_t:s0 tclass=dir | ||
|
|
||
| type=AVC msg=audit(1502404265.426:1967): avc: denied { read } for | ||
| pid=21307 comm="lvm" name="vda2" dev="devtmpfs" ino=8415 | ||
| scontext=system_u:system_r:collectd_t:s0 | ||
| tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file | ||
|
|
||
| The above AVC can be read as: | ||
| The Trace reporting time: Fri Aug 11 04:01:05 IST 2017, process with PID 21307 | ||
| tried to read a file called vda2 on a file system hosted on the devtmpfs device. | ||
| This file has inode number 8415, and has the security context | ||
| system_u:object_r:fixed_disk_device_t assigned to it. | ||
| The Trace process itself is running with the system_u:system_r:collectd_t context. | ||
|
|
||
| === Performance impact: | ||
|
|
||
| None | ||
|
|
||
| === Other deployer impact: | ||
|
|
||
| None | ||
|
|
||
| === Developer impact: | ||
|
|
||
| None | ||
|
|
||
| == Implementation: | ||
|
|
||
|
|
||
| === Assignee(s): | ||
|
|
||
| tjeyasing@redhat.com | ||
|
|
||
| If more than one person is working on the implementation, please designate the | ||
| primary author and contact. | ||
|
|
||
| Primary assignee: | ||
| tjeyasin | ||
|
|
||
| === Work Items: | ||
|
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the spec issue link here
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, i will create new issues and add.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| == Dependencies: | ||
|
|
||
| None | ||
|
|
||
| == Testing: | ||
|
|
||
| == Documentation impact: | ||
|
|
||
| The apis mentioned above need to be documented. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. apis??
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, typo error. |
||
|
|
||
| == References: | ||
|
|
||
| None | ||
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.
Check the grammar of sentence
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.
Also what is guideline for gluster nodes? do we suggest selinux enforcing?
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.
Sure, we suggest selinux enforcing for gluster nodes also.
I hope gluster have its own selinux policy.
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.
Gluster has its own selinux policy