Pubnub invalid timestamp - pubnub

I always get this from my console, whenever I use PAM and grant.
Object {message: "Invalid Timestamp"}
I already setup NTP to my ubuntu server but still nothing change.
my pubnub grant is here:
pubnub.grant({
channel : channel,
callback : function (m) { console.log("grant success: ", m); },
error : function (m) { console.log("grant error: ", m); },
ttl : 5, // Minutes
read : true,
write : false,
auth_key : 'auth_key_here'
});
What is wrong with my code? Thanks for the help.

please follow the given steps to setup NTP server for the pubnub.
Step 1 Installation NTP
$ sudo apt-get update
$ sudo apt-get install ntp
Step 2 Edit ntp.conf
Replace these four with pubnub server
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
to
server 0.pubsub.pubnub.com
server 1.pubsub.pubnub.com
server 2.pubsub.pubnub.com
server 3.pubsub.pubnub.com
Step 3 Restart NTP Service
$ sudo service ntp restart

Related

Connection error in AWS RDS SSL in NodeJS

I am trying to connect to RDS through Lambda NodeJS 12.x with SSL. However I am receiving these errors:
Error: 4506652096:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:
library: 'SSL routines',
function: 'ssl_choose_client_version',
reason: 'unsupported protocol',
code: 'HANDSHAKE_SSL_ERROR'
I am connecting like this:
const pool = mysql.createPool({
connectionLimit : 10,
host : 'db.cqgcxllqwqnk.eu-central-1.rds.amazonaws.com',
ssl : {
ca : fs.readFileSync(__dirname + '/rds-ca-2019-root.pem')
},
user : ‘xxxxx’,
password : ‘xxxxxx’,
database : ‘xxxxxx’,
multipleStatements : true
});
When I connect with the certificate through MySql Workbench everything works just fine.
Any idea on how to solve this?
Thanks a lot!
The problem was related to Mysql version and TLS version. This matrix shows that for MySQL 5.6 only TLS 1.0 is supported. Node.js 12 by default uses TLS 1.2.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.SSLSupport
Do this before connect as this have insufficent permission over file
sudo chmod 755 rds-combined-ca-bundle.pem
Warning: keep a strong password, this password easily guessable
if you still find problem, check IAM permission to lambda or check whether both RDS and lambda in same VPC.

puppet Forbidden request /puppet-ca/v1/certificate/ca

I'm not able to make a puppet node join a master, i'm using puppet enterprise on AWS cloud.
Master
puppetserver --version
puppetserver version: 2017.3.0.38
Node
# puppet agent --test
Error: Could not request certificate: Error 403 on SERVER: Forbidden request: /puppet-ca/v1/certificate/ca (method :get). Please see the server logs for details.
Exiting; failed to retrieve certificate and waitforcert is disabled
obviously error message is related to permission on master side, when i check the log on the master i see
ERROR [qtp2147089302-255] [p.t.a.rules] Forbidden request: 10.0.10.224 access to /puppet-ca/v1/certificate/ca (method :get) (authenticated: false) denied by rule 'puppetlabs certificate'.
but i checked that the new HOCON format for auth.conf is allowing un authenticated node to send CSR
{
"allow-unauthenticated": "*",
"match-request": {
"method": "get",
"path": "/puppet-ca/v1/certificate/",
"query-params": {},
"type": "path"
},
"name": "puppetlabs certificate",
"sort-order": 500
}
i checked also that pe-puppet-server.conf is not using the legacy auth.conf method
# (optional) Authorize access to Puppet master endpoints via rules specified
# in the legacy Puppet auth.conf file (if true or not specified) or via rules
# specified in the Puppet Server HOCON-formatted auth.conf (if false).
use-legacy-auth-conf: false
max-active-instances: 2
max-requests-per-instance: 0
environment-class-cache-enabled: true
please advise, the same error msg occurs on both windows and linux
i did reboot the entire server(ec2 instance) since reloading puppetserver didn't help ... i also did the auth change from the console, as structed here
windows Puppet agent does not connect to the awsopsworks puppet Enterprise master
I had a similar issue when trying to setup my puppet nodes, but was using Vagrant instead of AWS.
The fix was to unset the following environment variables: http_proxy, https_proxy, HTTP_PROXY and HTTPS_PROXY.
My fix was to remove server_list from puppet.conf, cleanup CM cert and re-generate cert. In my case I have autosign=true so the process was:
Stop PE on CM:
systemctl stop puppet pxp-agent pe-puppetserver pe-puppetdb
Remove ssl dir
rm -fr /etc/puppetlabs/puppet/ssl
Cleanup cert from Primary:
puppetserver ca clean --certname='<CM>'
Run puppet agent on CM
puppet agent -t
Done.

