diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 248d99929..67be4e412 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -43,6 +43,10 @@ + +

New test containers with static test certificates.

+
+

Add testRepoPath() to let C unit tests know where the code repository is located.

diff --git a/test/certificate/.gitignore b/test/certificate/.gitignore new file mode 100644 index 000000000..c80de9a8f --- /dev/null +++ b/test/certificate/.gitignore @@ -0,0 +1,2 @@ +*.csr +*.srl diff --git a/test/certificate/README.md b/test/certificate/README.md new file mode 100644 index 000000000..76af1822c --- /dev/null +++ b/test/certificate/README.md @@ -0,0 +1,48 @@ +# pgBackRest Test Certificates + +The certificates in this directory are used for testing purposes only and are not used for actual services. They are used only by the unit and integration tests and there should be no reason to modify them unless new tests are required. + +## Generating the Test CA (pgbackrest-test-ca.crt/key) + +This is a self-signed CA that is used to sign all server certificates. No intermediate CAs will be generated since they are not needed for testing. + +``` +cd [pgbackrest-root]/test/certificate +openssl genrsa -out pgbackrest-test-ca.key 4096 +openssl req -new -x509 -extensions v3_ca -key pgbackrest-test-ca.key -out pgbackrest-test-ca.crt -days 99999 \ + -subj "/C=US/ST=All/L=All/O=pgBackRest/CN=test.pgbackrest.org" +openssl x509 -in pgbackrest-test-ca.crt -text -noout +``` + +## Generating the Test Key (pgbackrest-test.key) + +This key will be used for all server certificates to keep things simple. + +``` +cd [pgbackrest-root]/test/certificate +openssl genrsa -out pgbackrest-test.key 4096 +``` + +## Generating the Alt Name Test Certificate (pgbackrest-test-alt-name.crt) + +This certificate will include alternate names and will only be used in unit tests to check alternate name verification functionality. + +``` +cd [pgbackrest-root]/test/certificate +openssl req -new -sha256 -nodes -out pgbackrest-test-alt-name.csr -key pgbackrest-test.key -config pgbackrest-test-alt-name.cnf +openssl x509 -req -in pgbackrest-test-alt-name.csr -CA pgbackrest-test-ca.crt -CAkey pgbackrest-test-ca.key -CAcreateserial \ + -out pgbackrest-test-alt-name.crt -days 99999 -extensions v3_req -extfile pgbackrest-test-alt-name.cnf +openssl x509 -in pgbackrest-test-alt-name.crt -text -noout +``` + +## Generating the Test Certificate (pgbackrest-test.crt) + +This certificate will be used in unit and integration tests. It is expected to pass verification but won't be subjected to extensive testing. + +``` +cd [pgbackrest-root]/test/certificate +openssl req -new -sha256 -nodes -out pgbackrest-test.csr -key pgbackrest-test.key -config pgbackrest-test.cnf +openssl x509 -req -in pgbackrest-test.csr -CA pgbackrest-test-ca.crt -CAkey pgbackrest-test-ca.key -CAcreateserial \ + -out pgbackrest-test.crt -days 99999 -extensions v3_req -extfile pgbackrest-test.cnf +openssl x509 -in pgbackrest-test.crt -text -noout +``` diff --git a/test/certificate/pgbackrest-test-alt-name.cnf b/test/certificate/pgbackrest-test-alt-name.cnf new file mode 100644 index 000000000..0a0f3e106 --- /dev/null +++ b/test/certificate/pgbackrest-test-alt-name.cnf @@ -0,0 +1,26 @@ +[req] +default_bits = 4096 +prompt = no +default_md = sha256 +req_extensions = v3_req +distinguished_name = dn + +[ dn ] +C=US +ST=All +L=All +O=pgBackRest +OU=Unit Testing Domain +CN = test.pgbackrest.org + +[ v3_req ] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[ alt_names ] +DNS.1 = test.pgbackrest.org +DNS.2 = *.test.pgbackrest.org +IP.1 = 127.0.0.1 +DNS.3 = test2.pgbackrest.org +DNS.4 = *.test2.pgbackrest.org diff --git a/test/certificate/pgbackrest-test-alt-name.crt b/test/certificate/pgbackrest-test-alt-name.crt new file mode 100644 index 000000000..6b5f8af12 --- /dev/null +++ b/test/certificate/pgbackrest-test-alt-name.crt @@ -0,0 +1,34 @@ +-----BEGIN CERTIFICATE----- +MIIF4jCCA8qgAwIBAgIJAN+gSjwW7yR+MA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNV +BAYTAlVTMQwwCgYDVQQIDANBbGwxDDAKBgNVBAcMA0FsbDETMBEGA1UECgwKcGdC +YWNrUmVzdDEcMBoGA1UEAwwTdGVzdC5wZ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3JnghUqLnRlc3Qu +cGdiYWNrcmVzdC5vcmeHBH8AAAGCFHRlc3QyLnBnYmFja3Jlc3Qub3JnghYqLnRl +c3QyLnBnYmFja3Jlc3Qub3JnMA0GCSqGSIb3DQEBCwUAA4ICAQABqorGy+U2CBBl +ei2Q0zTccJVPqz3xL6UpZVh0X/SoZFisZNyLPskxAh070q8C11g4uqyPoXPp2eJt +smwop2pY6glzO+7b9kEUo2527s8BJejlIzAe9bQ8eZ1Hbqlh52B+wzEE7Ci22KDC +O3RZCya6WiMHXxFCjPR7m4qaoodU4XtRefepg/bs0qUq5rrsHDRfvaitISUOeXnj +NSsLyiVLbwkCW3mL7bEFAG1Th8GWa809zpw8fJiUkhavtDe35UesHM5fOZ8oqY28 +BIcSc5yVgOxDAHDQI9lf9umAN5ZakT9lo5WdndG9eUZGOK72s8Vy1ReiKH+vX2qw +3cI69akD+UBLqvO9NFMJPurDLdM82B453EaBqDhm1oPPwHsXc8wiNG6jYmIAHlvN +qX1qXcdJjp54PSv6RFm/ZxcS6CCRRzPv46Zi86cynY32qmEYU5Et3tGVwx6KywRx +HKF206NUzyHYW8cuDywTpQZSYuAHrjcWGzS/Fg1aTIGULRffFLTvmt6URHjpfFwJ +bRkMcw+k1xdV01rTA2jnDbFAC5f6V7QOGwcqSzc25cz1PDHWweCw4oDwpAxRFx14 +X98jbWjo6YYsc9wWpcQt5NICO5wHoaJfhawf7suJmuluQTzOsH2ZS6O0zVJmbsVs +KveXMVBWdJoaJjUqEBy6tJHB5uRxJg== +-----END CERTIFICATE----- diff --git a/test/certificate/pgbackrest-test-ca.crt b/test/certificate/pgbackrest-test-ca.crt new file mode 100644 index 000000000..751ddb453 --- /dev/null +++ b/test/certificate/pgbackrest-test-ca.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFkDCCA3igAwIBAgIJAKfL57w5QrmFMA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNV +BAYTAlVTMQwwCgYDVQQIDANBbGwxDDAK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MBaAFGo+OwmN +N1QFNDAOYpuySZSYdNZ2MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD +ggIBAL/q0d9FFFWRD6ldCVUcarcZX/mWcchtGGO1xHIesvdAZHd7dZx2ZlJ2OmpN +KwC+9+jXv7h6EqeVuxqPYFlXUdHSXNqrZecFmmXwqa8hqn08ZCZqYJ5CVFjhw+jE +IMvclt5NpessLVKn6Xs75OogbtN69pJdxYnh28l/yoG1gu+41DtDXZjVeIFXCPo3 +oLm+ARwG33z1QD66YBnpRmW57M8j+fHiPFtONqCMSk2dt/PEOYDCPhimA5G1lJzw +qyrEiMX9+oyYkfpxmQrGjOVswQvvN/XhSgaMrIoa/cZZwUTe+EtY+jQMXWqk7/F2 +ufalTU9x1uZElh94YOsOREq34Ef4lJC/9K0ayfoQY+2qyBPKwGISUUJUY/dPGVd+ +cz91fCmy12X3jsw1vmyJ9UU/hC2Nr4LGxDlcRq88/ev7eGAvsOHwgRYJzLfwaJF6 +XMeKZfxq1uvFlJyAyYszu9BL5n26eDunBsQbH9R2avE7deVOwxWMUkX2nX7QEENp +dGL3q/3ar/uaMFrAkk5JGUpfozsiXs4BLYKcXRKGy9oBoRuR3lGk+t163qBHh/Rw +M8+tsCo6j4ReSgq2ew+sHfxj4rQ4Bly+965RRPjZPu20QMlbWzD6kEB+F2II537e +R1KzQRet3Mqf+IY98aAWRfRW9sefkeYrD9BP9jhbSaoh7E0n +-----END CERTIFICATE----- diff --git a/test/certificate/pgbackrest-test-ca.key b/test/certificate/pgbackrest-test-ca.key new file mode 100644 index 000000000..30fe7f388 --- /dev/null +++ b/test/certificate/pgbackrest-test-ca.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKgIBAAKCAgEA363DCLQblcgOjA3qZAJfxameJrRZFvs2xxGNX6IhpLv1uWSr +5V6t47lGIUORf/Jol/lj/Y8jN3BuW3eSnsAjeMTVC1t9kE3fmZ5Rvnyugkl+t1hV +2Vg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0ab+jTI1 +7vbXWgYD9rCkcdYaOcDo9X5+CGBaEM01LZbBLkUcLG9nOxOS+M8ptq3CXaDPVs7N +tUlftcMyJd8oYA1YTjOv2aZFvo95c/aNczyopCcfpcNQI4sdk0igj4TOkqLD95gh +BoHVJ1B3DP5ps/rv2+/OyG0zXHODxRT7lG0gIpoP+HN2tXWsiSlB86iYbkUMt2T9 +jfZXsfsCggEBAIpcNSkePt1j8JCJyJe4YegSLCA7KgFGFlOHbTkumExfKAW8PLIY +wK7ZIOpXZXVJgJuPJBsmqoRtGFG0xdbVlat2NejGnvG6TgawM7TfWzQnbjfnZkf6 +ofCH+xKTuQ34QoACRj+Ss57m1Bv6PEg6eSDCZtBS4jjVTUx5hU6zS3iETV45V5Ht +sDeBqGHkJvk0iM8gWOFVBLeVR8LVzS67VPT+OFAvA5ay7nZGYEcQxmMpjVq2Q/YT +NIl6pgjereHVID0xK2T3b+IZIjWqn/HlJ5mHedjsC7C5rM8QrcSFgpiLztaezNul +vNcbYFGcFaV9Dw0eN+ofKeoGNaadwSS9mJkCggEAZz41LQSJYxF8nMc1Cx+ROC59 +7InZLZBpYFgvkJBMgpabRW3P33SjrF1vOOb8QKHEawmGVICg6y6fDWdUJkuL9PJK +KUhM6f6+RrOAmTLEX0nBc/Qu7vn5xWdfU4IaGYyon+J290GlzZv+C31wQyhAfMc4 +LffXr9aXDNXF9C6RJiDP07pcgzu295B00KqiRaim8ZG1Ab+FOg+ZrFbvYxE1DdNC +UX5iVgVo1T8sOy/An1ACNy5xzCkiEUk3stCKMMCnUiw3Y0fHvxFc9se786JVwejY +Pecz4yaqRJDn97WrFvqI/Nwi1W/pOtaOJfsLnsO6S/uZTAW+vXwi9l82ETNjbw== +-----END RSA PRIVATE KEY----- diff --git a/test/certificate/pgbackrest-test.cnf b/test/certificate/pgbackrest-test.cnf new file mode 100644 index 000000000..3d18497f3 --- /dev/null +++ b/test/certificate/pgbackrest-test.cnf @@ -0,0 +1,18 @@ +[req] +default_bits = 4096 +prompt = no +default_md = sha256 +req_extensions = v3_req +distinguished_name = dn + +[ dn ] +C=US +ST=All +L=All +O=pgBackRest +OU=Unit Testing Domain +CN = *.test.pgbackrest.org + +[ v3_req ] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment diff --git a/test/certificate/pgbackrest-test.crt b/test/certificate/pgbackrest-test.crt new file mode 100644 index 000000000..6ec40959b --- /dev/null +++ b/test/certificate/pgbackrest-test.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFdzCCA1+gAwIBAgIJAN+gSjwW7yR/MA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNV +BAYTAlVTMQwwCgYDVQQIDANBbGwxDDAKBgNVBAcMA0FsbDETMBEGA1UECgwKcGdC +YWNrUmVzdDEcMBoGA1UEAwwTdGVzdC5wZ2JhY2tyZXN0Lm9yZzAgFw0xODExMjAx +MzU2NDJaGA8yMjkyMDkwMzEzNTY0MlowfDELMAkGA1UEBhMCVVMxDDAKBgNVBAgM +A0FsbDEMMAoGA1UEBwwDQWxsMRMwEQYDVQQKDApwZ0JhY2tSZXN0MRwwGgYDVQQL +DBNVbml0IFRlc3RpbmcgRG9tYWluMR4wHAYDVQQDDBUqLnRlc3QucGdiYWNrcmVz +dC5vcmcwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDDM1kNf9WFMDqU +AtcNngA4e/g5AfnBNmKlr3td1OsjZMh8wYR98ua/nDM3zmmS7kdcG4cYlRpQQ1e3 +VKwbB18HH+BlkQDyg42qSvE6glOsAFYgCzmTpNNR35/djf2uWzJCPTvp/WzDozD2 +qgKH4kpcMOrDyQbBAeJ9d20KvEv059Xh6r6Bgqup2XIUzTxZ8rF7QmzxsHlxngG3 +8YLYmFDND1syNgmXFJcheK8/8UW6dVPmFnyCxRUAf7+ybzGVDix51buYgEqSNPe2 +AvQW9yEHdfKhnpKvQkpVow5xCMixPM6p2BrCACs7njVnBRYd0kf4M4Ov+AF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fghgBfKLLcjpe/Y9kJvY1g/Fd77zXMHMPs1Zbv3 +4MleZ146f1S0En0= +-----END CERTIFICATE----- diff --git a/test/certificate/pgbackrest-test.key b/test/certificate/pgbackrest-test.key new file mode 100644 index 000000000..cf285af2b --- /dev/null +++ b/test/certificate/pgbackrest-test.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEAwzNZDX/VhTA6lALXDZ4AOHv4OQH5wTZipa97XdTrI2TIfMGE +ffLmv5wzN85pku5HXBuHGJUaUENXt1SsGwdfBx/gZZEA8oONqkrxOoJTrABWIAs5 +k6TTUd+f3Y39rlsyQj076f1sw6Mw9qoCh+JKXDDqw8kGwQHifXdtCrxL9OfV4eq+ +gYKrqdlyFM08WfKxe0Js8bB5cZ4Bt/GC2JhQzQ9bMjYJlxSXIXivP/FFunVT5hZ8 +gsUVAH+/sm8xlQ4sedW7mIBKkjT3tgL0FvchB3XyoZ6Sr0JKVaMOcQjIsTzOqdga +wgArO541ZwUWHdJH+DODr/gBWXSnnzhHED5DAvRMPdO/t353qS/ihpacTqQ91B4U +KxK1pVNC84ch3spCLnQncl7kn7RhcdCcb5g4ZfahRmq79QSoMDvN4+7MtyERLXtS +ttSWiBzQVVj/jcFNDeGeDjKp6Z55xosotMZ3yVajl4IbuQS1pfTLjp7WdJ58y5hQ ++8O/ebjUYIxOo5kZhRZV/jxqoR7Ga9MGbAQ7BPcTuItpfGqiWcdYU+ZdyyFwvpXo +v6qNoCYt58nj7s+FAbed7EzRHa2Z3RVGkcqv2iX5EddydHmqKip+QUUR4cPLUXn+ +kvOHtJEOgAWDURh0DVfhrMD5dX1d+9deBUwZ89gYvxkkErPL1o8OPRxyiucCAwEA +AQKCAgA5JquIHElzuW8tLrewMPZ3kzRV3JI3U6kGQZ6pFlHSBwv8Gtyj055js2P7 +jt+yOTmDajvfoqgVn+Hqt0u8jifwehDFK/NPDd1IYrDGJKpCzcZpk1/ELpoAeqzf +vVbs2Z6Z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wZryoK6F4HfB9Gme9CvdKvdzAOSjGhvnCKHU +O31qnBui9odatFyoFc1/9xDOe2vgPsPLd929xFCz9vA7j1tf7TzLmhY38ynhWaor +MyjIeM1oEZzhIdMSxt3kCp8vDykUP1caXc92g7jyyVwC1l03HzvXNHkTFSQ= +-----END RSA PRIVATE KEY----- diff --git a/test/container.yaml b/test/container.yaml index d54f30336..9b05e9594 100644 --- a/test/container.yaml +++ b/test/container.yaml @@ -13,8 +13,8 @@ # - docker tag pgbackrest/test:{vm}-base pgbackrest/test:{vm}-base-YYYYMMDDA # - docker push pgbackrest/test:{vm}-base-YYYYMMDDA # ********************************************************************************************************************************** -20181108A: - u18: 06d378758d6e2f797457578039201a27c9344979 - co6: ea59b548f8590edf6873f6c1b32d6a232bf7e1ee - co7: 7ce2337eeddd433b6ca9400a9c99ce444981c938 - u12: 60f8591b9dd33a25720d3eefe3e9f39bf2884bc4 +20181121A: + u18: e62cd73d8e20f0bc25a1b3c4fd2bd3520ee196b3 + co6: a7836f34b8053bc7656676c0b188b1893bc41186 + co7: 72b99963f7bdf7b1b9d617239149d9c583819887 + u12: d36f0ea1ff557524bc80e02d2a25daf287ebce64 diff --git a/test/lib/pgBackRestTest/Common/ContainerTest.pm b/test/lib/pgBackRestTest/Common/ContainerTest.pm index ef9762c90..76aa024f4 100755 --- a/test/lib/pgBackRestTest/Common/ContainerTest.pm +++ b/test/lib/pgBackRestTest/Common/ContainerTest.pm @@ -130,7 +130,7 @@ sub containerWrite $strScript = "# ${strTitle} Container\n" . "FROM ${strImageParent}" . - (defined($strCopy) ? "\n\n${strCopy}\n\n" : '') . + (defined($strCopy) ? "\n\n${strCopy}" : '') . (defined($strScript) && $strScript ne ''? "\n\nRUN echo '" . (CONTAINER_DEBUG ? 'DEBUG' : 'OPTIMIZED') . " BUILD'" . $strScript : ''); @@ -259,7 +259,9 @@ sub sshSetup #################################################################################################################################### sub certSetup { - return + my $strOS = shift; + + my $strScript = sectionHeader() . "# Generate fake certs\n" . " mkdir -p -m 755 /etc/fake-cert && \\\n" . @@ -272,7 +274,34 @@ sub certSetup " -subj \"/C=US/ST=Country/L=City/O=Organization/CN=*.pgbackrest.org\" && \\\n" . " openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 99999 \\\n" . " -sha256 && \\\n" . - " chmod 644 /etc/fake-cert/*"; + " chmod 644 /etc/fake-cert/* && \\\n"; + + my $rhVm = vmGet(); + + if ($rhVm->{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL) + { + if ($strOS eq VM_CO6) + { + $strScript .= + " update-ca-trust enable && \\\n"; + } + + $strScript .= + " cp /etc/fake-cert/pgbackrest-test-ca.crt /etc/pki/ca-trust/source/anchors && \\\n" . + " update-ca-trust extract"; + } + elsif ($rhVm->{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN) + { + $strScript .= + " cp /etc/fake-cert/pgbackrest-test-ca.crt /usr/local/share/ca-certificates && \\\n" . + " update-ca-certificates"; + } + else + { + confess &log(ERROR, "unable to install certificate for $rhVm->{$strOS}{&VM_OS_BASE}"); + } + + return $strScript; } #################################################################################################################################### @@ -478,7 +507,18 @@ sub containerBuild } #--------------------------------------------------------------------------------------------------------------------------- - $strScript .= certSetup(); + my $strCertPath = 'test/certificate'; + my $strCertName = 'pgbackrest-test'; + + $strCopy = '# Copy Test Certificates'; + + foreach my $strFile ('-ca.crt', '.crt', '.key') + { + $oStorageDocker->copy("${strCertPath}/${strCertName}${strFile}", "${strTempPath}/${strCertName}${strFile}"); + $strCopy .= "\nCOPY ${strCertName}${strFile} " . CERT_FAKE_PATH . "/${strCertName}${strFile}"; + } + + $strScript .= certSetup($strOS); #--------------------------------------------------------------------------------------------------------------------------- if (!$bDeprecated) @@ -629,7 +669,7 @@ sub containerBuild $strScript .= entryPointSetup($strOS); - containerWrite($oStorageDocker, $strTempPath, $strOS, 'Build', $strImageParent, $strImage, $strCopy,$strScript, $bVmForce); + containerWrite($oStorageDocker, $strTempPath, $strOS, 'Build', $strImageParent, $strImage, $strCopy, $strScript, $bVmForce); # Copy Devel::Cover to host so it can be installed in other containers (if it doesn't already exist) if ($bPkgDevelCoverBuild)