Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services...


And then they might code up some sort of service lookup tool thingy to use on the train wreck that is the modern web.

  $ getent services gopher
  gopher               70/tcp


And if they want name resolution, maybe even names that reflect the scope of its location like .localhost or .internal


Various services have existed, such as portmap(8), though NFS and similar services have often suffered from the "too complicated to debug" problem where devops (then sysadmins) would try turning the system off and then back on again in the hopes of resolving the issue du jour. You might get lucky and determine that node number three (of many) was cursed and leave it switched off for the Season of Mammon, more commonly known as Christmas, and to retire it quietly, later. Hypothetically.

Generally host and port mapping gets shoved somewhere into the configuration management layer and hopefully does not become too complicated (or have too many security holes) as this could vary from "configuration files and a few scripts" to database and services layers that few can debug, especially not a sysadmin at 3 AM in the morning running on an hour of bad sleep. Hypothetically.


but you want security, so NIS+


Heck, maybe even `resolvectl service`?


this is a nice idea, but idk why, in macos if i do `nc -l 127.0.0.1 gopher` and then try to open url "http://127.0.0.1:gopher/" - safari does not open it, no requests visible in the `nc` output.

also `curl -v http://127.0.0.1:gopher/` gives error message

  * URL rejected: Port number was not a decimal number between 0 and 65535
  * Closing connection
  curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
so the ports are named, it is nice, but in practice it does not make life easier.


> http://...:gopher

is it http or gopher? :)


i chose gopher port just as an example. try with any other service name mapped to a port number from /etc/services and the result will be the same. the OP's goal was to use many http/https services, so we are talking about many http(s) services.

i just wanted to make the point that even if you have service names in /etc/services, it is not possible to use that names easily to host/access http(s) services.


The names are the kind of servers that listen on those ports (by default) like ssh, telnet, http, and smtp. They are not subdomains or for URI parsing.


URI contains ":port" tho, but practically it is only digital number.

the OP made a tool which helps them to avoid using port numbers. people commented in a way that looked like laughing at him, like he reinvented the wheel, and talking about /etc/services. well ok, i decided to try using /etc/services for the purpose of using names instead of port numbers.

would it be possible to add "myapp 60001/tcp" to /etc/services and then work with "http://localhost:myapp"? NO! browsers do not translate these names into port numbers. netcat does. curl does not.

so probably the OP's solution is not that questionable and really solved their need? and "good old friend /etc/services" is not useful for this? i dont know what it is useful for as running services on non-standard ports actually helps with hiding from security/vuln scanners and is practiced widely.


Maybe the joke has gotten too far, but the point that most people have been trying to say is that the issue that the OP is trying to solve has been solved for years. It's called a reverse proxy. Doing the configuration automatically like OP does does not alter the fact that it is a reverse proxy. `/etc/services` serve a different purpose.

Also URL parsing is a completely different matter. Browsers are primarily an HTTP(s) client. If you do not mention the ":port", it will try to connect to 80 (HTTP) or HTTPS (443). Because that the default ports for a web server. Other services have different port. So if your URL has the ftp scheme, the default port would be 21.


I know you're trying to be funny but ... technically it's 100% clear: You should talk HTTP, because that's the URL scheme here. The port makes no difference. You just happened to use a port by name. For all we know I run my HTTP server on some NFS related port so all the script kiddies try all the wrong exploits on it or something ;)


Well, the entire context of this is https so anything else is immaterial. The only reason it would be gopher is if you didn't read the post or don't understand the basics of https.


This is not possible since it is ambiguous. It is impossible to parse “http://127.0.0.1:gopher/“ since that would be valid as either “scheme://user:host/“ or “scheme://host:portname/“.

http://127.0.0.1:70/“ is unambiguous since 70 is not a valid host.


Sounds like you need an AI agent that can determine whether http and gopher are the same protocol


if you configure sshd to listen on port 443, does it become an https server? i was just trying to demondtrate: pick any port from /etc/services and try to use the name instead of port number. no, it does not work well when trying to use for local-hosting http(s) services. so to address the irony and sarcasm of the messages i was replying to:

  zdw: It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services...

  tolciho: And then they might code up some sort of service lookup tool thingy to use on the train wreck that is the modern web.
  $ getent services gopher
  gopher               70/tcp


