Google Application Credential error clod sql proxy - json

I have created a PostgreSQL cloud instance with public ip. I have added my home ip into whitelist.
I have installed the cloud proxy SQL like Google doc.
When I run the proxy, I get this error:
The proxy has encountered a terminal error: unable to start: failed to get instance
private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: syntax error: sequence truncated
The error seams refer to credential json key ID client OAuth 2.0
Can you help me to understand this error and how to fix?
Thanks

I believe the private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: syntax error: sequence truncated is only concerned with the private_key field, rather than json in which it is contained. So it seems the key text might be mangled in some way.
You can follow this documentation how Connect to your Cloud SQL instance using SSL, then you can follow this guideline how to Configure SSL/TLS Certficates, and Connect using a MYSQL client, you can follow this and try.
or
You can follow the directions here Create and manage service account keys, could you perhaps remake a keyfile following these instructions.

Related

Getting error on live environment while connecting with Oracle Cloud Autonomous Transaction Processing Using wallet

The application is developed on VS 2015 Express. The same connection string is connected to my local system but on live environment, it is giving me error. Please help me out.
Error Message: ProviderIncompatibleException
Exception Type: System.Data.Entity.Core.ProviderIncompatibleException
Error Location : An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
Error Page Url: http://10.0.17.3:8081/
Usually, there's a different Oracle TNS_ADMIN location and wallet location for the live environment vs. the dev environment. You can set the wallet location in the .NET code or in sqlnet.ora. The TNS_ADMIN can be set in the code or as a Windows environment variable.
This error is fairly generic. If you can identify an inner exception or provider specific error code, it would be easier to identify the root cause of the problem.

how to connect to oracle free cloud using mobaxterm?

I'm trying to connect to oracle free cloud using mobaxterm but I'm receiving:
Unable to use key file "X:\\oracleCloud\\ssh-key-2020-10-11.key" (OpenSSH private key)
No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)
────────────────────────────────────────────────────────────────────────────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
I used the public ip + opc (as it's centos based machine), as well as the private key that was generated when I created the instance.
Any idea on what I am missing?
In order to be able to connect, I generated a ssh key pair using puttygen. Seems the generated ones from oracle were the problem.
I had the same problem in Mobaxterm 20. The key file worked fine in normal SSH, but with MobaXterm I received the same error message as you.
I've updated to MobaXTerm v 22.1 and it works fine

AWS: connecting to Aurora from Lambda Java Script using IAM as authentication method

I've been following this tutorial [1] to connect to an Aurora RDS cluster from a lambda JavaScript function using IAM authentication. I'm able to get an authentication token, but not able to use the token to get a connection to the data base. Also, I followed these instructions [2] to get an authentication token from CLI, and then use the token to connect 'mysql' command tool. All good from the command line, this kind of tells me that I have followed correctly all the steps from [1].
I'm stuck though. Although I can get an authentication token from my lambda, I can't use it to connect to my data base. My lambda is written in Java Script, and the mysql driver I'm using is [3]. This driver seem to not be compatible with IAM authentication. Here is why I think that:
in [1], there is an example for Python, where a mysql driver is being used. In the example, the instructions tell to use
auth_plugin="mysql_clear_password"
and the driver I'm using [3], from docs, I can't find an option that maps to "auth_plugin". The closer, is a flag called PLUGIN_AUTH, but docs for [3] say:
Uses the plugin authentication mechanism when connecting to the MySQL server. This feature is not currently
supported by the Node.js implementation so cannot be turned on. (Default off)
Seems like Node doesn't support this.
This is a piece of my code:
const mysql = require('mysql');
var config = {
host : theHost,
user : theUser,
password : token, --------> token previously generated
database : theDataBase
auth_plugin: "mysql_clear_password", --------> this option is not really part of driver [3], I was just trying
something out
ssl: {
ca: '/var/task/rds-combined-ca-bundle.pem' ----------> cert downloaded from [4]
}
};
var connection = mysql.createConnection(config);
The error I'm getting is:
ERROR error connecting: Error: unable to get local issuer certificate
I have checked that "/var/task/rds-combined-ca-bundle.pem" exists. It is part of the zip package for my function.
If I remove the "ssl" key from the connection object, I get:
error connecting: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol
requested by server; consider upgrading MySQL client
From AWS docs, I can't find a good example of using IAM authentication from a Lambda function implemented in JavaScript. So, my questions are:
If any, can you provide an example of a Lambda function implemented in Java Script of how to connect to Aurora using IAM authentication?
Are you aware if really [3] doesn't support IAM authentication?
Is there any other mysql driver that is really compatible with IAM authentication?
Thanks!
References:
[1] https://aws.amazon.com/blogs/database/iam-role-based-authentication-to-amazon-aurora-from-serverless-applications/
[2] https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.AWSCLI.html
[3] https://www.npmjs.com/package/mysql
[4] https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
a bit late but mysql library has rds certs inside it as standard
so luckily to solve this issue add 'ssl: "Amazon RDS",' which will use the inbuilt certs
so something like this
const signer = new AWS.RDS.Signer({
'region': region,
'username': username,
'hostname':host,
'port': port
});
let token = await signer.getAuthToken({})
var config = {
host : host,
user : username,
password : token, --------> token previously generated
database : database
ssl: "Amazon RDS"
};
see mysql docs for more
https://github.com/mysqljs/mysql#ssl-options
SSL options
The ssl option in the connection options takes a string or an object. When given a string, it uses one of the predefined SSL profiles included. The following profiles are included:
"Amazon RDS": this profile is for connecting to an Amazon RDS server and contains the certificates from https://rds.amazonaws.com/doc/rds-ssl-ca-cert.pem and https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
ps: word from the wise, aws rds to node is a bit tricky, there's lots of other tripropes like permissions, enabling iam, granting iam users to watch out for, create a question and ping me if you have other issues as well and i'll answer them there

ERROR: (gcloud.sql.instances.describe) HTTPError 404: The Cloud SQL instance does not exist, but it does exist?

I'm getting this error:
ERROR: (gcloud.sql.instances.describe) HTTPError 404: The Cloud SQL instance does not exist.
When calling:
gcloud sql instances describe my-project
from my windows cmd within the Google Cloud SDK Shell. However, when I look at my instances on my Google Cloud Platform interface I can see that the corresponding instance. All indicates that it DOES exist. Anyone have a solution?
LundinCast had the right answer in comments. Your problem can be resolved by following the instance name with --project="[projectname]".
Try to run following to list your instances:
gcloud sql instances list

ERROR 1105 (HY000): #07000MySQL Proxy Lua script failed to load. Check the error log

This is my first time using mysql-proxy to learn how to use cryptdb and I am using the ubuntu 12.0.4.3
I have created a proxy using
--proxy-backend-addresses=localhost:3306
--proxy-address=127.0.0.1:3307
However, when I'm trying to connect to this proxy it said that ERROR 1105 (HY000): #07000MySQL Proxy Lua script failed to load. Check the error log.
Does anyone know the reason of this problem?
Thanks for any illumination!
Did you check the path of the lua script? Specify your $EDBDIR by export EDBDIR=<the-path-to-your-lua-file> If you need to.