On 09/11/13 00:45, Giovanni Bechis wrote: > Major update to latest version, now it links with sqlite3 instead of sqlite2. > Comments ? Ok ? > Cheers > Giovanni > As spotted by ajacoutot@, security/yubiserve needs this patch to work, I do not have a yubikey to test it with, any testers ? Cheers Giovanni
Index: Makefile =================================================================== RCS file: /cvs/ports/security/yubiserve/Makefile,v retrieving revision 1.3 diff -u -p -u -p -r1.3 Makefile --- Makefile 7 Aug 2013 21:32:35 -0000 1.3 +++ Makefile 11 Sep 2013 08:44:28 -0000 @@ -2,7 +2,7 @@ COMMENT= standalone Yubikey and OATH/HOTP validation server DISTNAME= yubico-yubiserve-3.1 -REVISION= 0 +REVISION= 1 EXTRACT_SUFX= .zip UNZIP= unzip -a PKGNAME= ${DISTNAME:S/yubico-//} Index: patches/patch-dbconf_py =================================================================== RCS file: /cvs/ports/security/yubiserve/patches/patch-dbconf_py,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-dbconf_py --- patches/patch-dbconf_py 18 Jul 2012 08:25:07 -0000 1.1.1.1 +++ patches/patch-dbconf_py 11 Sep 2013 08:44:28 -0000 @@ -2,8 +2,8 @@ $OpenBSD: patch-dbconf_py,v 1.1.1.1 2012 sqlite3 support from http://code.google.com/p/yubico-yubiserve/source/list r39 ---- dbconf.py.orig Wed Jul 18 01:16:24 2012 -+++ dbconf.py Wed Jul 18 01:04:51 2012 +--- dbconf.py.orig Wed Sep 11 10:39:49 2013 ++++ dbconf.py Wed Sep 11 10:40:18 2013 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!${MODPY_BIN} @@ -28,7 +28,19 @@ sqlite3 support from http://code.google. keys = {} for line in config: match = re.search('(.*?)=(.*);', line) -@@ -54,14 +58,15 @@ if config['yubiDB'] == 'mysql' and (config['yubiMySQLH +@@ -47,6 +51,11 @@ try: + isThereSqlite = True + except NameError: + isThereSqlite = False ++try: ++ if sqlite3 != None: ++ isThereSqlite = True ++except NameError: ++ isThereSqlite = False + if isThereMysql == isThereSqlite == False: + print "Cannot continue without any database support.\nPlease read README.\n\n" + quit() +@@ -54,14 +63,15 @@ if config['yubiDB'] == 'mysql' and (config['yubiMySQLH print "Cannot continue without any MySQL configuration.\nPlease read README.\n\n" quit() try: @@ -47,7 +59,7 @@ sqlite3 support from http://code.google. if (len(argv)<2): print ' == YubiServe Key Management Tool 2.0 ==\n' print ' -ya <nickname> <publicid> <secretid> <aeskey>\tAdd a new Yubikey' -@@ -84,13 +89,15 @@ else: +@@ -84,13 +94,15 @@ else: if argv[1][0:2] == '-y': # Yubico Yubikey if (argv[1][2] == 'd') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -68,7 +80,7 @@ sqlite3 support from http://code.google. print "Key '" + nickname + "' disabled." con.commit() else: -@@ -98,12 +105,14 @@ else: +@@ -98,12 +110,14 @@ else: elif (argv[1][2] == 'e') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -87,7 +99,7 @@ sqlite3 support from http://code.google. cur.execute("UPDATE yubikeys SET active = '1' WHERE nickname = '" + nickname + "'") print "Key '" + nickname + "' enabled." con.commit() -@@ -111,8 +120,9 @@ else: +@@ -111,8 +125,9 @@ else: print 'Key is already enabled.' elif (argv[1][2] == 'k') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -99,7 +111,7 @@ sqlite3 support from http://code.google. print 'Key not found.' else: cur.execute("DELETE FROM yubikeys WHERE nickname = '" + nickname + "'") -@@ -121,8 +131,9 @@ else: +@@ -121,8 +136,9 @@ else: elif (argv[1][2] == 'a') and (len(argv)>4): nickname = re.escape(argv[2]) if ((len(argv[2])<=16) and (len(argv[3]) <= 16) and (len(argv[4]) <= 12) and (len(argv[5])<=32)): @@ -111,7 +123,7 @@ sqlite3 support from http://code.google. cur.execute("INSERT INTO yubikeys VALUES ('" + argv[2] + "', '" + argv[3] + "', '" + time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) + "', '" + argv[4] + "', '" + argv[5] + "', 1, 1, 1)") con.commit() print "Key '" + argv[2] + "' added to database." -@@ -133,13 +144,14 @@ else: +@@ -133,13 +149,14 @@ else: print 'Secretid must be 12 characters max, aeskey must be 32 characters max.\n' quit() elif (argv[1][2] == 'l'): @@ -132,7 +144,7 @@ sqlite3 support from http://code.google. print '' else: print 'No keys in database\n' -@@ -148,12 +160,14 @@ else: +@@ -148,12 +165,14 @@ else: elif argv[1][0:2] == '-h': if (argv[1][2] == 'd') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -151,7 +163,7 @@ sqlite3 support from http://code.google. cur.execute("UPDATE oathtokens SET active = '1' WHERE nickname = '" + nickname + "'") print "Key '" + nickname + "' disabled." con.commit() -@@ -162,12 +176,14 @@ else: +@@ -162,12 +181,14 @@ else: elif (argv[1][2] == 'e') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -170,7 +182,7 @@ sqlite3 support from http://code.google. cur.execute("UPDATE oathtokens SET active = '1' WHERE nickname = '" + nickname + "'") print "Key '" + nickname + "' enabled." con.commit() -@@ -175,8 +191,9 @@ else: +@@ -175,8 +196,9 @@ else: print 'Key is already enabled.' elif (argv[1][2] == 'k') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -182,7 +194,7 @@ sqlite3 support from http://code.google. print 'Key not found.' else: cur.execute("DELETE FROM oathtokens WHERE nickname = '" + nickname + "'") -@@ -185,8 +202,9 @@ else: +@@ -185,8 +207,9 @@ else: elif (argv[1][2] == 'a') and (len(argv)>3): nickname = re.escape(argv[2]) if (len(argv[2])<=16) and (len(argv[3]) <= 16) and (len(argv[4]) <= 40): @@ -194,7 +206,7 @@ sqlite3 support from http://code.google. cur.execute("INSERT INTO oathtokens VALUES ('" + nickname + "', '" + argv[3] + "', '" + time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) + "', '" + argv[4] + "', 1, 1)") con.commit() print "Key '" + argv[2] + "' added to database." -@@ -197,14 +215,14 @@ else: +@@ -197,14 +220,14 @@ else: print 'Secret key must be 40 characters max.\n' quit() elif (argv[1][2] == 'l'): @@ -216,7 +228,7 @@ sqlite3 support from http://code.google. else: print 'No keys in database\n' else: -@@ -212,13 +230,15 @@ else: +@@ -212,13 +235,15 @@ else: elif argv[1][0:2] == '-a': if (argv[1][2] == 'a') and (len(argv)>2): nickname = re.escape(argv[2]) @@ -236,7 +248,7 @@ sqlite3 support from http://code.google. else: id = 1 api_key = randomChars(20) -@@ -228,22 +248,23 @@ else: +@@ -228,22 +253,23 @@ else: print "Your API Key ID is: " + str(id) + "\n" elif (argv[1][2] == 'k') and (len(argv)>2): nickname = re.escape(argv[2]) Index: patches/patch-yubiserve_py =================================================================== RCS file: /cvs/ports/security/yubiserve/patches/patch-yubiserve_py,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-yubiserve_py --- patches/patch-yubiserve_py 18 Jul 2012 08:25:07 -0000 1.1.1.1 +++ patches/patch-yubiserve_py 11 Sep 2013 08:44:28 -0000 @@ -3,8 +3,8 @@ $OpenBSD: patch-yubiserve_py,v 1.1.1.1 2 sqlite3 support from http://code.google.com/p/yubico-yubiserve/source/list r39 ---- yubiserve.py.orig Wed Jul 18 01:16:24 2012 -+++ yubiserve.py Wed Jul 18 01:16:13 2012 +--- yubiserve.py.orig Tue Dec 14 10:48:50 2010 ++++ yubiserve.py Wed Sep 11 10:41:27 2013 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!${MODPY_BIN} @@ -162,3 +162,22 @@ http://code.google.com/p/yubico-yubiserv ctx.use_privatekey_file (fpem) ctx.use_certificate_file(fpem) self.socket = SSL.Connection(ctx, socket.socket(self.address_family, self.socket_type)) +@@ -339,6 +352,11 @@ except NameError: + isThereMysql = False + try: + if sqlite != None: ++ isThereSqlite = True ++except NameError: ++ isThereSqlite = False ++try: ++ if sqlite3 != None: + isThereSqlite = True + except NameError: + isThereSqlite = False +@@ -364,4 +382,4 @@ ssl_thread.start() + print "HTTP Server is running." + + while 1: +- time.sleep(1) +\ No newline at end of file ++ time.sleep(1)