Skip to content

Commit

Permalink
feat(AV-199348, AV-203300, AV-203299): Netscaler bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarpsalvi committed Apr 4, 2024
1 parent eb561ab commit 3bcafaa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/avi/migrationtools/ansible/ansible_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'SeProperties', 'ControllerProperties', 'CloudProperties', 'ALBServicesConfig']


SKIP_FIELDS = ['uuid', 'url', 'ref_key', 'se_uuids', 'key_passphrase',
SKIP_FIELDS = ['uuid', 'url', 'ref_key', 'se_uuids',
'extension']
HTTP_TYPE = 'http'
SSL_TYPE = 'ssl'
Expand Down
6 changes: 5 additions & 1 deletion python/avi/migrationtools/avi_migration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ def is_certificate_key_protected(self, key_file):
:param key_file: Path of key file
:return: Return True if key is passphrase protected else return False
"""
if '/Common/' in key_file:
key_file = key_file.replace('/Common/', '')
if ':Common:' in key_file:
key_file = key_file.replace(':Common:', '')
try:
child = pexpect.spawn(
'openssl rsa -in %s -check -noout' % key_file)
# Expect for enter pass phrase if key is protected else it will raise
# an exception
child.expect('Enter pass phrase for')
child.expect('Enter pass phrase for %s' % key_file)
update_count('warning')
return True
except Exception as e:
Expand Down
2 changes: 2 additions & 0 deletions python/avi/migrationtools/f5_converter/profile_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ def update_key_cert_obj(
key_passphrase = None
# Get the key passphrase for key_file
if is_key_protected and self.f5_passphrase_keys:
if ":" in key_file_name:
key_file_name = key_file_name.split(":")[-1]
key_passphrase = self.f5_passphrase_keys.get(key_file_name, None)

if is_key_protected and not key_passphrase:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ def query_converter(self, rule, policy_name, bind_patset, patset_config,
'HTTP.REQ.URL.STARTSWITH' in query.upper() or \
'HTTP.REQ.URL.PATH_AND_QUERY.CONTAINS' \
in query.upper():
element = element.strip('"') if element.startswith('"/') else element
element = re.sub('[\\\/]', '', element)
match["query"]["match_str"].append(element)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ def convert_ssl_service_profile(self, set_ssl_service, bind_ssl_service,
accepted_versions.append({'type': 'SSL_VERSION_TLS1_1'})
if ssl_service.get('tls12', 'ENABLED') == 'ENABLED':
accepted_versions.append({'type': 'SSL_VERSION_TLS1_2'})
if ssl_service.get('tls13', '') == 'ENABLED':
accepted_versions.append({'type': 'SSL_VERSION_TLS1_3'})
if accepted_versions:
ssl_profile['accepted_versions'] = accepted_versions
else:
Expand Down Expand Up @@ -674,6 +676,8 @@ def get_key_cert(self, ssl_mappings, ssl_key_and_cert, input_dir,
key_passphrase = None
# Get the key passphrase for key_file
if self.netscalar_passphrase_keys:
if ":" in key_file_name:
key_file_name = key_file_name.split(":")[-1]
key_passphrase = self.netscalar_passphrase_keys.get(
key_file_name, None)
# if key is protected and does not find passphrase key
Expand Down

0 comments on commit 3bcafaa

Please sign in to comment.