Skip to content

Commit 0323c54

Browse files
Improve formatting+explanations in linux-capability
Improve the readability of deployment/linux-capability. - Briefly explain what Linux capabilities are - Improve grammar - Use inline code blocks where appropriate Signed-off-by: Brad Solomon <81818815+brsolomon-deloitte@users.noreply.github.com>
1 parent 4f23c5b commit 0323c54

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

deployment/linux-capability.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
# Linux Capability
1+
# Using Linux Capabilities
22

3-
This article shows configuration and dependent gem installation instruction for enabling Linux capability module on Fluentd core.
3+
This article shows configuration and dependent gem installation instructions for enabling [Linux capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) on Fluentd core.
4+
5+
Linux capabilities grant privileges to processes and executables that are otherwise reserved for the root user (UID 0). You can use these in conjunction with Fluentd plugins to enable the underlying Ruby executable read access to input sources.
46

57
## Prerequisites
68

7-
* gcc and make etc. for building C extension sources
8-
* libcap-ng package and its development package
9-
* libcap-ng-dev on Debian GNU/Linux and Ubuntu
10-
* libcap-ng-devel on CentOS 7/8, Fedora 33, AmazonLinux 2
11-
* pkg-config package for linking libcap-ng library
9+
* `gcc` and `make` etc. for building C extension sources
10+
* `libcap-ng package` and its development package
11+
* `libcap-ng-dev` on Debian GNU/Linux and Ubuntu
12+
* `libcap-ng-devel` on CentOS 7/8, Fedora 33, AmazonLinux 2
13+
* `pkg-config package` for linking `libcap-ng` library
1214
* Ruby and its development packages
13-
* ruby-dev on Debian GNU/Linux and Ubuntu
14-
* ruby-devel on CentOS 7/8, Fedora 33, AmazonLinux 2
15+
* `ruby-dev` on Debian GNU/Linux and Ubuntu
16+
* `ruby-devel` on CentOS 7/8, Fedora 33, AmazonLinux 2
1517
* Fluentd v1.12 or later
1618

1719
## Install capability handling gem
1820

19-
Fluentd uses [`capng_c` gem](https://github.com/fluent-plugins-nursery/capng_c) to handle Linux capability.
21+
Fluentd uses the [`capng_c` gem](https://github.com/fluent-plugins-nursery/capng_c) to handle Linux capabilities.
2022

21-
So, Add this line to your Fluentd' or td-agent's Gemfile:
23+
Add this line to your Fluentd' or td-agent's Gemfile:
2224

2325
```ruby
2426
gem 'capng_c'
@@ -36,22 +38,22 @@ Or install it yourself as for Fluentd:
3638
$ fluent-gem install capng_c
3739
```
3840

39-
Or install it yourself as for td-agent:
41+
Or install it yourself as for `td-agent`:
4042

4143
```text
4244
$ td-agent-gem install capng_c
4345
```
4446

45-
**Note:** capng\_c uses `pkg-config` to link libcap-ng library. If you couldn't handle Linux capability with capng\_c installation, please confirm `pgk-config` package is installed on your box.
47+
**Note:** `capng_c` uses `pkg-config` to link the `libcap-ng` library. If you couldn't handle Linux capability with `capng_c` installation, please confirm `pgk-config` package is installed on your box.
4648

47-
## Capability handling on in\_tail
49+
## Capability handling on `in_tail`
4850

49-
Currently, `in_tail` which is the one of the Fluentd core plugin handles the following Linux capabilities:
51+
The Fluentd core plugin `in_tail` handles the following Linux capabilities:
5052

51-
* `CAP_DAC_READ_SEARCH` \(`:dac_read_search` on `in_tail` code.\)
52-
* `CAP_DAC_OVERRIDE` \(`:dac_override` on `in_tail` code.\)
53+
* `CAP_DAC_READ_SEARCH` \(`:dac_read_search` on `in_tail` code\)
54+
* `CAP_DAC_OVERRIDE` \(`:dac_override` on `in_tail` code\)
5355

54-
Set up `cap_dac_read_search` or `cap_dac_override` to using Ruby executable:
56+
Set up `cap_dac_read_search` or `cap_dac_override` to use the Ruby executable:
5557

5658
### Using CAP\_DAC\_READ\_SEARCH
5759

@@ -84,14 +86,14 @@ Permitted: dac_override, dac_read_search
8486

8587
### Actual Example for Linux capability handling in in\_tail
8688

87-
When adding `cap_dac_override` \(partial privileges for rw file\) and `cap_dac_read_search` \(partial privileges for read only\), Fluentd/td-agent can handle to read 640 permission files such as `/var/log/syslog`:
89+
When adding `cap_dac_override` \(partial privileges for `rw` file\) and `cap_dac_read_search` \(partial privileges for read only\), Fluentd/td-agent can handle to read 640 permission files such as `/var/log/syslog`:
8890

8991
```text
9092
$ ls -lh /var/log/syslog
9193
-rw-r----- 1 syslog adm 29K Nov 5 14:35 /var/log/syslog
9294
```
9395

94-
This file cannot read form ordinal users:
96+
This file cannot be read by ordinary users:
9597

9698
```text
9799
$ cat /var/log/syslog
@@ -139,7 +141,7 @@ $ sudo mkdir /var/run/fluentd
139141
$ sudo chown `whoami` /var/run/fluentd
140142
```
141143

142-
Then, run as ordinal user with `cap_dac_read_search` capability attached Ruby:
144+
Then, run as an ordinary user with `cap_dac_read_search` capability attached Ruby:
143145

144146
```text
145147
$ bundle exec fluentd -c in_tail_camouflage_permission.conf
@@ -175,7 +177,7 @@ $ bundle exec fluentd -c in_tail_camouflage_permission.conf
175177
2020-11-05 09:55:01.000000000 +0900 test: {"host":"fluentd-testing","ident":"CRON","pid":"24610","message":"(root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)"}
176178
```
177179

178-
Fluentd which is running on ordinal user does not complain as `Permission denied`. Users can retrieve root files' contents on non-root process, yay!
180+
Fluentd, which is running by a non-root user, does not complain with `Permission denied`. Users can retrieve root files' contents on a non-root process, yay!
179181

180182
If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation \(CNCF\)](https://cncf.io/). All components are available under the Apache 2 License.
181183

0 commit comments

Comments
 (0)