Skip to content

CertUtils: export private key to pem format correctly#2875

Merged
yadvr merged 1 commit into
apache:4.11from
shapeblue:pem-format-fix-private-key
Oct 4, 2018
Merged

CertUtils: export private key to pem format correctly#2875
yadvr merged 1 commit into
apache:4.11from
shapeblue:pem-format-fix-private-key

Conversation

@yadvr
Copy link
Copy Markdown
Member

@yadvr yadvr commented Oct 4, 2018

This makes openssl rsa -in -check pass, due to "RSA" string the
validate of private key (pem file) by openssl fails. Also removes
a commented import.

Without this fix, in some systems the key/crt could not be reused. Following error was observed in openssl:
$ openssl rsa -in -check
RSA key ok
139832889164824:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1220:
139832889164824:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:tasn_dec.c:788:
139832889164824:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:720:Field=n, Type=RSA
139832889164824:error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib:rsa_ameth.c:121:

With this fix, the private key pem file will pass. Openssl output:
$ openssl rsa -in -check
RSA key ok
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
...content of the file...

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

How Has This Been Tested?

More Found this issue while refactoring/fixing CCS with ACS 4.11.1. With the fix, kubernetes api service could use CA framework issued certificates.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
    Testing
  • I have added tests to cover my changes.
  • All relevant new and existing integration tests have passed.
  • A full integration testsuite with all test that can run on my environment has passed.

This makes openssl rsa -in <file> -check pass, due to "RSA" string the
validate of private key (pem file) by openssl fails. Also removes
a commented import.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@yadvr yadvr added this to the 4.11.2.0 milestone Oct 4, 2018
@yadvr
Copy link
Copy Markdown
Member Author

yadvr commented Oct 4, 2018

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2329

@yadvr
Copy link
Copy Markdown
Member Author

yadvr commented Oct 4, 2018

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

Copy link
Copy Markdown
Member

@GabrielBrascher GabrielBrascher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @rhtyd!

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-3056)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 34842 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2875-t3056-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermittent failure detected: /marvin/tests/smoke/test_public_ip_range.py
Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
Intermittent failure detected: /marvin/tests/smoke/test_templates.py
Intermittent failure detected: /marvin/tests/smoke/test_usage.py
Intermittent failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermittent failure detected: /marvin/tests/smoke/test_volumes.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 63 look OK, 4 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_03_vpc_privategw_restart_vpc_cleanup Failure 1100.24 test_privategw_acl.py
test_04_extract_template Failure 128.32 test_templates.py
ContextSuite context=TestISOUsage>:setup Error 0.00 test_usage.py
test_06_download_detached_volume Failure 137.56 test_volumes.py

@yadvr yadvr merged commit 0c943ab into apache:4.11 Oct 4, 2018
@yadvr yadvr deleted the pem-format-fix-private-key branch October 5, 2018 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants