Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Host port usage check is ineffective #299

Open
unsystemizer opened this issue Apr 30, 2017 · 0 comments
Open

Host port usage check is ineffective #299

unsystemizer opened this issue Apr 30, 2017 · 0 comments

Comments

@unsystemizer
Copy link
Contributor

unsystemizer commented Apr 30, 2017

In https://github.com/CounterpartyXCP/federatednode/blob/master/fednode.py#L36 we look for service ports (and not interfaces):

HOST_PORTS_USED = {
    'base': [8332, 18332, 4000, 14000],
    'counterblock': [8332, 18332, 4000, 14000, 4100, 14100, 27017],
    'full': [8332, 18332, 4000, 14000, 4100, 14100, 80, 443, 27017]

In https://github.com/CounterpartyXCP/federatednode/blob/2.2.2/fednode.py#L221 we stop if we detect a conflict.

        # check port usage
        for port in HOST_PORTS_USED[build_config]:
            if is_port_open(port):
                print("Cannot install, as it appears a process is already listening on host port {}".format(port))
                sys.exit(1)

If I for example have lighttpd at eth0:80, the script will stop, although fednode actually doesn't need that port (it may actually need just br0:80, for example).

This check also makes the --mongodb-interface tweak ineffective. Say my mongodb is listening on 127.0.0.1:27017. Now --mongodb-interface 127.0.0.2 can't help me because the script will still stop anyway. At this point I need to stop mongodb and then run fednode --mongodb-interface 127.0.0.2 to get anywhere but even then this can be dangerous because what if my pre-existing mongodb binds 0.0.0.0:27017? It doesn't by default, but some people may have it configured that way.

But although this check doesn't work very well, I wouldn't change it (to make it check ports on federatednode_default:* bridge, for example) because that would make the script less flexible.
For now I'm just creating this issue to document some workarounds in case people (again) run into this problem (for time being those who know what they're doing can edit the fednode or tweak existing app configs) and for the purpose of brainstorming for later development.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

unsystemizer added a commit to CounterpartyXCP/Documentation that referenced this issue Apr 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant