Gentoo Archives: gentoo-commits

From: "Richard Farina (zerochaos)" <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-analyzer/metasploit: metasploit-4.9.3.ebuild ChangeLog metasploit-4.9.2-r2.ebuild
Date: Sat, 07 Jun 2014 21:32:04
Message-Id: 20140607213200.7B7E22004E@flycatcher.gentoo.org
1 zerochaos 14/06/07 21:32:00
2
3 Modified: ChangeLog
4 Added: metasploit-4.9.3.ebuild
5 Removed: metasploit-4.9.2-r2.ebuild
6 Log:
7 4.9.3 bump, include openssl fixes for recent vuln
8
9 (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key DD11F94A)
10
11 Revision Changes Path
12 1.95 net-analyzer/metasploit/ChangeLog
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/ChangeLog?rev=1.95&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/ChangeLog?rev=1.95&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/ChangeLog?r1=1.94&r2=1.95
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v
21 retrieving revision 1.94
22 retrieving revision 1.95
23 diff -u -r1.94 -r1.95
24 --- ChangeLog 30 May 2014 14:18:39 -0000 1.94
25 +++ ChangeLog 7 Jun 2014 21:32:00 -0000 1.95
26 @@ -1,6 +1,12 @@
27 # ChangeLog for net-analyzer/metasploit
28 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v 1.94 2014/05/30 14:18:39 zerochaos Exp $
30 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v 1.95 2014/06/07 21:32:00 zerochaos Exp $
31 +
32 +*metasploit-4.9.3 (07 Jun 2014)
33 +
34 + 07 Jun 2014; Rick Farina <zerochaos@g.o> +metasploit-4.9.3.ebuild,
35 + -metasploit-4.9.2-r2.ebuild:
36 + 4.9.3 bump, include openssl fixes for recent vuln
37
38 30 May 2014; Rick Farina <zerochaos@g.o> metasploit-9999.ebuild:
39 fix for bug 511690
40
41
42
43 1.1 net-analyzer/metasploit/metasploit-4.9.3.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-4.9.3.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-4.9.3.ebuild?rev=1.1&content-type=text/plain
47
48 Index: metasploit-4.9.3.ebuild
49 ===================================================================
50 # Copyright 1999-2014 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-4.9.3.ebuild,v 1.1 2014/06/07 21:32:00 zerochaos Exp $
53
54 EAPI="5"
55
56 if [[ ${PV} == "9999" ]] ; then
57 EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
58 EGIT_CHECKOUT_DIR="${WORKDIR}"/all
59 inherit git-r3
60 KEYWORDS=""
61 else
62 #https://github.com/rapid7/metasploit-framework/wiki/Downloads-by-Version
63 SRC_URI="http://downloads.metasploit.com/data/releases/archive/framework-${PV}.tar.bz2"
64 KEYWORDS="~amd64 ~arm ~x86"
65 S="${WORKDIR}"/msf3
66 fi
67
68 #ruby20 doesn't have wide enough support in gentoo yet (but is semi-supported upstream)
69 USE_RUBY="ruby19"
70 inherit eutils ruby-ng
71
72 DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code"
73 HOMEPAGE="http://www.metasploit.org/"
74 SLOT="4.9"
75 LICENSE="BSD"
76 IUSE="development +java lorcon oracle +pcap test"
77
78 #multiple known bugs with tests reported upstream and ignored
79 #http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible)
80 RESTRICT="test"
81
82 RUBY_COMMON_DEPEND="virtual/ruby-ssl
83 =dev-ruby/rkelly-remix-0.0.6
84 dev-ruby/bcrypt-ruby
85 dev-ruby/activesupport:3.2
86 dev-ruby/activerecord:3.2
87 dev-ruby/json
88 >=dev-ruby/metasploit_data_models-0.17.0
89 dev-ruby/msgpack
90 dev-ruby/nokogiri
91 dev-ruby/sqlite3
92 dev-ruby/builder:3
93 >=dev-ruby/pg-0.11
94 =dev-ruby/packetfu-1.1.9
95 dev-ruby/rb-readline
96 dev-ruby/robots
97 dev-ruby/kissfft
98 java? ( dev-ruby/rjb )
99 lorcon? ( net-wireless/lorcon[ruby] )
100 oracle? ( dev-ruby/ruby-oci8 )
101 pcap? ( dev-ruby/pcaprub
102 dev-ruby/network_interface )
103 dev-ruby/bundler
104 development? ( dev-ruby/fivemat
105 dev-ruby/redcarpet
106 dev-ruby/yard
107 >=dev-ruby/rake-10.0.0
108 >=dev-ruby/factory_girl-4.1.0 )"
109 ruby_add_bdepend "${RUBY_COMMON_DEPEND}
110 test? ( >=dev-ruby/factory_girl-4.1.0
111 dev-ruby/fivemat
112 dev-ruby/database_cleaner
113 >=dev-ruby/rspec-2.12
114 dev-ruby/shoulda-matchers
115 dev-ruby/timecop
116 >=dev-ruby/rake-10.0.0 )"
117 ruby_add_rdepend "${RUBY_COMMON_DEPEND}"
118
119 COMMON_DEPEND="dev-db/postgresql-server
120 >=app-crypt/johntheripper-1.7.9-r1[-minimal]
121 net-analyzer/nmap"
122 DEPEND+=" ${COMMON_DEPEND}"
123 RDEPEND+=" ${COMMON_DEPEND}
124 >=app-admin/eselect-metasploit-0.13"
125
126 RESTRICT="strip"
127
128 QA_PREBUILT="
129 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
130 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
131 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
132 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
133 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
134 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
135 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
136 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
137 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
138 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
139 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
140 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
141 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
142 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
143 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
144 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
145 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
146 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
147 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
148 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
149 usr/$(get_libdir)/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
150 "
151
152 pkg_setup() {
153 if use test; then
154 su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
155 su postgres -c "createuser msf_test_user -d -S -R"
156 if [ $? -ne 0 ]; then
157 su postgres -c "dropuser msf_test_user" || die
158 su postgres -c "createuser msf_test_user -d -S -R" || die
159 fi
160 su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
161 fi
162 ruby-ng_pkg_setup
163 }
164
165 all_ruby_unpack() {
166 if [[ ${PV} == "9999" ]] ; then
167 git-r3_src_unpack
168 else
169 default_src_unpack
170 mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
171 rm -r msf3
172 fi
173 }
174
175 all_ruby_prepare() {
176 # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
177 #epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
178 epatch_user
179
180 #unbundle johntheripper, at least it now defaults to running the system version
181 rm -r data/john/run.*
182 rm -r data/john/src.tar.bz2
183 #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
184 rm -r data/cpuinfo
185
186 #remove random oudated collected garbage
187 rm -r external
188
189 #remove unneeded ruby bundler versioning files
190 #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
191 #we regen this file in each_ruby_prepare
192 rm Gemfile.lock
193 #The Gemfile contains real known deps
194 #add our dep on upstream rb-readline instead of bundled one
195 sed -i "/gem 'packetfu'/a #use upstream readline instead of bundled\ngem 'rb-readline'" Gemfile || die
196 sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die
197 #remove the bundled readline
198 #https://github.com/rapid7/metasploit-framework/pull/3105
199 #this PR was closed due to numerous changes to their local fork, almost entirely for non-linux
200 rm lib/rbreadline.rb
201 #now we edit the Gemfile based on use flags
202 #even if we pass --without=blah bundler still calculates the deps and messes us up
203 if ! use pcap; then
204 sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
205 fi
206 if ! use development; then
207 sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
208 fi
209 if ! use test; then
210 sed -i -e "/^group :test/,/^end$/d" Gemfile || die
211 fi
212 if ! use test && ! use development; then
213 sed -i -e "/^group :development/,/^end$/d" Gemfile || die
214 fi
215 if use test; then
216 #We don't need simplecov
217 sed -i -e "s#gem 'simplecov', '0.5.4', :require => false##" Gemfile || die
218 sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
219 fi
220
221 #let's bogart msfupdate
222 rm msfupdate
223 echo "#!/bin/sh" > msfupdate
224 echo "echo \"[*]\"" >> msfupdate
225 echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate
226 echo "echo \"[*]\"" >> msfupdate
227 echo "echo \"\"" >> msfupdate
228 if [[ ${PV} == "9999" ]] ; then
229 echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
230 else
231 echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
232 echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
233 echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate
234 fi
235 #this is set executable in src_install
236
237 #install our database.yml file before tests are run
238 cp "${FILESDIR}"/database.yml config/
239
240 }
241
242 each_ruby_prepare() {
243 ${RUBY} -S bundle install --local || die
244 ${RUBY} -S bundle check || die
245
246 #force all metasploit executables to ruby19, ruby18 is not supported anymore and ruby20 is not supported yet
247 #https://dev.metasploit.com/redmine/issues/8357
248 for file in $(ls -1 msf*)
249 do
250 #poorly adapted from python.eclass
251 sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?ruby\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${RUBY}:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
252 done
253 }
254
255 each_ruby_test() {
256 #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox
257
258 #we bogart msfupdate so no point in trying to test it
259 rm spec/msfupdate_spec.rb || die
260 #we don't really want to be uploading to virustotal during the tests
261 rm spec/tools/virustotal_spec.rb || die
262
263 # https://dev.metasploit.com/redmine/issues/8425
264 ${RUBY} -S bundle exec rake db:create || die
265 ${RUBY} -S bundle exec rake db:migrate || die
266
267 MSF_DATABASE_CONFIG=config/database.yml ${RUBY} -S bundle exec rake || die
268 su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
269 }
270
271 each_ruby_install() {
272 #Tests have already been run, we don't need this stuff
273 rm -r spec || die
274 rm -r test || die
275 rm Gemfile.lock || die
276
277 #I'm 99% sure that this will only work for as long as we only support one ruby version. Creativity will be needed if we wish to support multiple.
278 # should be as simple as copying everything into the target...
279 dodir /usr/$(get_libdir)/${PN}${SLOT}
280 cp -R * "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
281 rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
282 fowners -R root:0 /
283
284 }
285
286 all_ruby_install() {
287 # do not remove LICENSE, bug #238137
288 dodir /usr/share/doc/${PF}
289 cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
290 dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
291
292 fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
293
294 #tell revdep-rebuild to ignore binaries meant for the target
295 dodir /etc/revdep-rebuild
296 cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
297 #These dirs contain prebuilt binaries for running on the TARGET not the HOST
298 SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter"
299 SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits"
300 EOF
301 }
302
303 pkg_postinst() {
304 elog "Before use you should run 'env-update' and '. /etc/profile'"
305 elog "otherwise you may be missing important environmental variables."
306
307 elog "You need to prepare the database by running:"
308 elog "emerge --config postgresql-server"
309 elog "/etc/init.d/postgresql-<version> start"
310 elog "emerge --config =metasploit-${PV}"
311
312 "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
313
314 einfo
315 elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
316 }
317
318 pkg_config() {
319 einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
320 su postgres -c "createuser msf_user -D -S -R"
321 su postgres -c "createdb --owner=msf_user msf_database"
322 }