node-ansible fails to connect to the host when multiple connections coexist

I have an API server which may trigger multiple node-ansibles simultaneously to connect to a remote machine to do something.
Here's the node.js code:
// app.js
const Ansible = require('node-ansible')
let ansibleNum = 10
for (let i = 0; i < ansibleNum; i += 1) {
let command = new Ansible.Playbook().playbook('test')
command.inventory('hosts')
command.exec()
.then(successResult => {
console.log(successResult)
})
.catch(err => {
console.log(err)
})
}
And the ansible playbook:
# test.yml
---
- hosts: all
remote_user: ubuntu
become: true
tasks:
- name: Test Ansible
shell: echo hello
register: result # store the result into a variable called "result"
- debug: var=result.stdout_lines
As ansibleNum increases, the probability of the failure of ansible playbook also increases.
The failure message is:
fatal: [10.50.123.123]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Shared connection to 10.50.123.123 closed.\r\n", "unreachable": true}
I've read another similar question here, but the solutions provided by it doesn't work in my case.
Another way to trigger the problem is by executing
ansible-playbook -i hosts test.yml & ansible-playbook -i hosts test.yml.
This command runs ansible without node.js.
I've pushed the code to github. You can download it directly.
Anyone knows why the shared connection got closed?
I've set ControlMaster argument to auto by following the document here.
It's strange that setting the connection type to paramiko solves my problem.
Here's the config file located in ~/.ansible.cfg:
[defaults]
transport = paramiko
Based on this document, it seems that paramiko doesn't support persistent connection.
I'm still confused about why this setting solves my problem.

Error connecting Remote Oracle database in Node.js

I am new to NodeJS. I am unable to connect remote Oracle database using node-oracledb and getting following error.
ORA-01017: invalid username/password; logon denied
Now, the twisting part is, using same connection detail, I can able to connect Oracle Remote Database using SQLDeveloper app.
I have install Nodejs using Brew on Mac OS X El Capitan and Oracle instant client 12.1.
I also tried SqlPlus but unable to connect Oracle remote database.
The firewall is also turned off. Following code is working on another Mac OS X El Capitan with same configuration.
oracledb.getConnection(
{
user : “phtest",
password : "Ahora#dev0000”,
connectString : “MYSEREVER/AMITDEV"
},
function(err, connection)
{
if (err) { console.error(err.message); return; }
connection.execute(
"SELECT * " +
"FROM OT_Category_Master",
function(err, result)
{
if (err) { console.error(err.message); return; }
res.json(result.rows);
});
});
The OS X 12.1 Instant Client was patched yesterday to fix a problem connecting to older DBs with case sensitive passwords. The symptom was ORA-01017. Re-download Instant Client and try again.
I update my announcement blog post to mention this.

can't launch nodejs program, socket : (87) the parameter is incorrect

i have installed nodejs on my windows 7 ultimate x64.
The installation was successful but when i tried to open the command line and type npm or node its show this message:
socket: (87) The parameter is incorrect. Your environment has been
set up for using Node.js and npm.
C:\Users\Serge>node socket: (87) The parameter is incorrect.
C:\Users\Serge>npm socket: (87) The parameter is incorrect. socket:
(87) The parameter is incorrect.
C:\Users\Serge>
do not hesitate to leave your comments.
thank you!
Try these steps:
1.Open Command Prompt as Administrator
2.Run netsh winsock reset

Resources