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

Host port usage check is ineffective #299

@unsystemizer

Description

@unsystemizer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions