Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/endlessh/, net-misc/endlessh/files/
Date: Wed, 01 May 2019 19:16:03
Message-Id: 1556738149.14af5665e3f1d17b90d89b9608fea394d0429cf5.gyakovlev@gentoo
1 commit: 14af5665e3f1d17b90d89b9608fea394d0429cf5
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 1 18:51:19 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Wed May 1 19:15:49 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14af5665
7
8 net-misc/endlessh: bump to 1.0
9
10 also bump openrc scripts with latest changes
11 remove tools useflag and python deps
12 fix logrotate to do copytruncate and don't send HUP
13 dump connection stats summary before rotating logs
14
15 Package-Manager: Portage-2.3.66, Repoman-2.3.12
16 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
17
18 net-misc/endlessh/Manifest | 1 +
19 net-misc/endlessh/endlessh-1.0.ebuild | 64 +++++++++++++++++++++++++++++++
20 net-misc/endlessh/files/endlessh.confd-r1 | 34 ++++++++++++++++
21 net-misc/endlessh/files/endlessh.initd-r1 | 29 ++++++++++++++
22 net-misc/endlessh/files/logrotated-r1 | 9 +++++
23 5 files changed, 137 insertions(+)
24
25 diff --git a/net-misc/endlessh/Manifest b/net-misc/endlessh/Manifest
26 index 997e300902a..a6980673bc4 100644
27 --- a/net-misc/endlessh/Manifest
28 +++ b/net-misc/endlessh/Manifest
29 @@ -1 +1,2 @@
30 DIST endlessh-0.1.tar.gz 8566 BLAKE2B e8fefd6ef80d26c25f57ffe1cef502af05322e348d63ca17c0bb626e35d5c1d35cb98384b35c86c579f2876573f4c13468605c3f44325a48d19e27c499657853 SHA512 0d11c82a708a26bd77ca85f7f3bd0eda2807ded9de88e3e518da09a38b3e94fc2658ea6f210e4f1493d38ca5948968c5488c8f2f09ff2adf22b799622b4952b8
31 +DIST endlessh-1.0.tar.gz 12258 BLAKE2B add6e24568cc94b244aa52bb484d1516210bfaa5a82440e090a89a94d50fbd4805ae004f917af56a7ad82a6502ae97c059d3f1c24b7c3e13ad1bd5a04bcf1c3e SHA512 a7e4e6ac5dc5e9b6e479ac3323b6a3ecec398ea074970de7794c93bd7a1a77c5662bdfa5752217fe552db1b3dbb9f400183114d7399c5a019637cb40756b46a8
32
33 diff --git a/net-misc/endlessh/endlessh-1.0.ebuild b/net-misc/endlessh/endlessh-1.0.ebuild
34 new file mode 100644
35 index 00000000000..e0a840877f3
36 --- /dev/null
37 +++ b/net-misc/endlessh/endlessh-1.0.ebuild
38 @@ -0,0 +1,64 @@
39 +# Copyright 2019 Gentoo Authors
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +EAPI=7
43 +
44 +inherit systemd toolchain-funcs
45 +
46 +DESCRIPTION="SSH tarpit that slowly sends and endless banner"
47 +HOMEPAGE="https://github.com/skeeto/endlessh"
48 +
49 +if [ ${PV} == "9999" ] ; then
50 + inherit git-r3
51 + EGIT_REPO_URI="https://github.com/skeeto/${PN}.git"
52 +else
53 + SRC_URI="https://github.com/skeeto/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
54 + KEYWORDS="~amd64 ~x86"
55 +fi
56 +
57 +LICENSE="Unlicense"
58 +SLOT="0"
59 +IUSE=""
60 +
61 +DEPEND=""
62 +RDEPEND=""
63 +BDEPEND=""
64 +
65 +src_prepare() {
66 + default
67 +
68 + tc-export CC
69 +
70 + sed -i \
71 + -e 's/^CC/CC?/' \
72 + -e 's/^CFLAGS =/CFLAGS +=/' \
73 + -e 's/ -Os//' \
74 + -e 's/^LDFLAGS/LDFLAGS?/' \
75 + -e 's/^PREFIX/PREFIX?/' \
76 + Makefile || die
77 +
78 + sed -i -e "/^ExecStart=/ s:=/opt/endlessh:=${EPREFIX}/usr/bin:" \
79 + util/endlessh.service || die
80 +}
81 +
82 +src_install() {
83 + emake DESTDIR="${D}" PREFIX=/usr install
84 +
85 + einstalldocs
86 +
87 + newinitd "${FILESDIR}"/endlessh.initd-r1 endlessh
88 + newconfd "${FILESDIR}"/endlessh.confd-r1 endlessh
89 +
90 + systemd_dounit util/endlessh.service
91 +
92 + insinto /etc/logrotate.d
93 + newins "${FILESDIR}/logrotated-r1" endlessh
94 +
95 + insinto /usr/share/"${PN}"
96 + doins util/{pivot.py,schema.sql}
97 +}
98 +
99 +pkg_postinst() {
100 + elog "Log parsing script installed to ${EPREFIX}/usr/share/${PN}"
101 + elog "Install dev-python/pyrfc3339 if you are going to use it"
102 +}
103
104 diff --git a/net-misc/endlessh/files/endlessh.confd-r1 b/net-misc/endlessh/files/endlessh.confd-r1
105 new file mode 100644
106 index 00000000000..13ba0ef55d2
107 --- /dev/null
108 +++ b/net-misc/endlessh/files/endlessh.confd-r1
109 @@ -0,0 +1,34 @@
110 +# /etc/conf.d/endlessh: config file for /etc/init.d/endlessh
111 +#
112 +#ENDLESSH_ARGS=""
113 +# Usage: [-vh] [-46] [-d MS] [-f CONFIG] [-l LEN] [-m LIMIT] [-p PORT]
114 +# -4 Bind to IPv4 only
115 +# -6 Bind to IPv6 only
116 +# -d INT Message millisecond delay [10000]
117 +# -f Set and load config file [/etc/endlessh/config]
118 +# -h Print this help message and exit
119 +# -l INT Maximum banner line length (3-255) [32]
120 +# -m INT Maximum number of clients [4096]
121 +# -p INT Listening port [2222]
122 +# -v Print diagnostics to standard output (repeatable)
123 +# -V Print version information and exit
124 +
125 +# EXAMPLE 1: listen on port 22, log all queries and errors in very verbose mode
126 +#ENDLESSH_ARGS="-p 22 -vv"
127 +
128 +# EXAMPLE 2: load settings from config file
129 +#ENDLESSH_ARGS="-f /etc/endlessh/config"
130 +
131 +# EXAMPLE 3: load settings from config file, but override port
132 +#ENDLESSH_ARGS="-f /etc/endlessh/config -p 22"
133 +
134 +
135 +# LOGGING: is disabled by default, enable this to actually redirect messages
136 +
137 +# plain file (preferred), change logrotate file as well if you change this.
138 +#output_log=/var/log/"${RC_SVCNAME}.log"
139 +#error_log=/var/log/"${RC_SVCNAME}.error.log"
140 +
141 +# syslog support via LOGGER(1). Note this spawns logger processes per io stream
142 +#output_logger="logger -p daemon.none --"
143 +#error_logger="logger -p daemon.err --"
144
145 diff --git a/net-misc/endlessh/files/endlessh.initd-r1 b/net-misc/endlessh/files/endlessh.initd-r1
146 new file mode 100755
147 index 00000000000..ea8d830af43
148 --- /dev/null
149 +++ b/net-misc/endlessh/files/endlessh.initd-r1
150 @@ -0,0 +1,29 @@
151 +#!/sbin/openrc-run
152 +# Copyright 2019 Gentoo Authors
153 +# Distributed under the terms of the GNU General Public License v2
154 +
155 +depend() {
156 + after bootmisc
157 + need localmount
158 + use clock logger net
159 +}
160 +
161 +description="Starts endlessh tarpit"
162 +
163 +command="/usr/bin/endlessh"
164 +command_args="${ENDLESSH_ARGS}"
165 +command_background="true"
166 +extra_started_commands="dumpstats reload"
167 +pidfile="/run/${RC_SVCNAME}.pid"
168 +
169 +dumpstats() {
170 + ebegin "Dumping connection stats of ${RC_SVCNAME} to log"
171 + start-stop-daemon --signal SIGUSR1 --pidfile "${pidfile}"
172 + eend $?
173 +}
174 +
175 +reload() {
176 + ebegin "Reloading ${RC_SVCNAME} configuration"
177 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
178 + eend $?
179 +}
180
181 diff --git a/net-misc/endlessh/files/logrotated-r1 b/net-misc/endlessh/files/logrotated-r1
182 new file mode 100644
183 index 00000000000..896e89e6474
184 --- /dev/null
185 +++ b/net-misc/endlessh/files/logrotated-r1
186 @@ -0,0 +1,9 @@
187 +/var/log/endlessh.log /var/log/endlessh.error.log {
188 + copytruncate
189 + missingok
190 + notifempty
191 + sharedscripts
192 + prerotate
193 + /etc/init.d/endlessh --ifstarted --quiet dumpstats
194 + endscript
195 +}