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

added SELinux example to unix time step #222

Merged
merged 5 commits into from
Aug 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions unixisms/step5.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ Time is a fundamental part of productivity, but frameworks must be established
to ensure that humans and computers can be on the same page about time.
On Linux, one of these frameworks is the __unix epoch__. This is a standardized
date and time that is defined as the beginning of time for unix systems.
From this, an _epoch time_ (or _unix time_) is defined as the number of seconds
that have elapsed since the __unix epoch__.

The __unix epoch__ is defined as
From this, an _epoch time_ (or _unix time_) is the number of seconds
that have elapsed since the __unix epoch__. The __unix epoch__ is defined as
Midnight UTC on January 1, 1970.

Unix time is exceptionally well-documented online, and if you wish to learn more
the [Wikipedia page](https://en.wikipedia.org/wiki/Unix_time) on the subject is a great place to start.
Expand Down Expand Up @@ -58,3 +57,25 @@ Notice that this specifies the date in the timezone for this lab system,
Eastern Time.

For more information on using `date`, check out the [date man page](https://man7.org/linux/man-pages/man1/date.1.html).

An example of how you might run into unix time is available in this [SELinux troubleshooting article](https://www.redhat.com/sysadmin/selinux-denial2).
The following example error is given:

<pre class=file>
type=AVC msg=audit(1600796109.687:168): avc: denied { read } for pid=3912 comm="rhsmcertd-worker" name="virt.module" dev="dm-0" ino=50331783 scontext=system_u:system_r:rhsmcertd_t:s0 tcontext=system_u:object_r:root_t:s0 tclass=file permissive=0
</pre>

For this lab, we care about the second field in this error. You may recognize
that ten digit number as a unix timestamp. To confirm, convert it to a standard
date:

`date --date @1600796109`{{execute T1}}

<pre class=file>
Tue Sep 22 13:35:09 EDT 2020
</pre>

The article that this error was taken from was published on November 16, 2020,
which supports the fact that this was a unix timestamp generated during the
process of writing the article. However, someone who is not familiar with the
unix time format may never consider that this number relates to time at all.