/usr/sbin/openvpn-vulnkey is in openvpn-blacklist 0.5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #!/usr/bin/python
#
# openvpn-vulnkey: check a database of md5'd static key hashes for
# known vulnerable keys
# Copyright (C) 2008 Canonical Ltd.
# Author: Jamie Strandboge <jamie@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from optparse import OptionParser
import hashlib
import re
import sys
version = "0.2"
parser = OptionParser(usage="%prog FILE [FILE]", \
version="%prog: " + version, \
description="This program checks if FILEs are known " + \
"vulnerable static keys")
parser.add_option("-q", "--quiet", action="store_true", dest="quiet", \
help="be quiet")
parser.add_option("--db", action="store", help="path to blacklist database", \
default="/usr/share/openvpn-blacklist/blacklist.RSA-2048")
(options, args) = parser.parse_args()
if not args:
parser.print_help()
sys.exit(1)
# Read in the database
try:
fh = open(options.db, 'r')
except:
print >> sys.stderr, "ERROR: could not open database"
sys.exit(1)
db_lines = fh.read().split('\n')
fh.close()
# Check each file
found = False
for f in args:
try:
fh = open(f, 'r')
except:
if not options.quiet:
print >> sys.stderr, "'%s' could not be opened (skipping)" % (f)
continue
keyfile = ""
for line in fh:
# Only get the actual key, not the comment text
if re.match(r'^[0-9a-f]', line):
keyfile += line
fh.close()
key = hashlib.md5(keyfile).hexdigest()
if key[12:] in db_lines:
if not options.quiet:
print "COMPROMISED: %s %s" % (key, f)
found = True
else:
if not options.quiet:
print "Not blacklisted: %s %s" % (key, f)
if found:
sys.exit(1)
|