Welcome to the Linux Foundation Forum!

Lab 10.2 - Block an Attackers IP Address with Fastify -Error: read ECONNRESET on Windows


I was getting this error for lab 10.2 on Windows:

I found out the validated file for lab 10.2 has different handling for the temporal file produced by the call to writeFileSync(IP, ""); than the one used in lab 10.1, which outputs a file path without any \ on Windows.

So, I just copied and pasted the lines from lab 10.1 to the validate file for 10.2 on line 13.

From this:
const ip = join(tmp, "IP");

to this:

const ip =
  process.platform === "win32"
    ? join(tmp, "ip").split("\\").join("\\\\")
    : join(tmp, "ip");

After that change, the tests ran fine on Windows.



Upcoming Training