Live data from Hacker News

TIL: You can make HTTP requests without curl using Bash /dev/TCP

mareksuppa.com

201–210 of 255 posts

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#201
post #195

Earlier quoted context omitted.

> not having standard debugging tools available where and when we need them Keeping in mind that containers are merely a bunch of namespaces, there's nothing stopping you from entering the same PID namespace with a different mount namespace in order to debug.

I am aware, thank you :). I responded to a sibling dupe-comment over here [1]. To summarize, in my experience there is immense value to having basic shell tools available in the environment where you need them with zero extra friction. Stripping those out provides a security benefit only in specific nebulous and niche scenarios. 1: https://news.ycombinator.com/item?id=48561605

> in my experience there is immense value to having basic shell tools available in the environment where you need them with zero extra friction

I agree, however assuming you maintain a chroot for debugging this can be accomplished with a shell command that takes a single argument to target a running container by name.

Your linked comment suggests being limited to kubernates but nsenter and a chroot are entirely runtime agnostic.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#202

Earlier quoted context omitted.

Pure Linux doesn't.

Interesting. I have never heard kernel modules being regarded as non-linux, not in 30 years of LKM. Further compiling a monolithic Kernel is rather straight forward, in this day it is even possible to find wifi devices that do not require a an on device firmware blob uploaded from the kernel.

I don't know TBH. It's just that if you're going to have a 'pure' designation for a tech, it's going to be pretty strict (as per bash and adding modules). I've never heard of 'pure' linux, but 'pure' bash has a recognised meaning. If someone said 'pure Linux' and it meant the core without loaded modules I wouldn't be shocked. Not sure how useful it would be, though.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#203
post #139

Earlier quoted context omitted.

I always recommend to not have any dependencies outside of the code. So we start at compiling the codebase (Rust) against MUSL. That way we can run it with FROM scratch images. If we need more tooling available at runtime, then we look at alpine, but still using MUSL. If MUSL itself is proving problematic, or if some of the libraries we use need glibc then we can look at using some locked down image. The cool part ab…

preface: I'm not asking things rhetorically, I genuinely want to learn here. > to not have any dependencies outside of the code. > ... FROM scratch images is that you'll never have to update your base image to address CVEs... So a FROM scratch image, basically doesn't have things like a package manager to install things, and maybe also libraries that things like curl would depend on? Sorry for my ignorance, I've hear…

Apparently you get only an empty root directory, nothing else. https://medium.com/@fabrizio.sgura/the-forgotten-minimalist-...

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#204
post #73

As a kid in the late 90s my mind was blown when I realized I could telnet to port 80, 25, or 110 and interact with the servers manually. Simple get: GET / HTTP/1.1 Content-Type: text/html User-Agent: l33t hax0rs lol X-Funny-Monkey: farts For sending a mail message on port 25: HELO mail-from: whoever@whatever.com mail-to: sysadmin@yaya.com Body of the message yay. POP3 was so long ago I forgot but you could list the m…

Last century I would read and send personal email from work using telnet to pop3 and smtp respectively.

I also have a tendency to say "Last century", thinking it comedically suggests "a long time ago" without it actually being that long ago. But as time goes by it obviously becomes legitimately a long time ago, and I suspect young people wouldn't see the attempted irony at all.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#205

As a kid in the late 90s my mind was blown when I realized I could telnet to port 80, 25, or 110 and interact with the servers manually. Simple get: GET / HTTP/1.1 Content-Type: text/html User-Agent: l33t hax0rs lol X-Funny-Monkey: farts For sending a mail message on port 25: HELO mail-from: whoever@whatever.com mail-to: sysadmin@yaya.com Body of the message yay. POP3 was so long ago I forgot but you could list the m…

I sent many an email from jacques.chirac@elysee.fr, the veneer of the terminal helping, my friends were quite impressed by how good a hacker I was. Good olde days when many DKIM/SPF weren't a thing yet and SMTP servers weren't even authenticated.

"Cher compatriote, voici, rédigé avec mes clavier et mulot, mon programme de l'an 2000 que j'ai après la dissolution..."

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#206
post #132

Earlier quoted context omitted.

[ Note: Anyone who has been a geek since the 90s, there's nothing you don't already know here ] > most SMTP servers would accept email from anyone anywhere to anyone anywhere (i.e. 'open relay'). to date that claim, I'd say that by the late 90s at least, true open relays ("from anyone to anyone") were still numerous but carried a huge assumption of being part of spam operations (willingly or through ineptitude), and…

The magic for me, to this day in fact, is knowing that mail is essentially anyone on the internet being allowed to write to a mail servers disk. There are rules now, but the concept is still almost intact, random people writing to the servers disk - to be later read by someone

It used to be even more literally so - network mail started off as using FTP to SNDMSG onto a remote system instead of your own. In RFC475, FTP has MAIL and MLFL (mailfile) commands to support this.

I think it's neat that you can still find echoes of this. MAIL worked by just appending to MLFL, separating records with CRLF.CRLF - which is still how Data segments are terminated in SMTP.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#207

Earlier quoted context omitted.

You can't do that with HTTP/2 (but thankfully every server still talks HTTP/1). You also can't do that with TLS (and a lot of servers won't talk HTTP other than redirects). openssl s_client instead of telnet might allow you to tunnel text inside TLS, but that feels like a cheating. And many other modern protocols, sadly, prefer binary encoding, which makes it impossible to tinker with it on wire level, not without sp…

Nothing to regret. Text Protocol is too inefficient.

Compared to inefficiencies in the average payload? No, it doesn't really matter.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#208

Earlier quoted context omitted.

> As the calendar rolled from 1999 to 2000, we entered a new millennium, century, decade, year, day, ... no, that all happened when we rolled from 2000 to 2001. smh, even paedants today aren't what they used to be.

The entirety of 1999 and 2000 was a nightmare. "No, buddy, we won't change millenium next january." "Nope. We are still in the 20th century." And so on... I think that's more or less when I lost faith in humanity.

You lost faith in humanity because people disagree about an arbitrary zero offset?

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#209
post #76

Earlier quoted context omitted.

Need to be clear that "full http server in pure bash" is incorrect. Bash cannot listen on a TCP/UDP socket for incoming connections. bash-web-server project builds a C language socket listener [0] that is dynamically loaded at run-time as a "built-in" module that makes the functionality available. [0] https://github.com/bahamas10/bash-web-server/tree/main/loada...

By this logic, Linux does not support Wi-Fi, because all the driver modules are "dynamically loaded at run-time."

No, by any other logic you can implement your Wi-Fi drivers in bash.
Post reply on HN