Open kaznovac opened 11 months ago
The following works on alpine:
echo "version" | nc -vn -w 1 127.0.0.1 11211
Source: https://book.hacktricks.xyz/network-services-pentesting/11211-memcache
And the following works on debian:
echo "version" | (exec 3<>/dev/tcp/localhost/11211; cat >&3; cat <&3; exec 3<&-)
@LaurentGoderre Wow, thanks a lot, just what I've needed! (couldn't figure out the 'bidirectional' cat
on my own)
I've added timeout to your debian command, so it will not block (just need to figure out the clean way to get the exit code)
echo "version" | (exec 3<>/dev/tcp/localhost/11211; cat >&3; timeout 0.1 cat <&3; exec 3<&-)
If it's ok with you I'd like to create PR to update the documentation of the image (later when I get some free time)
Absolutely! That would be awesome!
See https://github.com/docker-library/faq#healthcheck :see_no_evil:
@tianon an example could be created here then: https://github.com/docker-library/healthcheck
Agreed! Does memcached
have an explicit healthcheck type function we could use, or is just connecting the best we can do? For example, in SQL-based images, I've often used SELECT 1
as a basic health check because I can verify that the output of that query is exactly 1
to know that everything actually worked end-to-end (and it wasn't just something else accepting my connection and quietly doing nothing useful).
As a developer I'd like to have a way to issue a health check on memcached container without modifying the base image (base image has no
telnet
nornc
)