Using Azure Redis Cache with Node.js (for Hubot's brain)? - azure

I am trying to use Azure Redis Cache as the storage for my Hubot's brain.
I have followed the instructions here to configure the Redis brain. I have also tried both SSL and unencrypted connections, as I read here that the Redis Node client does not support SSL.
I also updated the Redis client in my hubot-redis-brain from 0.8.4 to 2.6.2, but my Hubot is still unable to connect to Redis.
Here is a screen shot of the port config in Azure:
And this is the output when my Hubot starts:
[Fri Sep 23 2016 09:00:14 GMT+0100 (GMT Daylight Time)] INFO hubot-redis-brain: Discovered redis from REDISTOGO_URL environment variable
node_redis: Deprecated: The AUTH command contains a "undefined" argument.
This is converted to a "undefined" string now and will return an error from v.3.0 on.
Please handle this in your code to make sure everything works as you intended it to.
[Fri Sep 23 2016 09:00:21 GMT+0100 (GMT Daylight Time)] ERROR hubot-redis-brain: Failed to authenticate to Redis
[Fri Sep 23 2016 09:00:21 GMT+0100 (GMT Daylight Time)] ERROR ReplyError: Ready check failed: NOAUTH Authentication required.
at parseError (C:\projects\hubot-tryout\node_modules\redis-parser\lib\parser.js:163:12)
at parseType (C:\projects\hubot-tryout\node_modules\redis-parser\lib\parser.js:224:14)
Any help on this would be much appreciated.
UPDATE
This is the code I'm using to connect unencrypted:
client = Redis.createClient("6379", "my-host.redis.cache.windows.net" , { auth_pass: "access-key" } )
And this for the encrypted connection:
client = Redis.createClient("6380", "my-host.redis.cache.windows.net" , { auth_pass: "access-key" } ), tls: {servername: 'my-host.redis.cache.windows.net'} })

I would try URL encoding the password. I wonder if you are running into the same problem that is described here for using Azure Redis for PHP Session...
https://azure.microsoft.com/en-us/documentation/articles/cache-faq/#can-i-use-azure-redis-cache-as-a-php-session-cache

Related

Security handshake failed: {"description":"Handshake read failed"}

