BOSH module not started: Ejabberd / Strophe setup issue [closed] - xmpp

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Am trying to setup Strophe with Ejabberd on Ubuntu 12 (Linode latest version) using the internal Ejabberd webserver to serve the chat.
The test urls (http-bind and admin) both work.
JWChat works.
Strophe throws an error:
In Strophe:
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='internal-server-error'>BOSH module not started</body>
In ejabberd.log:
E(<0.468.0>:ejabberd_http_bind:1236) :
You are trying to use BOSH (HTTP Bind) in host "admin", but the module mod_http_bind is not started in that host.
Configure your BOSH client to connect to the correct host, or add your desired host`
Setup has been straightforward (though it took quite a while to work this out):
Installed using sudo apt-get
Running under sudo
Using the internal server, to avoid messing with proxies or setting up PunJab.
In ejabberd.cfg made changes.
Changes to ejabberd.cfg:
%% In listening ports, amended the following lines:
{ request_handlers, [
{["pub"], mod_http_fileserver},
{["http-bind"], mod_http_bind}
]},
%% In modules, added the following:
{ mod_http_fileserver, [
{docroot, "/var/lib/ejabberd/www"},
{accesslog, "/var/log/ejabberd/access.log"}
]},
{mod_http_bind, []},
Any help would be much appreciated.

The answer is rather obvious.
Strophe requires the username in the following format:
username#host
eg. admin#example.com
It otherwise assumes that the username is really the host, and since such a host doesn't exist, it throws an error that mod_http_bind is not started in that host
This error is misleading at best, but it does technically explain the issue.
I was trying to login with just the username [which worked fine in JWChat], hence the issue.
In case this doesn't work, a checklist of some of the other things to verify:
Make sure that your domain is added to /etc/hosts
127.0.0.1 localhost.localdomain localhost
12.34.56.78 squire.example.com squire
Make sure that your domain is added to /etc/ejabberd/ejabberd.cfg
%% Hostname
Hostname {hosts, ["example.com","98.765.43.21","localhost"]}.
Ensure that your username exists and is registered:
ejabberdctl register username example.com password
And if user is an admin, is included in ejabberd.cfg [Note: it must also be registered!]
%% Admin user
{acl, admin, {user, "", "localhost"}}.
{acl, admin, {user, "admin", "example.com"}}.
Check that the server is running:
a. sudo ejabberdctl status
b. http://example.com:5280/admin
c. http://example.com:5280/http-bind
If there are issues, restart using both (I know you don't need both in theory. In practice, sometimes using one or the other would not work right.)
sudo /etc/init.d/ejabberd restart
sudo ejabberdctl restart
Check the logs - /var/log/ejabberd/ejabberd.log (see here).
Install JWChat and try that (or, if you have JWChat, install Strophe).
The following short tutorial is invaluable, follow it exactly: http://www.ejabberd.im/jwchat-localserver

Related

VSCode remote debugging on NextCloudPi not working because SSH connection failed

Not really a question but already the answer. Just to save others from spending days on this task.
What I want to do
I want to extend the basic NextCloudPi image with some custom websites including PHP. For ease use of remote debugging I am using VSCode and Xdebug.
The Problem was
I can't get a SSH connection to my raspi from VSCode and therefore also PHP debugging didn't work. SSH connection to the raspi worked well with other tools (putty, PowerShell etc.). Also Xdebug was set properly on the raspi (according to phpinfo();). In the log of the ssh-plugin of VSCode the following error appeared:
Failed to set up socket for dynamic port forward to remote port 37399: Socket closed. Is the remote port correct?
Relevant Versions
NextCloudPi 1.36.3
Xdebug 3.0.4
VSCode 1.60.2 (RemoteSSH 0.65.8, PhpDebug 1.19.0)
The Solution is
After spending evenings of googling I found out that the TCP port forwarding of the raspi's SSH service has to be enabled which is not in the basic nextcloudpi-image. This thread gave me the final clue: VSCode Remote SSH Connection Failed
So just set in /etc/ssh/sshd_config AllowTcpForwarding to yes and everything should work as easy as described in all the manuals.

Yarn: Error: connect ECONNREFUSED 127.0.0.1:443

When I install ELM via yarn, I get
-- ERROR -----------------------------------------------------------------------
Something went wrong while fetching the following URL:
https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz
It is saying:
Error: connect ECONNREFUSED 127.0.0.1:443
NOTE: You can avoid npm entirely by downloading directly from:
https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz
When I manually browse to https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz. I get
However other people can access the link and it downloads the file.
EDIT:
HOSTS File:
127.0.0.1 view-localhost # view localhost server
127.0.0.1 mydevsnapcap.com www.mydevsnapcap.com app.mydevsnapcap.com internal.mydevsnapcap.com
0.0.0.1 mssplus.mcafee.com
Edit
This use to work a few days ago.
More tests:
I cannot access it from my phone and pc using my fibre connection, but I can access it on both my phone and mobile using my mobile connection.
It turns out that it was my ISP that was for some reason blocking the link. I switch to using the google dns and all is good in the hood: https://developers.google.com/speed/public-dns/docs/using
Something in your computer or on your network is resolving the domain github.com to 127.0.0.1, i.e. localhost. Hence, everytime you attempt this access, it tries to reach a service running on the very same computer you're making the request from.
Check your DNS settings.
Check that there are no entries for github.com in the hosts file (on Windows C:\Windows\System32\drivers\etc\hosts, everywhere else /etc/hosts).
If you're running something like Pi-Hole on your network, check, that it doesn't catch github.com

How to get MONGO_URL from command line Meteor Up deployment?

I am currently deploying to Digital Ocean using Meteor Up. If I don't specify a MONGO_URL in the mup.json, can I get the value from the command line while the website is running, i.e. I don't want to shutdown the site?
If I go to the app directory and run meteor mongo --url, I get the following error:
mongo: Meteor isn't running a local MongoDB server.
This command only works while Meteor is running your application
locally. Start your application first. (This error will also occur if
you asked Meteor to use a different MongoDB server with $MONGO_URL when
you ran your application.)
If you're trying to connect to the database of an app you deployed
with 'meteor deploy', specify your site's name with this command.
Even if I run the app from the app directory, it will only give the localhost MONGO_URL. I need the MONGO_URL for the deployed app.
I have also taken a look at a similar question as suggested by some of the answers. I disagree that it is "impossible" to get the MONGO_URL without some other program running on the server. It's not as if we are defying the laws of physics here, folks. Fundamentally, there should be a way to access it. Just because no one has yet figured it out doesn't mean it is impossible.
meteor mongo --url should return the URL.
Try opening another shell in the app directory and running that command.
Meteor Up packages your app in production mode with meteor build so that it runs via node rather than the meteor command line interface. Among other things, this means meteor foo won't work on the remote server (at least not by default). So what you're really looking for is a way to access mongo itself remotely.
I recently set up mongo on an AWS EC2 instance and listed some lessons learned here: https://stackoverflow.com/a/28846703/2669596. Some details of how you do it are going to be different on Digital Ocean, but these are the main things you have to take care of once mongo itself is installed:
Public IP/DNS Address: This is probably fine already since you can deploy to the server.
Port Security Rules: You need to make sure port 27017 is open for TCP access, at least from your IP address. MongoDB also has an http interface you can set up; if you want to use that you'll need to open 28017 as well.
/etc/mongod.conf (file location may differ depending on Linux flavor):
Uncomment port=27017 to make sure you have the default port (I don't think this is actually necessary, but it made me feel better and it's good to know where to change the default port...).
Comment out bind_ip=127.0.0.1 in order to listen to external interfaces (e.g. remote connections).
Uncomment httpinterface=true if you want to use the http interface.
You may have to restart the mongod host via sudo service mongod restart. That's a problem if you can't have downtime, but I don't know of a way around that if you change the config file.
Create User: You need to create an admin and/or user to access the database remotely.
Once you've done all of that, you should be able to access the database from your local machine (assuming you have the mongo client installed locally) by running
mongo server.url.com:27017/mup-app-name -u username -p
where server.url.com is the URL or IP address of your remote server, mup-app-name is the appName parameter from your mup.json file, username is the user you created to access the database, and you'll be prompted for that user's password after you run the command (or you could put it after -p on the same line, depending on the password).
There may also be a way to do this by setting up nginx to reverse-proxy 127.0.0.1:27017 on your remote server, but I've never done it and that's just me speculating.

ssh-agent across ssh sessions on shared host [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I ssh into a shared host (WebFaction) and then use ssh-agent to establish a connection to a mercurial repository (BitBucket). I call the agent like so:
eval `ssh-agent`
This then spews out the pid of the agent and sets its relevant environment variables. I then use ssh-add as follows to add my identity (after typing my passphrase):
ssh-add /path/to/a/key
My ssh connection eventually times out and I'm disconnected from the server. When I log back in, I can no longer connect to the Hg server and so I do this:
ps aux | grep 1234.*ssh-agent`
kill -SIGHUP 43210
And then repeat the two commands at the top of the post (ie. invoke the agent using eval and call ssh-add).
I'm sure that there's a well established idiom for avoiding this process and maintaining a "reference" to the agent that was spawned initially. I've tried redirecting I/O of the first command to a file (in the hope of sourcing it in my .bashrc), but I only get the agent's pid.
How can I avoid having to go through this process each time I ssh into the host?
My *NIX skills are weak, so constructive criticism on any aspect of the post is welcome, not just my use of ssh-agent.
Short answer:
With ssh-agent running locally and identities added, ssh -A user#host.webfaction.com provides the secure shell on the remote host with the local agent's identities.
Long answer:
As Charles suggested, agent forwarding is the solution.
At first, I thought that I could just issue an ssh user#host.webfaction.com and then, from within the secure session on the remote host, connect to the BitBucket repository using hg+ssh. But that failed, and so I investigated the ForwardAgent and AgentForwardingEnabled flags.
Thinking that I'd have to settle for a workaround in .bashrc that involved keeping my private key on the remote host, I went looking for a shell-script solution but was spared from this kludge by this answer in SuperUser, which is perfect and works without any client configuration (I'm not sure how the sshd server is configured on WebFaction).
Aside: in my question, I posted the following:
ps aux | grep 1234.*ssh-agent`
kill -SIGHUP 43210
but this is actually inefficient and requires the user to know his/her uid (available via /etc/passwd). pgrep is much easier:
pgrep -u username process-name

Mac OS X ignoring hosts file [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Mac seems to be ignoring new changes to my hosts file. Older changes work without a problem. I've spent the past 4 hours trying to figure this one out. Help!
I have folders for each site that I develop in my /Sites folder. For example, several folders are named:
wp.dev
daf.dev
test.dev
I run MAMP, set the Apache Port to 80 and the MySQL Port to 3306 (so that I don't have to add the port to the address bar in a browser).
I have edited my /private/etc/hosts file as follows:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 wp.dev
127.0.0.1 daf.dev
127.0.0.1 test.dev
fe80::1%lo0 localhost
Here's the kicker: wp.dev and daf.dev have been around for over a month. They resolve without a problem in my browser. I added test.dev this morning. When I type it into a browser it simply searches "test.dev" as opposed to resolving a domain.
I can ping any of the above domains and they go to 127.0.0.1, including test.dev.
For what it's worth, I've tried virtualhostsx with the same problem. I also run dscacheutil --flushcache and restart MAMP when making changes.
I need to kick off development on a new site, and this is driving me crazy.
Try putting all your entries at the top of the file.
Not really logical, but worth a try.