Many clients also do not support getservent(3) or portmap or DNS SRV records or NIS or LDAP or ActiveDirectory so one might wonder why there are so many half-baked, failed, or overy complicated attempts at solving whatever the problem is here even before "AI has entered the chat".


As bandie pointed out, you‘re explicitly making a http request. Duh.

nc is for generic connections and handles it well.


i know, but the OP's goal was to host/access http(s) services with names and avoid port numbers, and gopher service name was chosen by me as an example. my point was that /etc/services cannot be used for the OP's need.

if you host an http(s) service on port 11111 you can reach it with url http://127.1:11111, but url http://127.1:vce/ would not work in most software.

  $ grep 11111 /etc/services
  vce  11111/udp   # Viral Computing Environment (VCE)
  vce  11111/tcp   # Viral Computing Environment (VCE)


If I curl my phone number it doesn't connect, that's strange


can you please explain what you mean by this? because technically i do not see any similarity in this "analogy".


But if you want to contact vce, why use „http“? It‘s not going to work


Try http://127.0.0.1:hkp instead of http://127.0.0.1:11371 for an OpenPGP HTTP keyserver. HTTP will work, but using the service name won't. Does that make what they're trying to say clearer?


the question was "can we use port names from /etc/services instead of port numbers?"

how about "ssh://git@ssh.github.com:https/golang/go.git" instead of "ssh://git@ssh.github.com:443/golang/go.git"? does not work, hmm.


Perhaps we could even make the file the port itself, perhaps calling it a “socket”? A “unix socket” would be a great name. If we could place all these files behind a local reverse proxy then we could use localhost/jekyll or localhost/fastapi. It’s just a dream


That would mean not being able to vibe code up an entire app to deal with something as insurmountable as looking at a list of numbers and post it on HN for those sweet, sweet upvotes. Why would they not do that.


Sure, but they are running web-apps they've vibe-coded (hence the .vibe tld) and for that use-case of many web apps that I run in docker containers I use nginx-proxy [0]. All the container needs is a VIRTUAL_HOST environment variable with the domain and what my router needs is an address entry for the wildcard subdomains. I even have nginx-proxy on a internet-accessible staging server.

[0] https://github.com/nginx-proxy/nginx-proxy


If the port number space was bigger, I wonder if we would have gotten a global naming service (ala DNS) for unique service names.

You can still publish port numbers along with addresses in DNS though (SRV records).


This is exact problem I see with all of those vibe coded software: In few years everything will be super fragmented, everyone will be using their own set of tools, or vibe coding them, themselves. Communication between teams or even between team members will become very hard because of those differences. 'What do you mean production is down? On my vibe coded dashboard everything is green!'


Why do people always assume that change is permanent?

It's never.

After decentralisation we always see decentralisation. After a period of growth, a decline will follow. After the vibe coding hype, consolidation will follow. After rain comes sunshine.


Well, I am forty years old. In twenty years I won't be working. We are in the dawn of AI software. If this will be decentralisation it will be at least 10 years of that. Probably more. So if fifteen or twenty years things will be going back to 'our normal' as we see today, I won't be concerned about all of it that much anymore. Perspective change with age considerably.


It’s the Lisp curse again.

“[X] is so powerful that problems which are technical issues in other programming languages are social issues in [X].

— <https://www.winestockwebdesign.com/Essays/Lisp_Curse.html#ma...>


You have to be root to edit /etc/services ...


I am pretty convinced you need root on most systems to update DNS resolution mechanism system-wide (eg. to edit /etc/hosts or run a local DNS server and put that into /etc/resolv.conf).


Technically you can set the HOSTALIASES variable to point to a custom hosts file, but that only works with programs that use gethostbyname(3). (Which is most of them? IDK.)


Top reply, and clearly based on the article's title rather than its content, as are the follow-ups. You're making this site worse.

The article is short; go read it then come back and delete.


The article is about the dude not knowing what service is where so he codes a json mapping. He could just update his /etc/services for the same thing. Oh but wait, he mentioned ai agents that changes everything!


can you please demonstrate the workflow you are suggesting? asking because i tried what you suggest, and it does not work.


Sounds like more of a problem with the title than the person you're attempting to insult.


[flagged]


you go and look in etc services for what is bound to port 5009. the article might not be the most useful but these comments are completely off the mark and stupid.


The hosts file is enough, what is needed is a way to assign an ip address to a process/service like you can with port numbers.


You can trivially have a server process bind a listening socket to eg. 127.4.3.19.


[flagged]


Why?


What's up with the hate? It seemed like an interesting project to me, maybe not something I see myself using, but not something deserving hate.


Maybe not hate, but I think that kind of blog, and every single person posting AI slop to LinkedIn, deserve to be shamed publicly for that. It's just that no one does that, and those who do are frowned upon, and down voted to death, like here. The reason I asked "Why?" was to confirm that in fact there are others who think doing that is shameful, that I am not the only one. The outcome is disappointing.


What about identifying different instances of the same service?


URLs already have default ports for service names as a feature.

http:// means port 80 unless specified otherwise

https:// means port 443 unless specified otherwise

ftp:// means port 21 unless specified otherwise

sftp:// means port 22 unless specified otherwise

...

The practical solution for TFA is actually just an nginx server running on port 80 with proxy_pass

    location /blog/ {
        proxy_pass http://127.0.0.1:3000 ;
    }

    location /tensorboard/ {
        proxy_pass http://127.0.0.1:6006;
    }
...


How many little web servers work without issue when their root page is loaded from a path other than /?


If that's your concern you can also do this

    server {
        listen 80;
        server_name "tensorboard.localhost";
        location / {
            proxy_pass http://127.0.0.1:6006;
        }
    }

    server {
        listen 80;
        server_name "blog.localhost";
        location / {
            proxy_pass http://127.0.0.1:3000;
        }
    }
HTTP 1.1 and later will have the browser supply the domain name that was used to access the site, and even though *.localhost all resolve to 127.0.0.1, nginx will pluck out the correct configuration and proxy_pass the correct one.


That's because there defines in etc services (really the place where etc services gets its mapping). You're putting the cart in front of the horse


The best way to find the right answer on the Internet is to slop-code a half-assed solution to a long-solved problem.

https://meta.wikimedia.org/wiki/Cunningham%27s_Law

Sidenote: A good AI would interject, Clippy-like, "It looks like you're trying to recreate /etc/services. Would you like me to explain what that is?"


> It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services...

People shit-talk container orchestration systems like Kubernetes, but if anything they greatly simplified (if not completely eliminated) the need for this sort of network bookkeeping.


You forgot the /s at the end.


All our bookkeeping is now in YAML. Watch the spaces on your way out the door.


Learning nixos had been a lot of fun for me.

Your comment unironically is something I prefer and one of my biggest pain points with Linux.

As a newb, I'm sure there's something called with a mycommonproblemd name that has a stateful interface. But sometimes that all adds up to make things feel complex. And it let's me make stupid mistakes, like I forgot to close or open a port on firewalld, or I disabled a container but forgot to commit a change to my systemd units.

It's nice to just have a nice file called myservice.nix that tracks the firewall port, name, systemd startup and update scripts.


And don’t forget to quote your port assignments and version strings.


Hacker News loves to make snarky comments about everything to do with K8s and YAML all the time, and yet in my experience the amount of times an issue was caused by actual YAML can be counted on one hand.

Way more often it’s developers who can’t figure out that their http library only supports 2 concurrent connections, or emit garbage/malformed log lines and then bitch that they can’t see their app logs because we dropped them, or can’t be fucked to do “kubectl describe” in their own developer namespace that they have full permission for.

If you truly experience issues with just using YAML then you need to skill up probably.


Most of the issues with YAML are really issues with people who think that since "configuration as code" is good, that "code as configuration" must also be good.


No, go ahead. Tell me how just using /etc/services does what this does. Because I'm calling bullshit.

But go ahead. /etc/services, please, share with me how it's setup to do thing likes create the HTPS and makes it trusted and sets up the domain. Go ahead.

Go ahead. You can ONLY use /etc/services.

Or, you are admit you don't actually have a clue as to what /etc/services does.


Not modern enough. Unix is too low level, antiquated, and discriminates against those who just want to get shit done instead of reading manpages or documentation by hand.


This is the best example of Poe’s Law I’ve ever seen. Well done…?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: