Guest User

Untitled

a guest
Jul 19th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. $ vi config-top.h
  2. #define SYSLOG_HISTORY
  3. #if defined (SYSLOG_HISTORY)
  4. # define SYSLOG_FACILITY LOG_USER
  5. # define SYSLOG_LEVEL LOG_INFO
  6. #endif
  7.  
  8. ./configure
  9. make install
  10.  
  11. $ grep configure bash.spec
  12. %configure --with-bash-malloc=no --with-afs
  13. - Use the configure macro instead of calling ./configure directly
  14.  
  15. $ rpmdev-setuptree
  16. $ rpm -ivh bash-4.2.46-20.el7_2.src.rpm
  17.  
  18. $ cd rpmbuild/SOURCES
  19. $ tar zxf bash-4.2.tar.gz
  20. $ cp -prf bash-4.2 bash-4.2-orig
  21. $ cd bash-4.2
  22.  
  23. /* Define if you want each line saved to the history list in bashhist.c:
  24. bash_add_history() to be sent to syslog(). */
  25. #define SYSLOG_HISTORY
  26. #if defined (SYSLOG_HISTORY)
  27. # define SYSLOG_FACILITY LOG_LOCAL1
  28. # define SYSLOG_LEVEL LOG_DEBUG
  29. #endif
  30.  
  31. void
  32. bash_syslog_history (line)
  33. const char *line;
  34. {
  35. char trunc[SYSLOG_MAXLEN];
  36.  
  37. if (strlen(line) < SYSLOG_MAXLEN)
  38. syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d USER=%s CMD=%s", getpid(), current_user.uid, current_user.user_name, line);
  39. else
  40. {
  41. strncpy (trunc, line, SYSLOG_MAXLEN);
  42. trunc[SYSLOG_MAXLEN - 1] = '';
  43. syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d USER=%s CMD(TRUNCATED)=%s", getpid(), current_user.uid, current_user.user_name, trunc);
  44. }
  45. }
  46.  
  47. $ cd $HOME/rpmbuild/SOURCES
  48. $ diff -Npru bash-4.2-orig bash-4.2 > bash_history_rsyslog.patch
  49.  
  50. # history syslog
  51. Patch144: bash_history_rsyslog.patch
  52. ...
  53. ...
  54. %patch144 -p1 -b .history_rsyslog
  55.  
  56. $ cd $HOME/rpmbuild/SPEC
  57. $ rpmbuild -ba bash.spec
  58.  
  59. ...
  60. Processing files: bash-debuginfo-4.2.46-20.el7.centos.x86_64
  61. Provides: bash-debuginfo = 4.2.46-20.el7.centos bash-debuginfo(x86-64) = 4.2.46-20.el7.centos
  62. Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
  63. Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vagrant/rpmbuild/BUILDROOT/bash-4.2.46-20.el7.centos.x86_64
  64. Wrote: /home/vagrant/rpmbuild/RPMS/x86_64/bash-4.2.46-20.el7.centos.x86_64.rpm
  65. Wrote: /home/vagrant/rpmbuild/RPMS/x86_64/bash-doc-4.2.46-20.el7.centos.x86_64.rpm
  66. Wrote: /home/vagrant/rpmbuild/RPMS/x86_64/bash-debuginfo-4.2.46-20.el7.centos.x86_64.rpm
  67. Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.nGworU
  68. + umask 022
  69. + cd /home/vagrant/rpmbuild/BUILD
  70. + cd bash-4.2
  71. + rm -rf /home/vagrant/rpmbuild/BUILDROOT/bash-4.2.46-20.el7.centos.x86_64
  72. + exit 0
  73.  
  74. $ sudo rpm -ivh --force $HOME/rpmbuild/RPMS/x86_64/bash-4.2.46-20.el7.centos.x86_64.rpm
  75. Preparing... ################################# [100%]
  76. Updating / installing...
  77. 1:bash-4.2.46-20.el7.centos ################################# [100%]
  78.  
  79. $ sudo systemctl restart rsyslog
  80.  
  81. $ sudo systemctl restart rsyslog
  82.  
  83. $ sudo -Es
  84. $ ls
  85.  
  86. $ tail /var/log/bash-log/127.0.0.1.log
  87. 2018-07-19T23:23:37.568131-04:00 centos7 bash: HISTORY: PID=12511 UID=1000 USER=vagrant CMD=sudo -Es
  88. 2018-07-19T23:23:37.573825-04:00 centos7 sudo: vagrant : TTY=pts/0 ; PWD=/home/vagrant/rpmbuild/SOURCES ; USER=root ; COMMAND=/bin/bash
  89. 2018-07-19T23:23:37.589258-04:00 centos7 systemd-logind: Got message type=signal sender=org.freedesktop.DBus destination=n/a object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameOwnerChanged cookie=4454 reply_cookie=0 error=n/a
  90. 2018-07-19T23:23:37.590633-04:00 centos7 dbus[588]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
  91. 2018-07-19T23:23:37.590806-04:00 centos7 dbus-daemon: dbus[588]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
  92. 2018-07-19T23:23:37.592160-04:00 centos7 dbus[588]: [system] Activated service 'org.freedesktop.problems' failed: Failed to execute program /lib64/dbus-1/dbus-daemon-launch-helper: Success
  93. 2018-07-19T23:23:37.592311-04:00 centos7 dbus-daemon: dbus[588]: [system] Activated service 'org.freedesktop.problems' failed: Failed to execute program /lib64/dbus-1/dbus-daemon-launch-helper: Success
  94. 2018-07-19T23:23:37.602174-04:00 centos7 systemd-logind: Got message type=signal sender=org.freedesktop.DBus destination=n/a object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameOwnerChanged cookie=4455 reply_cookie=0 error=n/a
  95. 2018-07-19T23:23:38.520300-04:00 centos7 bash: HISTORY: PID=12585 UID=0 USER=root CMD=ls
  96. 2018-07-19T23:23:49.210406-04:00 centos7 bash: HISTORY: PID=12585 UID=0 USER=root CMD=tail /var/log/bash-log/127.0.0.1.log
Add Comment
Please, Sign In to add comment