Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use destination port for Service Endpoint List matching #120

Closed
ppacher opened this issue Aug 6, 2020 · 3 comments
Closed

Use destination port for Service Endpoint List matching #120

ppacher opened this issue Aug 6, 2020 · 3 comments
Labels
suggestion TYPE: idea for new feature or improvements

Comments

@ppacher
Copy link
Contributor

ppacher commented Aug 6, 2020

What I wanted to do:

I tried to use the "Service endpoint list" configuration option to allow inbound SSH connection to my machine. I want to allow inbound connections to tcp/22 from any host as well as any localhost-only traffic.

What I expected to happen:

I expected that the following settings value would allow inbound SSH from everywhere and all localhost-only traffic:

+ * tcp/22, + localhost, - *

What happened instead

Instead, I encountered multiple issues:

  1. + localhost (+ Localhost; the default) is an invalid value (regex mismatch). It seems like + localhost. (notice the dot at the end) does work. So even the default value is invalid.

  2. + * tcp/22 does not allow inbound SSH connections. Instead, it allows inbound connections to every port only if the connection source used tcp/22 as the source port. This behavior does not make any sense at all for incoming connections.

How to reproduce it (as minimally and precisely as possible):

Described above.

@ppacher ppacher added the bug TYPE: a report on something that isn't working label Aug 6, 2020
@dhaavi
Copy link
Member

dhaavi commented Aug 7, 2020

Ah. Regex. 😁

  1. I am pretty sure that the regex is in fact correct. I present my evidence:
    a) Works for me. 😂 🤷‍♂️
    b) If the default value would not match, the config system would refuse to register the option: https://github.com/safing/portbase/blob/2b726810cc95ab2954c4446f6e1125ad21f8f06f/config/registry.go#L38

  2. This was actually implemented as you expected it in Portmaster v0.3.x. During the big v0.4 revamp this logic we re-implemented to fit the new uniform configuration system. I left the logic for inbound and outbound matching the same, because I did not expect ports to be used for inbound connections, as you would normally always set this on a specific program, like sshd, and not globally.

@dhaavi
Copy link
Member

dhaavi commented Aug 12, 2020

Relabeling as a feature as the current functionality is as desired, but can be improved.

@dhaavi dhaavi added suggestion TYPE: idea for new feature or improvements and removed bug TYPE: a report on something that isn't working labels Aug 12, 2020
@dhaavi dhaavi changed the title Multiple issues with Service endpoint list (incoming connection management) Use destination port for Service Endpoint List matching Aug 12, 2020
@dhaavi
Copy link
Member

dhaavi commented Feb 11, 2022

This has been implemented a while ago.

@dhaavi dhaavi closed this as completed Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion TYPE: idea for new feature or improvements
Projects
None yet
Development

No branches or pull requests

2 participants