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

Listen host:port is useless unless you also listen to the local interface #103

Closed
michaelrsweet opened this issue May 16, 2003 · 12 comments
Closed
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.1.19rc5
CUPS.org User: peter.mathiasson

Using Listen is useless unless you also listen to the same port using your local interface (127.0.0.1).

eg.
Port 631
Listen ipp.example.com:80

When use your webbrowser and goto ipp.example.com/printers; and none shows up.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

This is a side-effect of how the authentication information must be passed from the CGI programs; if they didn't use the localhost interface then you wouldn't be able to perform any operation that required authentication.

We'll add documentation to the Listen directive in the SAM concerning this...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: peter.mathiasson

Couldn't it be configured to always connect to localhost to port 631 for instance?

That way, even though I connect to my ethernet interface (ipp.example.com) on port 80, the local communcation could still be performed, if I had at least one port open on the local interface.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

No, since not everyone runs CUPS on port 631.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: peter.mathiasson

I meant make it a configuration option.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

That's the whole point; all you need to do is tell cupsd to listen on localhost as well as the specific address, so there already is a configuration directive...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: peter.mathiasson

What I want is something along the line with the patch I just posted. I don't know if this will break anything, perhaps you can tell me?

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: peter.mathiasson

Should read if (LocalPort) and not if (LocalPort && ServerName) though.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: peter.mathiasson

Better tell you why would I like to do this.
I want to have apache listening on the local interface on port 80 and 443.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

We won't apply the patch to the core CUPS release, as we don't want to add another configuration directive that has limited usefulness.

However, we will look at automatically using the first port that is bound to the loopback address or to the "any" address instead of the connecting port, which will do the same thing without manual configuration and will work with current configurations without changes.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: peter.mathiasson

Yes, you're right. That's a much better idea. I've posted a new patch.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

We're looking at your patch now to make sure that it functions properly on all architectures; the comparison to 0x7f000001 needs to use the ntohl macro/function since the network address is always in network byte order (big endian) and the integer will be in local byte order...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in CVS; we chose to cache the port in StartListening since the port numbers don't change unless you reconfigure...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant