Terraform, AWS and importing existing SSL certificates - ssl

I'm working in a project where I have gotten a situation which I can't get the path to succeed.
Truth is I'm running terraform code through a pipeline, this code depends on a bunch of certificates that have been added through AWS web console, so I have the certificate, the private key and the certificate chain files.
(I delete them and tried to import through terraform)
Googling a bit I got these:
resource "aws_acm_certificate" "tch-cert" {
private_key=file("private.key")
certificate_body = file("actual_cert.cer")
certificate_chain=file("inter.cer")
}
Upload ssl certs using terraform
I added the code, commit it and got error like the following in the terraform plan command
"error parsing ... 2:15 Unknown token: IDENT File" "error parsing ... 2:17 Unknown token: IDENT File"
Any advice or example how these should be done would be really appreciate it. I read the terraform doc also but it's not working for me.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/acm_certificate

If you use terraform 0.11, then your syntax is incorrect. It works only for 0.12 and higher. For old versions, it should be:
resource "aws_acm_certificate" "tch-cert" {
private_key = "${file("private.key")}"
certificate_body = "${file("actual_cert.cer")}"
certificate_chain = "${file("inter.cer")}"
}

Related

Serverless deployment error - AppleIdentityProvider - Provided private key cannot be used

I am trying to deploy a serverless backend code to AWS. The code handles device registrations of ios devices with apple as Idp.
Got the following error:
Serverless Error ---------------------------------------
An error occurred: AppleIdentityProvider - Provided private key cannot be used for Sign in with Apple. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: c92xxxx-xxxxx-xxx-xx-x4c; Proxy: null).
Notes: A private key from a previous developer, is already present as a Parameter in Systems manager>>parameter store.
Q1) Does sls deploy expect a private_key to be stored on my laptop from where I am deploying?
Q2) I am dealing with backend code only, and not working on an ios app code directly. Why a private key is needed here?
Appreciate early response from experienced friends in this domain.
Many Thanks.
It means that your key has not been found. Please check your configuration files.
I think you lost the right key in your config files or the reference to the key is wrong
This is resolved.
the right key reference was missing in one of the yaml files.

Result code = -32, RespMsg = The certificate chain did not validate, common name did not match URL

I run a small ecommerce website in the UK. I use PayPal pro uk (name may have changed) to accept card payments directly on my website.
I recently moved servers to comply with tls1.2 demands.
When somebody tried to pay by card on my site they get the following error:
Result code = -32,
RespMsg = The certificate chain did not validate, common name did not match URL.
Input Server Uri = https://payflowpro.paypal.com/
I've contacted PayPal without any response. Does anybody know how to resolve this error?
Reason at here is TLS1.2 conflict .NET version
Please refer below link to update .NET version
https://github.com/paypal/payflow-gateway/tree/master/dotNET
after you download file then execute some step below :
step 1 : copy dll to ->c:\windows\syswow64\Payflow_dotNET.dll
step 2 : register dll : C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe c:\windows\syswow64\Payflow_dotNET.dll
Step 3 : check gacutil: gacutil /if c:\windows\syswow64\Payflow_dotNET.dll
after do it, everything work fine !
I got this issue too, even TLS 1.2 had been enabled too.
Update below settings into system, my problem solved.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001

SSL on SIM800 , certificate select issue

I am having some issues while working with SIM800. I am trying to upload SSL certificate but it is not going through. I created a certificate saved it in .cer format. I wrote the certificate in SIM800. I am able to read the content of cer file also. But somehow simcom gave an error when I tried AT+SSLSETCERT.
Please check if you have specified the path and name of file properly.
Following are command and log file from my test setup.
AT+FSLS=\
User\
#bt\
#btmtk\
#BTMre\
myserver_net.crt
OK
AT+FSFLSIZE=\myserver_net.crt
+FSFLSIZE: 1911
AT+SSLSETCERT="\myserver_net.crt","ABCD123"
+SSLSETCERT: 0
As you can see , the import is successful.
But I have other problems after this step. The SIM800C is not able to GET or PUT with FTPS. I get error 1,80 or 1,64 . So first see if you get solution for your problem as above and then let me know if you are able to transfer files.

Hosting a laravel project on openshift

I am pretty new to hosting on Openshift and also pretty new to Laravel.
I have a laravel project on my local system. What are the steps to successfully host the project on Openshift.
I tried the Quickstart guide, to load from a github repo. So i uploaded my project onto github
I had the env files kept secret by adding them in gitignore ( Should this be done ?)
I have the ssh key set up with rhv setup. Made a private key with Puttygen and can connect via Putty.
I checked if all the code has been uploaded to the openshift server with Putty
But my website gives a 500 Internal Server error.
What am i doing wrong ?
Edit: I connected to the server via ssh and found this error
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/lib/openshift/558bfb764382ec89c3000084/app-r oot/runtime/repo/public/index.php on line 50
Edit 2: On exploring the code on line 50 This is supported only on PHP5.5 or above. So i guess this is the problem ?
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
Is there any fix ?
How to fix this ?
You should try checking out the laravel 5 quickstart on the OpenShift Hub (https://hub.openshift.com/quickstarts/115-laravel-5-0), check out the source code and see what modifications were made to make it run correctly on OpenShift and then incorporate those changes into your application.

ORA-29024: Certificate validation failure

I've followed the following tutorials :
Create wallet,Create ACL
And I am still getting ORA-29024: Certificate validation failure error.
I'm trying this query :
UTL_HTTP.set_wallet('file:/home/oracle/wallet', 'password');
l_http_request := UTL_HTTP.begin_request('https://somedomain.co.il');
l_http_response := UTL_HTTP.get_response(l_http_request);
Now i've added to the ACL : *.somedomain.co.il,somedomain.co.il
And I've downloaded the certificate as DER encoded, as I've read somewhere that this is the one needed and didn't get any errors in the proccess of generating the wallet.
Any thoughts?
I'm using Oracle 11g
In the end my problem was when I exported the certificate i choose DER, in my case i should have used PCKS # 7, but this won't most likley work in all cases i guess it depends on the key.
So i guess if you landed here try and play with your certificate files (be sure to remove and re-add)
And very important, change sessions between tries to know if it worked or not because otherwise it'll keep giving you the error all though it should work.