What version of gRPC and what language are you using?
#grpc/grpc-js - 1.5.10
What operating system (Linux, Windows,...) and version?
server running in a docker container on azure cloud
What did you do?
I have created a grpc server with SSL. It is a test server, where I use self signed certificates for server. The connection between server and client works fine. But I enabled the debug and trace (tcp, http) logs on the server. I keep getting handshake failed error.
I0427 12:07:40.319067700 18 tcp_server_custom.cc:224] SERVER_CONNECT: 0x7f06409cf3a0 accepted connection: ipv4:10.92.0.9:52824
I0427 12:07:40.319239300 18 tcp_custom.cc:353] Creating TCP endpoint 0x7f0640c78430
I0427 12:07:40.319432800 18 tcp_custom.cc:174] TCP:0x7f0640c78430 read_allocation_done: "No Error"
I0427 12:07:40.319503900 18 tcp_custom.cc:191] Initiating read on 0x7f0640c78430: error="No Error"
I0427 12:07:40.331081600 18 tcp_custom.cc:127] TCP:0x7f0640afea60 call_cb 0x7f0641ed57e0 0x7f0640848b90:0x7f0641ed5610
I0427 12:07:40.331206000 18 tcp_custom.cc:131] read: error={"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}
D0427 12:07:40.331327300 18 security_handshaker.cc:176] Security handshake failed: {"created":"#1651061260.331311100","description":"Handshake read failed","file":"../deps/grpc/src/core/lib/security/transport/security_handshaker.cc","file_line":357,"referenced_errors":[{"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}]}
I0427 12:07:40.331412400 18 tcp_custom.cc:287] TCP 0x7f0640afea60 shutdown why={"created":"#1651061260.331311100","description":"Handshake read failed","file":"../deps/grpc/src/core/lib/security/transport/security_handshaker.cc","file_line":357,"referenced_errors":[{"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}]}
D0427 12:07:40.331443800 18 chttp2_server.cc:122] Handshaking failed: {"created":"#1651061260.331311100","description":"Handshake read failed","file":"../deps/grpc/src/core/lib/security/transport/security_handshaker.cc","file_line":357,"referenced_errors":[{"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}]}
### Anything else we should know about your project / environment?
I have an envoy proxy also running for the grpc server to make grpc-web requests.
Node version: node:14-alpine

Linux fetchmail POP3 connection error

Slackware OS, trying to setup fetchmail
I have coded this .fetchmailrc file:
set daemon 600 //fetches mail every hour or 60 minutes.
set logfile /root/fetchmail.log
poll 10.200.***.** protocol POP3
user "bob" password "bob" is "bob" here preconnect "date>>/root/fetchmail.log"
ssl
no rewrite
keep
It worked before but now it is failing to retrieve mail, i checked the fetchmail.log file and i get this error:
Thu Nov 5 10:15:32 GMT 2015
fetchmail: connection errors for this poll:
name 0: connection to 10.200.***.**:pop3s [10.200.***.**/995] failed: Connection refused.
fetchmail: POP3 connection to 10.200.***.** failed: Connection refused
fetchmail: Query status=2 (SOCKET)
I've reset the daemons, ended the process and no progress.
I had exactly the same problem on a Mageia 5 Linux. Apparently, I
solved it by redoing network configuration, which the Mageia can do
with a single click on the relevant Configure button in the Network
Center window.
I did not touch my .fetchmailrc file.

Couchdb Logging

Due to application requirements, I have an externally accessible CouchDB instance. I would like to see what IP addresses are attempting to authenticate with my database. By checking the couchdb.log file, I can see failed authentication attempts. They look similar to this.
[Mon, 29 Sep 2014 13:43:32 GMT] [info] [<0.28472.7>] 127.0.0.1 - - GET
/offline_master/ 401
However, no matter where I connect from, it seems that the IP address that is logged is always 127.0.0.1. Am I mis-understanding how this works? I would really like to see the IP address that is attempting to connect.
The 127.0.0.1 is the address couchDB is bound to. It's there because you can set up couchdb to respond differently depending on what host name is being used.
The only way to get the client ip address is by turning the logging level to "debug". You can do this in the configuration page in futon.
You get records like this (client IP is on 1st line):
[Tue, 30 Sep 2014 00:14:27 GMT] [debug] [<0.451.4>] 'GET' / {1,1} from "192.168.1.52"
Headers: [{'Accept',"*/*"},
{'Host',"localhost:5984"},
{'User-Agent',"curl/7.30.0"}]
[Tue, 30 Sep 2014 00:14:27 GMT] [debug] [<0.451.4>] OAuth Params: []
[Tue, 30 Sep 2014 00:14:27 GMT] [info] [<0.451.4>] 127.0.0.1 - - GET / 200
Be careful with this. The debug logs are extremely verbose. It doesn't take long to fill up a hard drive.
It is possible to set log levels by module. The module you need to set is couch_httpd. Set the default for the rest to "error" or "fatal".
See: 3.6.2 Per module logging

Custom logging in couch.log from couchapp?

Is it possible to write in the couchdb server log (the one defined by default.ini or local.ini in [log]) from a couchapp? (But from somewhere else than a view)
If that's not possible, maybe there's a workaround which would allow to log successful or unsuccessful authentication attemps in the couchdb server log? I'd like to process this server side and would like to avoid logging all httpd activity and grepping for user logging patterns, which doesn't seem to be easy or pretty...
Cheers,
Jun
A year later I find that it was in fact possible to log from views (or lists or any Javascript Design Doc functions) using the log() function: http://docs.couchdb.org/en/1.6.1/query-server/javascript.html#log
log(message)
Log a message to the CouchDB log (at the INFO level).
Arguments:
message – Message to be logged
function(doc){
log('Procesing doc ' + doc['_id']);
emit(doc['_id'], null);
}
After the map function has run, the following line can be found in CouchDB logs (e.g. at /var/log/couchdb/couch.log):
[Sat, 03 Nov 2012 17:38:02 GMT] [info] [<0.7543.0>] OS Process #Port<0.3289> Log :: Processing doc 8d300b86622d67953d102165dbe99467
Who would have guessed :)
I'm pretty sure you can't write to couch.log from a view, it's a sandboxed system.
Getting a record of connections to the server is possible though. Here's a dump from my couch.log, with an HTTP error in there:
/
[Sat, 13 Sep 2014 08:18:57 GMT] [info] [<0.160.0>] Opening index for db: test idx: _design/ivet sig: "f6b64ef8593e23cac644c13b895b7607"
[Sat, 13 Sep 2014 08:18:57 GMT] [info] [<0.121.0>] 127.0.0.1 - - GET /test/_design/ivet/_view/medicationWHP/foobar?include_docs=true 200
[Sat, 13 Sep 2014 08:18:57 GMT] [info] [<0.121.0>] 127.0.0.1 - - GET /test/_design/ivet/_view/medicationWHP/foobar?include_docs=true 500
[Sat, 13 Sep 2014 08:18:57 GMT] [error] [<0.121.0>] httpd 500 error response:
{"error":"json_encode","reason":"{bad_term,{key,null}}"}
[Sat, 13 Sep 2014 08:19:05 GMT] [info] [<0.36.0>] Apache CouchDB has started on http://127.0.0.1:5984/
You can see it has the VERB PATH CODE format for each line, so you can filter that for whatever you need. (Unauthorized is 401) You can also access the log through /_log. Details on that are here:
http://docs.couchdb.org/en/latest/api/server/common.html#log
To get all that information, you'll need to have the log level set to info. You can do this at the config screen in futon.
To do it server-side, you'd probably need to use node.js or something like that. Just have it consume the /_log endpoint, and filter each line by the HTTP response code.

Hubot-hipchat works 1-1 chat but not on a room

Whenever I throw a command at hubot in a room i.e #hubot help I get nothing, but typing help in 1-1 chat works fine, am I missing something? has anyone else had this problem??
i have followed the setup instructions to the tee, and it still wont work
Did you end up specifying a host? I was having a similar problem, and removing the hostname fixed it. See the GH issue here:
https://github.com/github/hubot/issues/651
In my case, I could see in the logs that Hubot was receiving the commands, and even replying with the correct response, but the response was never showing up in the channel:
In the chat room (no visible in-room response):
#hubot ping
[Mon Feb 24 2014 02:04:21 GMT+0000 (UTC)] DEBUG Message '[object Object]' matched regex //^[#]?hubot[:,]?\s*(?:PING$)/i/
[Mon Feb 24 2014 02:04:21 GMT+0000 (UTC)] DEBUG OUT >
<message to="XXXXXX_hubot_test#conf.hipchat.com" type="chat" from="XXXXXX_XXXXXX#chat.hipchat.com/hubot-hipchat">
<inactive xmlns="http://jabber/protocol/chatstates"/>
<body>PONG</body>
</message>
In 1:1 messages:
[Mon Feb 24 2014 02:06:01 GMT+0000 (UTC)] DEBUG Message '[object Object]' matched regex //^[#]?hubot[:,]?\s*(?:PING$)/i/
[Mon Feb 24 2014 02:06:01 GMT+0000 (UTC)] DEBUG OUT >
<message to="XXXXX_188883#chat.hipchat.com" type="chat" from="XXXXXXXX#chat.hipchat.com/hubot-hipchat">
<inactive xmlns="http://jabber/protocol/chatstates"/>
<body>PONG</body>
</message>
I think the issue is that it uses chat.hipchat.com for 1:1 chat, and conf.hipchat.com for rooms. If you specified a specific hostname, you'll get one or the other, but not both.
If you set the environmental variables via CLI, to unset it, do
unset HUBOT_HIPCHAT_HOST.
Have you only tried: #hubot help? You can set up your prefix via: Here It does say that the
For example, the HipChat Adapter converts #hubot into hubot: before passing it to Hubot.
But I'd go ahead and try the following. Also attempt to try it locally via bin/hubot running it via the shell.
Hubot help
hubot help
Not to mention check heroku logs to make sure that hubot is showing up in your hipchat channel correctly.
Hope this helps.

Resources