Blame SPECS/tlog.spec

e027a8
%global _hardened_build 1
e027a8
e027a8
%if 0%{?rhel} && 0%{?rhel} < 7
e027a8
# If it's RHEL6 and older
e027a8
%bcond_with systemd
e027a8
%else
e027a8
%bcond_without systemd
e027a8
%endif
e027a8
e027a8
%if "%{_vendor}" == "debbuild"
e027a8
# Set values to make debian builds work well
e027a8
%global _defaultdocdir /usr/share/doc/%{name}
e027a8
%global _buildshell /bin/bash
e027a8
%global _lib lib/%(%{__dpkg_architecture} -qDEB_HOST_MULTIARCH)
e027a8
%endif
e027a8
e027a8
# Compatibility macros
e027a8
%{!?_tmpfilesdir:%global _tmpfilesdir %{_prefix}/lib/tmpfiles.d}
e027a8
%{!?make_build:%global make_build %{__make} %{?_smp_mflags}}
e027a8
e027a8
Name:           tlog
e027a8
Version:        11
e027a8
Release:        5%{?dist}
e027a8
Summary:        Terminal I/O logger
e027a8
e027a8
%if "%{_vendor}" == "debbuild"
e027a8
# Required for Debian
e027a8
Packager:       Justin Stephenson <jstephen@redhat.com>
e027a8
Group:          admin
e027a8
License:        GPL-2.0+
e027a8
%else
e027a8
Group:          Applications/System
e027a8
License:        GPLv2+
e027a8
%endif
e027a8
e027a8
URL:            https://github.com/Scribery/%{name}
e027a8
Source:         %{url}/releases/download/v%{version}/%{name}-%{version}.tar.gz
e027a8
e027a8
BuildRequires:  autoconf
e027a8
BuildRequires:  automake
e027a8
BuildRequires:  libtool
e027a8
BuildRequires:  m4
e027a8
BuildRequires:  gcc
e027a8
BuildRequires:  make
e027a8
e027a8
%if "%{_vendor}" == "debbuild"
e027a8
BuildRequires:  libjson-c-dev
e027a8
BuildRequires:  libcurl4-gnutls-dev
e027a8
BuildRequires:  libutempter-dev
e027a8
# Debian/Ubuntu doesn't automatically pull this in...
e027a8
BuildRequires:  pkg-config
e027a8
e027a8
%if %{with systemd}
e027a8
BuildRequires:  libsystemd-dev
e027a8
# Expanded form of systemd_requires macro
e027a8
Requires:         systemd-sysv
e027a8
Requires(preun):  systemd
e027a8
Requires(post):   systemd
e027a8
Requires(postun): systemd
e027a8
%endif
e027a8
e027a8
%else
e027a8
BuildRequires:  pkgconfig(json-c)
e027a8
BuildRequires:  pkgconfig(libcurl)
e027a8
%if %{defined suse_version}
e027a8
BuildRequires:  utempter-devel
e027a8
%else
e027a8
BuildRequires:  libutempter-devel
e027a8
%endif
e027a8
e027a8
%if %{with systemd}
e027a8
BuildRequires:  pkgconfig(libsystemd)
e027a8
%{?systemd_requires}
e027a8
%endif
e027a8
%endif
e027a8
e027a8
%description
e027a8
Tlog is a terminal I/O recording program similar to "script", but used in
e027a8
place of a user's shell, starting the recording and executing the real user's
e027a8
shell afterwards. The recorded I/O can then be forwarded to a logging server
e027a8
in JSON format.
e027a8
e027a8
%prep
e027a8
%setup -q
e027a8
e027a8
%build
e027a8
%configure --disable-rpath --disable-static --enable-utempter %{!?with_systemd:--disable-journal} --docdir=%{_defaultdocdir}/%{name}
e027a8
%make_build
e027a8
e027a8
%check
e027a8
%make_build check
e027a8
e027a8
%install
e027a8
%make_install
e027a8
rm %{buildroot}/%{_libdir}/*.la
e027a8
e027a8
# Remove development files as we're not doing a devel package yet
e027a8
rm %{buildroot}/%{_libdir}/*.so
e027a8
rm -r %{buildroot}/usr/include/%{name}
e027a8
e027a8
%if %{with systemd}
e027a8
    # Create tmpfiles.d configuration for the lock dir
e027a8
    mkdir -p %{buildroot}%{_tmpfilesdir}
e027a8
    {
e027a8
        echo "# Type Path Mode UID GID Age Argument"
e027a8
        echo "d /run/%{name} 0755 %{name} %{name}"
e027a8
    } > %{buildroot}%{_tmpfilesdir}/%{name}.conf
e027a8
# Else, if it's RHEL6 or older
e027a8
%else
e027a8
    # Create the lock dir
e027a8
    mkdir -p %{buildroot}%{_localstatedir}/run
e027a8
    install -d -m 0755 %{buildroot}%{_localstatedir}/run/%{name}
e027a8
%endif
e027a8
e027a8
%files
e027a8
%{!?_licensedir:%global license %doc}
e027a8
%license COPYING
e027a8
%doc %{_defaultdocdir}/%{name}
e027a8
%{_bindir}/%{name}-rec
e027a8
%attr(6755,%{name},%{name}) %{_bindir}/%{name}-rec-session
e027a8
%{_bindir}/%{name}-play
e027a8
%{_libdir}/lib%{name}.so*
e027a8
%{_datadir}/%{name}
e027a8
%{_mandir}/man5/*
e027a8
%{_mandir}/man8/*
e027a8
%if %{with systemd}
e027a8
%{_tmpfilesdir}/%{name}.conf
e027a8
%else
e027a8
# If it's RHEL6 and older
e027a8
%dir %attr(-,%{name},%{name}) %{_localstatedir}/run/%{name}
e027a8
%endif
e027a8
%dir %{_sysconfdir}/%{name}
e027a8
%config(noreplace) %{_sysconfdir}/%{name}/%{name}-rec.conf
e027a8
%config(noreplace) %{_sysconfdir}/%{name}/%{name}-rec-session.conf
e027a8
%config(noreplace) %{_sysconfdir}/%{name}/%{name}-play.conf
e027a8
e027a8
%pre
e027a8
getent group %{name} >/dev/null ||
e027a8
    groupadd -r %{name}
e027a8
getent passwd %{name} >/dev/null ||
e027a8
    useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \
e027a8
            -c "Tlog terminal I/O logger" %{name}
e027a8
e027a8
%post
e027a8
/sbin/ldconfig
e027a8
%if 0%{?el7} || 0%{?suse_version} >= 1315
e027a8
# For RHEL7 and SUSE Linux distributions, creation doesn't happen automatically
e027a8
%tmpfiles_create %{name}.conf
e027a8
%endif
e027a8
%if 0%{?ubuntu} || 0%{?debian}
e027a8
# For Debian/Ubuntu, creation doesn't happen automatically
e027a8
systemd-tmpfiles --create %{name}.conf >/dev/null 2>&1 || :
e027a8
%endif
e027a8
e027a8
%postun
e027a8
/sbin/ldconfig
e027a8
e027a8
%changelog
e027a8
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 11-5
e027a8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
e027a8
  Related: rhbz#1991688
e027a8
e027a8
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com>
e027a8
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
e027a8
e027a8
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 11-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
e027a8
e027a8
* Tue Jan 19 2021 Justin Stephenson <jstephen@redhat.com> - 11-1
e027a8
- Release v11
e027a8
- Fire SIGCHLD after utempter_add_record since it probably eats it.
e027a8
e027a8
* Tue Jan 8 2021 Justin Stephenson <jstephen@redhat.com> - 10-1
e027a8
- Release v10
e027a8
- Correct suse rpmbuild
e027a8
- Update debbuild for travis CI
e027a8
e027a8
* Tue Oct 13 2020 Justin Stephenson <jstephen@redhat.com> - 9-1
e027a8
- Release v9
e027a8
- Add libutempter support
e027a8
- Require journal match filter
e027a8
- Add file reader match functionality
e027a8
- Restore cursor visibility and color attributes on tlog-play exit
e027a8
- Add "time" real clock timestamp message field
e027a8
- Various upstream CI improvements
e027a8
e027a8
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 8-3
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
e027a8
e027a8
* Fri May 22 2020 Justin Stephenson <jstephen@redhat.com> - 8-2
e027a8
- Minor test fixups
e027a8
e027a8
* Tue May 19 2020 Justin Stephenson <jstephen@redhat.com> - 8-1
e027a8
- Release v8
e027a8
- Spec file fixes for EL6
e027a8
- Spec file improvements for Debian/Ubuntu pkg-config
e027a8
- Tlog-play improve authentication options
e027a8
- Handle piped in I/O from stdin and improve the main recording
e027a8
  transfer exit condition.
e027a8
- Use empty string on hostname resolution failure
e027a8
e027a8
* Tue Apr 21 2020 Björn Esser <besser82@fedoraproject.org> - 7-3
e027a8
- Rebuild (json-c)
e027a8
e027a8
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
e027a8
e027a8
* Tue Nov 12 2019 Justin Stephenson <jstephen@redhat.com> - 7-1
e027a8
- Release v7
e027a8
- Allow tlog-play redirection of stdout
e027a8
- Add -i/--interactive option to tlog-rec-session. Allows login
e027a8
  programs to call tlog-rec-session more transparently.
e027a8
- Make in_txt/out_txt fields optional. This handles missing fields
e027a8
  when reading from Elasticsearch or other backends.
e027a8
e027a8
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
e027a8
e027a8
* Tue May 28 2019 Justin Stephenson <jstephen@redhat.com> - 6-1
e027a8
- Release v6. Added features and implemented fixes follow. See README.md and
e027a8
  manpages for documentation of new features.
e027a8
- Add integration tests for end-to-end test coverage.
e027a8
- Fix compiler type comparison error with json-c json_object_array_length
e027a8
  return value.
e027a8
- Fix a distribution issue causing incorrect M4_CONF_PATH expansion.
e027a8
- Log more detailed error when systemd journal is not present.
e027a8
e027a8
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
e027a8
e027a8
* Wed Dec 5 2018 Kirill Glebov <kgliebov@redhat.com> - 5-1
e027a8
- Release v5. Added features and implemented fixes follow. See README.md and
e027a8
  manpages for documentation of new features.
e027a8
- Implement support for --configuration option for all programs.
e027a8
  The option makes the program output its configuration in JSON and then
e027a8
  exit.
e027a8
- Add BuildDependencies to allow yum-builddep.
e027a8
- Open JSON writer file with euid/egid. To allow creating protected log files
e027a8
  with tlog-rec-session, open the JSON writer's file with the EUID and
e027a8
  GUID the program was started with.
e027a8
- Installing Packages with the APT Addon instead of apt-get.
e027a8
- Switch to using TLOG_ERRS_RAISE macros.
e027a8
- Fix tlog-play cleanup-path segfault.
e027a8
- Modify command-line option parsing.
e027a8
- Remove "fields" field from ES query URL to fix compatibility with
e027a8
  Elasticsearch 5.
e027a8
- Remove unused _source parameter from ES query URL.
e027a8
- Fix tlog-rec-session file permissions bug.
e027a8
- Use CLOCK_MONOTONIC for rate-limiting writing.
e027a8
- Filter out some more input control sequences.
e027a8
e027a8
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4-4
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
e027a8
e027a8
* Tue Mar 06 2018 Björn Esser <besser82@fedoraproject.org> - 4-3
e027a8
- Rebuilt for libjson-c.so.4 (json-c v0.13.1)
e027a8
e027a8
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
e027a8
e027a8
* Wed Jan 24 2018 Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> - 4-1
e027a8
- Release v4. Added features and implemented fixes follow. See README.md and
e027a8
  manpages for documentation of new features.
e027a8
- Extract user session recording functionality from tlog-rec into a new tool:
e027a8
  tlog-rec-session. It should be used as the user's login shell now, and
e027a8
  tlog-rec should be used as a general recording and testing tool.
e027a8
- Add (optional) support for writing to and reading from Systemd Journal - the
e027a8
  "journal" reader and writer.
e027a8
- Make tlog-rec default to "file" writer, and tlog-rec-session to "journal",
e027a8
  if built with Journal support, and to "syslog" otherwise.
e027a8
- Add "-o" option to tlog-rec as an alias to "--file-path".
e027a8
- Add "-i" option to tlog-play as an alias to "--file-path".
e027a8
- Assume locale charset is UTF-8, if ASCII charset is detected, since that is
e027a8
  a likely indication the locale settings were lost. E.g. upon console login
e027a8
  or "su -" on Fedora and RHEL.
e027a8
- Switch the "ver" JSON field type to string. Now it should be two numbers
e027a8
  separated by a dot. The increase of the first number indicates
e027a8
  forward-incompatible changes, the increase of the second number -
e027a8
  forward-compatible. If the dot and the second number are omitted, the second
e027a8
  number is considered to be zero. Bump the format version to "2".
e027a8
- Add a new JSON field: "rec", containing an opaque host-unique recording ID.
e027a8
  Bump the format version to "2.1".
e027a8
- Add support for playback controls, both through the command line and via
e027a8
  playback-time control keys, including: speed adjustment, pause/resume,
e027a8
  fast-forward to a time, and packet-by-packet stepping through the recording.
e027a8
- Add optional rate-limiting of logged messages. Both throttling and dropping
e027a8
  messages are supported.
e027a8
- Add "--lax" option to tlog-play to allow playing back recordings with
e027a8
  missing messages.
e027a8
- Fix input being ignored when there is a lot of output, while recording.
e027a8
- Remove addition of tlog-rec (tlog-rec-session) to /etc/shells from RPM
e027a8
  packaging to prevent users from changing their shells themselves once it has
e027a8
  been assigned.
e027a8
- Add support for specifying the shell to start via the tlog-rec-session
e027a8
  executable name. E.g. by making a tlog-rec-session-shell-zsh ->
e027a8
  tlog-rec-session symlink and executing it. That can be used to specify
e027a8
  particular shells to be recorded for specific users by assigning these
e027a8
  symlinks as their login shells.
e027a8
- Make error messages from all the tools a bit less noisy and more readable.
e027a8
e027a8
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 3-4
e027a8
- Rebuilt for libjson-c.so.3
e027a8
e027a8
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3-3
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
e027a8
e027a8
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
e027a8
e027a8
* Wed Feb 22 2017 Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> - 3-1
e027a8
- Release v3. Added features and implemented fixes follow.
e027a8
- Make each JSON message timing data start with window size.
e027a8
  This makes it possible to pick up the stream from any message and also
e027a8
  combine messages, with window size known and preserved at all times.
e027a8
- Add "term" field to JSON messages, specifying terminal type.
e027a8
- Add "ver" field to JSON messages, specifying message format version.
e027a8
- Set "SHELL" environment variable to actual user shell in tlog-rec.
e027a8
- Check for locale's charset and abort tlog-rec if it's anything but the only
e027a8
  supported UTF-8.
e027a8
- Add -v/--version option support to tlog-rec and tlog-play.
e027a8
- Fix tlog-rec and tlog-play error output by accumulating error messages and
e027a8
  outputting them only after terminal settings are restored, on exit. Output
e027a8
  startup warnings before switching to raw terminal settings.
e027a8
- Output a newline after restoring terminal settings in tlog-rec and
e027a8
  tlog-play, so that following output is not stuck to the end of the last line
e027a8
  of the raw output.
e027a8
- Add an Elasticsearch mapping to documentation directory.
e027a8
- Disable input logging by default to avoid storing passwords. Please enable
e027a8
  it explicitly in configuration, or on the command line, if necessary.
e027a8
- Close log file written by tlog-rec on executing the shell in the child to
e027a8
  prevent log modification by the recorded user.
e027a8
- Support running tlog-rec SUID/SGID to prevent recorded users from killing or
e027a8
  modifying it. Make tlog-rec SUID/SGID to user "tlog" in the RPM package.
e027a8
- Add session locking to tlog-rec. This prevents tlog-rec from recording if
e027a8
  the audit session is already recorded by creating per-audit-session lock
e027a8
  files in /var/run/tlog. This only makes sense with tlog-rec SUID/SGID.
e027a8
  When certain failures occur while creating a lock file, session is assumed
e027a8
  unlocked and is recorded anyway, as it is safer to record a session than
e027a8
  not. Add corresponding setup to the RPM package.
e027a8
- Reproduce the recorded program (shell) exit status in tlog-rec similarly to
e027a8
  how Bash reproduces the last executed command status.
e027a8
- Update and expand README.md to describe secure log message filtering with
e027a8
  rsyslog, and playback directly from Elasticsearch, among other, smaller
e027a8
  additions.
e027a8
e027a8
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2-2
e027a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
e027a8
e027a8
* Wed Apr 6 2016 Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> - 2-1
e027a8
- Release v2. Not ready for production. Following features are added.
e027a8
- Fully-fledged command-line interface to tlog-play, along with config file
e027a8
  and man pages.
e027a8
- Support for playback from file in tlog-play.
e027a8
- Make tlog-play follow mode controllable and off by default.
e027a8
- Get tlog-rec shell also from TLOG_REC_SHELL environment variable.
e027a8
- Support non-TTY stdin/stdout in tlog-rec, allowing its use with
e027a8
  non-interactive SSH sessions.
e027a8
- Support building on and packaging for EPEL5.
e027a8
e027a8
* Thu Feb 25 2016 Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> - 1-1
e027a8
- Release v1. Not ready for production. Following features are included.
e027a8
- Recording of user input, program output and window size changes.
e027a8
- Support for writing into syslog and files.
e027a8
- Tlog-rec configuration through system-wide configuration file
e027a8
  /etc/tlog/tlog-rec.conf, environment variables and command line.
e027a8
- Very basic playback directly from ElasticSearch.