Project

General

Profile

Bug #3436

Condor 7.9.x changes the format for escaped characters in classad values.

Added by Anthony Tiradani almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Category:
Frontend
Target version:
Start date:
02/06/2013
Due date:
% Done:

0%

Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Duration:

Description

Condor 7.9.x changes the format for escaped characters in classad values. This breaks glideinWMS. The Frontend throws a warning saying that an invalid RSA key was found. The issue is that Condor 7.9.x throws in a few extra \'s.

History

#1 Updated by Anthony Tiradani almost 7 years ago

I've taken a snapshot of an old key to perform tests on. I believe that the following should work for Condor 7.8.x and Condor 7.9.x.

import re

rsa_1_slashes = '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9OnOwshtxjkvzjTs17YE\neb9WJJEvTVaIjLEVj2eLSTHFF+0vp6idsxmXXMbnr6RUM7JHvL/z3xdUhf1MJhrG\nPI4BUnYSVd5p7rzJpmBWl4tXBHmu47xKF8qrS7fH04I44Vp0B/s2lAjvgOLOdyVs\npPddTAPmSUTsVgxnqES9Um/k/n7gfeKjubkex5pYmKKZ3AHO8/v6QXsm7LPF8T+6\nzU/CbGVWbmgJvjolxpptkN2GHnlZQr3JIEP0AsrZcfFKwh9mtrok02NmMKYSo5R1\nrI0BwQT5ZSIUpv4RjYwsPH+4uHbzQyHtV5xVnnSx1rxSSCh8SIHfhal1dYJoEvJ1\n4QIDAQAB\n-----END PUBLIC KEY-----\n'
print "rsa_1_slashes (pre): %s" % rsa_1_slashes

rsa_1_slashes = re.sub(r"\\+n", r"\n", rsa_1_slashes)
print "rsa_1_slashes (post): %s" % rsa_1_slashes

rsa_2_slashes = '-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9OnOwshtxjkvzjTs17YE\\neb9WJJEvTVaIjLEVj2eLSTHFF+0vp6idsxmXXMbnr6RUM7JHvL/z3xdUhf1MJhrG\\nPI4BUnYSVd5p7rzJpmBWl4tXBHmu47xKF8qrS7fH04I44Vp0B/s2lAjvgOLOdyVs\\npPddTAPmSUTsVgxnqES9Um/k/n7gfeKjubkex5pYmKKZ3AHO8/v6QXsm7LPF8T+6\\nzU/CbGVWbmgJvjolxpptkN2GHnlZQr3JIEP0AsrZcfFKwh9mtrok02NmMKYSo5R1\\nrI0BwQT5ZSIUpv4RjYwsPH+4uHbzQyHtV5xVnnSx1rxSSCh8SIHfhal1dYJoEvJ1\\n4QIDAQAB\\n-----END PUBLIC KEY-----\\n'
print "rsa_2_slashes (pre): %s" % rsa_2_slashes

rsa_2_slashes = re.sub(r"\\+n", r"\n", rsa_2_slashes)
print "rsa_2_slashes (post): %s" % rsa_2_slashes

rsa_4_slashes = '-----BEGIN PUBLIC KEY-----\\\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9OnOwshtxjkvzjTs17YE\\\\neb9WJJEvTVaIjLEVj2eLSTHFF+0vp6idsxmXXMbnr6RUM7JHvL/z3xdUhf1MJhrG\\\\nPI4BUnYSVd5p7rzJpmBWl4tXBHmu47xKF8qrS7fH04I44Vp0B/s2lAjvgOLOdyVs\\\\npPddTAPmSUTsVgxnqES9Um/k/n7gfeKjubkex5pYmKKZ3AHO8/v6QXsm7LPF8T+6\\\\nzU/CbGVWbmgJvjolxpptkN2GHnlZQr3JIEP0AsrZcfFKwh9mtrok02NmMKYSo5R1\\\\nrI0BwQT5ZSIUpv4RjYwsPH+4uHbzQyHtV5xVnnSx1rxSSCh8SIHfhal1dYJoEvJ1\\\\n4QIDAQAB\\\\n-----END PUBLIC KEY-----\\\\n'
print "rsa_4_slashes (pre): %s" % rsa_4_slashes

rsa_4_slashes = re.sub(r"\\+n", r"\n", rsa_4_slashes)
print "rsa_4_slashes (post): %s" % rsa_4_slashes

Before I get too involved in trying to setup test instances with each version of Condor, could someone eyeball this and let me know if there is anything objectionable in this approach?

#2 Updated by Derek Weitzel almost 7 years ago

Hi Tony,

I am run 7.9, and I believe I worked with someone to fix this issue.

Anyways, the line in glideinFrontendElement.py that needs to change escaping is:

glidein_el['attrs']['PubKeyObj']=pubCrypto.PubRSAKey(str(string.replace(glidein_el['attrs']['PubKeyValue'],'\\n','\n')))

to

glidein_el['attrs']['PubKeyObj']=pubCrypto.PubRSAKey(str(string.replace(glidein_el['attrs']['PubKeyValue'], '\\\\n', '\n')))

And this works with 7.9.1. So I believe you are on the right track.

#3 Updated by Anthony Tiradani almost 7 years ago

Hi Derek,

Check out the branch_master_3436 branch. The line you specified is exactly the line I changed. The reason for the regex is compatibility with both HTCondor 7.9.x and 7.8.x. The regex takes one or more slashes plus "n" and converts them to \n.

Thanks for looking at it.

#4 Updated by Anthony Tiradani almost 7 years ago

Sorry. Here is the commit...

commit:da5d862b08252bb6171555e60f42fffacb10a257

#5 Updated by Anthony Tiradani almost 7 years ago

John discovered a unicode problem with my regex substitution. Apparently the results are returned in unicode instead of a python string. I wrapped the substitution in an str call and added some debug level logging.

commit:b46d9b26c0162f9a2cb8014491bd16dd0471f61f

#6 Updated by John Weigand almost 7 years ago

Tested using Condor 7.8.6 and 7.9.1.
Works beautifully as expected!!

John Weigand

#7 Updated by Derek Weitzel almost 7 years ago

The target version for this change is 3_1, but will it also be in 2plus?

#8 Updated by Burt Holzman almost 7 years ago

Tony will backport this fix to v2.7.

#9 Updated by Burt Holzman almost 7 years ago

  • Status changed from New to Resolved

This is also in branch_v2plus (commit:3b3211b) and will be in v2.7 final.

#10 Updated by Parag Mhashilkar over 6 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF