diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-05-04 05:28:44 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-05-04 05:28:44 +0000 |
commit | 1b2ae993bf3b1531c0e26dbb25ad4d92cc04b5a0 (patch) | |
tree | 264951ea80798490512a6d26f9b245ea09a8d21f /app-shells | |
parent | add ~ia64 (diff) | |
download | gentoo-2-1b2ae993bf3b1531c0e26dbb25ad4d92cc04b5a0.tar.gz gentoo-2-1b2ae993bf3b1531c0e26dbb25ad4d92cc04b5a0.tar.bz2 gentoo-2-1b2ae993bf3b1531c0e26dbb25ad4d92cc04b5a0.zip |
Add support for logging in the shell #91327 by Kevin Landreth.
(Portage version: 2.0.51.21)
Diffstat (limited to 'app-shells')
-rw-r--r-- | app-shells/bash/ChangeLog | 6 | ||||
-rw-r--r-- | app-shells/bash/bash-3.0-r11.ebuild | 13 | ||||
-rw-r--r-- | app-shells/bash/files/bash-3.0-bash-logger.patch | 90 |
3 files changed, 106 insertions, 3 deletions
diff --git a/app-shells/bash/ChangeLog b/app-shells/bash/ChangeLog index c4b917392a66..95c8d8ce700f 100644 --- a/app-shells/bash/ChangeLog +++ b/app-shells/bash/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for app-shells/bash # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.63 2005/04/30 07:00:26 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.64 2005/05/04 05:28:44 vapier Exp $ + + 04 May 2005; Mike Frysinger <vapier@gentoo.org> + +files/bash-3.0-bash-logger.patch, bash-3.0-r11.ebuild: + Add support for logging in the shell #91327 by Kevin Landreth. 30 Apr 2005; Mike Frysinger <vapier@gentoo.org> +files/bash-3.0-trap-fg-signals.patch, bash-3.0-r11.ebuild: diff --git a/app-shells/bash/bash-3.0-r11.ebuild b/app-shells/bash/bash-3.0-r11.ebuild index 9f2fae21f7db..9559716a7dcd 100644 --- a/app-shells/bash/bash-3.0-r11.ebuild +++ b/app-shells/bash/bash-3.0-r11.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-3.0-r11.ebuild,v 1.5 2005/05/03 02:53:27 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-3.0-r11.ebuild,v 1.6 2005/05/04 05:28:44 vapier Exp $ inherit eutils flag-o-matic toolchain-funcs @@ -24,7 +24,7 @@ SRC_URI="mirror://gnu/bash/${P}.tar.gz LICENSE="GPL-2" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" -IUSE="nls build" +IUSE="nls build bashlogger" # we link statically with ncurses DEPEND=">=sys-libs/ncurses-5.2-r2" @@ -57,6 +57,15 @@ src_unpack() { epatch "${FILESDIR}"/${P}-read-builtin-pipe.patch # Don't barf on handled signals in scripts epatch "${FILESDIR}"/${P}-trap-fg-signals.patch + # Log bash commands to syslog #91327 + if use bashlogger ; then + echo + ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs." + ewarn "This will log ALL output you enter into the shell, you have been warned." + ebeep + epause + epatch "${FILESDIR}"/${P}-bash-logger.patch + fi # Enable SSH_SOURCE_BASHRC (#24762) echo '#define SSH_SOURCE_BASHRC' >> config-top.h diff --git a/app-shells/bash/files/bash-3.0-bash-logger.patch b/app-shells/bash/files/bash-3.0-bash-logger.patch new file mode 100644 index 000000000000..faa825191699 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-bash-logger.patch @@ -0,0 +1,90 @@ +Add support for logging bash commands via syslog(). +Useful for deploying in honeypot environments. + +http://bugs.gentoo.org/show_bug.cgi?id=91327 +http://www.nardware.co.uk/Security/html/bashlogger.htm + +--- bashhist.c ++++ bashhist.c +@@ -698,7 +698,7 @@ + char *line; + { + hist_last_line_added = 1; +- add_history (line); ++ add_history (line, 1); + history_lines_this_session++; + } + +--- lib/readline/histexpand.c ++++ lib/readline/histexpand.c +@@ -1220,9 +1220,7 @@ + + if (only_printing) + { +-#if 0 +- add_history (result); +-#endif ++ add_history (result, 1); + return (2); + } + +--- lib/readline/histfile.c ++++ lib/readline/histfile.c +@@ -262,7 +262,7 @@ + { + if (HIST_TIMESTAMP_START(line_start) == 0) + { +- add_history (line_start); ++ add_history (line_start,0); + if (last_ts) + { + add_history_time (last_ts); +--- lib/readline/history.c ++++ lib/readline/history.c +@@ -31,6 +31,8 @@ + + #include <stdio.h> + ++#include <syslog.h> ++ + #if defined (HAVE_STDLIB_H) + # include <stdlib.h> + #else +@@ -246,10 +250,24 @@ + /* Place STRING at the end of the history list. The data field + is set to NULL. */ + void +-add_history (string) +- const char *string; ++add_history (string, logme) ++ const char *string; ++ int logme; /* 0 means no sending history to syslog */ + { + HIST_ENTRY *temp; ++ if (logme) { ++ if (strlen(string)<600) { ++ syslog(LOG_LOCAL5 | LOG_INFO, "HISTORY: PID=%d UID=%d %s", ++ getpid(), getuid(), string); ++ } ++ else { ++ char trunc[600]; ++ strncpy(trunc,string,sizeof(trunc)); ++ trunc[sizeof(trunc)-1]='\0'; ++ syslog(LOG_LOCAL5, LOG_INFO, "HISTORY: PID=%d UID=%d %s(++TRUNC)", ++ getpid(), getuid(), trunc); ++ } ++ } + + if (history_stifled && (history_length == history_max_entries)) + { +--- lib/readline/history.h ++++ lib/readline/history.h +@@ -80,7 +80,7 @@ + + /* Place STRING at the end of the history list. + The associated data field (if any) is set to NULL. */ +-extern void add_history PARAMS((const char *)); ++extern void add_history PARAMS((const char *, int )); + + /* Change the timestamp associated with the most recent history entry to + STRING. */ |