Koozali.org: home of the SME Server

open port for new service

Offline kropek

  • *
  • 5
  • +0/-0
open port for new service
« on: July 31, 2013, 04:07:38 AM »
I've installed couchdb on sme server 8 via epel.

I want to open port 5984 to both public and internal networks.

First I tried to do this via the server manager- port forwarding utility. I set both source and destination ports to 5984, and localhost as the destination host ip address. I tested the results with curl http://localhost:5984 and remotely via http://<tld>:5984. This did not work (I received no response from the server) in either case.

Next, I looked at the example solution for setting up a tomcat server (http://wiki.contribs.org/Tomcat), since it looked like the tomcat and couchdb installs are reasonably similar. Similar in that both place scripts in /etc/rc.d/init.d/, and copy them to /etc/rc.d/rc#.d/, etc.

I then tried running:
config set couchdb service access public status enabled TCPPort 5984
signal-event remoteaccess-update

There were no errors after doing this, and I can see the key is present in config, but I'm still not able to access couchdb remotely.

I'm wondering

1) if anyone can explain why the port forwarding solution won't work (I have verified my couchdb server is running on sme, and can curl http://localhost:5984 and get a valid response)?
2) whether the port forwarding solution or config solution is preferable for a service running on sme?

Any help would be really appreciated.


Offline larieu

  • *****
  • 214
  • +0/-0
Re: open port for new service
« Reply #1 on: July 31, 2013, 07:15:21 AM »
Did you stop the port forwarding made in first attempt pripr to the second config?
if everybody's life around you is better, probably yours will be better
just try to improve their life

Offline kropek

  • *
  • 5
  • +0/-0
Re: open port for new service
« Reply #2 on: July 31, 2013, 07:19:37 AM »
thanks for your response.

yes, i removed the port forwarding configuration prior to attempting the second, config solution.

Offline Daniel B.

  • *
  • 1,700
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: open port for new service
« Reply #3 on: July 31, 2013, 10:50:47 AM »
Are you sure couchdb is listening on the external interface, and not just the internal one ?

The config command you used (config set couchdb service etc...) seems OK, you can check the Firewall has inserted a rule by looking at the output of:

Code: [Select]
iptables -L -vn | less

To check the service is listening, try to run:

Code: [Select]
netstat -laputen | grep 5984

You should see on which IP the service is listening, which should be 0.0.0.0:5984 if the service is listening on any IP/interface
C'est la fin du monde !!! :lol:

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: open port for new service
« Reply #4 on: July 31, 2013, 01:08:06 PM »
From this serverfault post, I suspect that couchdb listens on 127.0.0.1 by default:
http://serverfault.com/questions/79453/why-cant-i-access-my-couchdb-instance-externally-on-ubuntu-9-04-server

As I read the solution in that post, you need to change 'BindAddress' from 127.0.0.1 to 0.0.0.0 in couch.ini, then stop and restart the service.

Offline kropek

  • *
  • 5
  • +0/-0
Re: open port for new service
« Reply #5 on: August 01, 2013, 07:41:31 AM »
 Fixed! Thanks for your help!

I made the change to couch.ini and restarted the service- thanks for the tip mmccarn.

I verified the change via netstat and iptables commands - thanks Daniel B!