How Do You Get a NIC to Permanently Be in a firewalld Zone with Multiple Commands?

Problem scenario
A NIC or network interface is not being protected by a zone in the firewalld. You run firewall-cmd commands with different flags, but some NIC (e.g., a virtual NIC) will not persistently remain in a zone. You want your firewall-cmd commands to have a permanent effect. The --permanent flag is supposed to work, but it is not helping. What should you do?

Solution
If a firewall-cmd command fails with a --permanent flag, do this as the workaround: 1) reboot so you know there are no temporary (or intended as temporary) firewall changes in memory or in effect. 2) run the firewall-cmd command without the --permanent flag. 3) run this: firewall-cmd --runtime-to-permanent

Runtime configuration is temporary configuration. The changes can be applied to the kernel with the --runtime-to-permanent flag. To read more, see this https://firewalld.org/documentation/configuration/runtime-versus-permanent.html.

The above solution involves successive commands. If you just want to run one Linux command, see also How Do You Get a NIC to Permanently Be in a firewalld Zone with a Single Command?

Should You Disable WPS on Your WiFi/Router at Home?

Problem scenario
You want to not broadcast your home's network (e.g., to make sure people do not borrow your bandwidth or hack your devices such as your thermostat with ransomware). You want to keep using your WiFi. You try to disable the "Broadcast Network Name (SSID)", but you get a prompt like "WARNING:
Disabling Broadcast Network Name (SSID) will disable Wi-Fi Protected Setup (WPS) functionality. Are you sure you want to change?"

Should you click "OK"?

Solution
Yes, click "OK".

It is recommended to disable "Wi-Fi Protected Setup" or "WPS" to harden your network according to https://www.digitalcitizen.life/simple-questions-what-wps-wi-fi-protected-setup/.

How Do You Troubleshoot an IP Address That You Can SSH to, But You Cannot Ping It?

Problem scenario
nmap shows that the host seems down. You cannot ping the IP address. But you can SSH to the IP address. How is this possible?

Solution
Possible Solution #1

A host server could have multiple IP addresses (e.g., with a virtual server hosted by a type 2 hypervisor utilizing KVM or QEMU). The networking could be done at the kernel level.

It's not the ssh client that decides through which interface TCP packets should go, it's the kernel. In short, SSH asks the kernel to open a connection to a certain IP address, and the kernel decides which interface is to be used by consulting the routing tables.

https://unix.stackexchange.com/questions/16057/use-ssh-with-a-specific-network-interface

Is the client related to the destination server via a type 2 hypervisor?

Possible Solution #2
Check the firewall rules. icmp packets could be dropped, but SSH could still be allowed. See this external posting for more information.

Possible Solution #3
Restart the firewall service or reboot. You may want to see this external posting for more information.

Possible Solution #4
If you searched online, you may want to read more about SSH with other postings on this site.

How Do You Write a Python Program to Extract Lines of a Specific Date?

Problem scenario:
You have a log like this:

Sep 18 07:28:11 server1 sshd[29284]: Received disconnect from 125.52.17.109 port 46970:11: Bye Bye [preauth]
Sep 18 07:28:11 server1 sshd[29284]: Disconnected from 125.52.17.109 port 46970 [preauth]
Sep 18 07:28:11 server1 sshd[29282]: Failed password for root from 51.12.19.109 port 24844 ssh2
Sep 18 07:28:13 server1 sshd[29287]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=119.29.155.214  user=root
Sep 18 07:28:13 server1 sshd[29282]: Failed password for root from 51.12.19.109 port 24844 ssh2
Sep 18 07:28:14 server1 sshd[29282]: Received disconnect from 51.12.19.109 port 24844:11:  [preauth]
Sep 18 07:28:14 server1 sshd[29282]: Disconnected from 51.12.19.109 port 24844 [preauth]
Sep 18 07:28:14 server1 sshd[29282]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=51.12.19.109  user=root
Sep 18 07:28:15 server1 sudo:     jdoe : TTY=pts/0 ; PWD=/home/jdoe/ ; USER=root ; COMMAND=/usr/bin/tail /var/log/auth.log
Sep 18 07:28:15 server1 sudo: pam_unix(sudo:session): session opened for user root by jdoe(uid=0)

You want to extract lines that happen on a specific day using Python with only four lines of code. You do not want to use an "import" statement. What do you do?

Solution
Here is how to extract the "Jun 17" days:

log_reader = open('auth.log', 'r')
for line in log_reader:
    if line.startswith("Jun 15"):
        print(line)

This solution assumes the text log starts with the day in the format provided; it is an example, and your logs may require a different solution.

What is MEV?

Question
What does MEV stand for in the context of cryptocurrency?

Answer
MEV means Maximal Extractable Value; it used to mean "Miner Extractable Value" according to Coindesk.com. Cryptocurrency miners solve problems and receive a reward for doing so.

If a miner is able to successfully add a block to the blockchain, they will receive … bitcoins as a reward.

https://www.bankrate.com/investing/what-is-bitcoin-mining/#how

Maximal extractable value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding, and changing the order of transactions in a block.

https://ethereum.org/en/developers/docs/mev/

The value that miners can obtain from changing the sequence of transactions inside the blocks they generate is known as the miner extractable value (MEV).

https://cointelegraph.com/learn/what-is-mev-ethereums-invisible-tax

What is Bor in Cryptocurrency?

Question
In the context of cryptocurrency, what is Bor?

Solution

It is the way to use MATIC with the Go programming language.

Bor is the Official Golang implementation of the Matic protocol. It is a fork of Go Ethereum - https://github.com/ethereum/go-ethereum and EVM compatible.

https://github.com/maticnetwork/bor

What is MATIC in cryptocurrency?

Question
What is MATIC in the context of cryptocurrency?

MATIC is Polygon’s native cryptocurrency token.
...
Before the project changed its name in February 2021, Polygon was known as Matic network.

https://cointelegraph.com/learn/polygon-blockchain-explained-a-beginners-guide-to-matic

MATIC is the currency of Polygon that enables users to interact with tens of thousands of dApps involved in our ecosystem. It is also used to secure the network by staking.

https://polygon.technology/matic-token

Polygon (MATIC) is a cryptocurrency and a technology platform that was launched to connect and grow Ethereum-compatible projects and blockchains.

https://www.investopedia.com/polygon-matic-definition-5217569

For Golang coders, see the definition of "Bor."

How Do You Troubleshoot the Error Message “Client sent an HTTP request to an HTTPS server”?

Problem scenario
You run curl commands, but you keep getting this error "Client sent an HTTP request to an HTTPS server." What should you do?

Possible Solution #1
Use https instead of http. See this for more information.

Possible Solution #2
The "problem" is not actually a problem or a true error message. Some web servers have nothing but this as text. This is a sign that the web server is working correctly and the curl command was successful.

Possible Solution #3
Are you using Caddy and Nginx Proxy Manager? Can you not use Caddy and Nginx Proxy Manager (per https://vaultwarden.discourse.group/t/i-get-a-client-sent-an-http-request-to-an-https-server-error-on-all-pages/2296) at the same time?

Possible Solution #4
Are you using Go instead of just curl? If so, see https://github.com/golang/go/issues/49310

How Do You Troubleshoot a “SyntaxError: invalid syntax” Error in Python?

Problem scenario
You do not know why you are getting the error. The line has an "l" (a lowercase "L") or a numeral one ("1") in it.

You may have identified that the line of code is different in one file from another. You cannot tell what is different about your code or why you are getting this error. What should you do?

Solution
Enter vi or open Notepad++ to view the code. Search for a lowercase L "l" or a numeral one "1". PEP8 recommends this: "Never use the characters 'l' (lowercase letter el), 'O' (uppercase letter oh), or 'I' (uppercase letter eye) as single character variable names." (This was taken from https://www.python.org/dev/peps/pep-0008/#id36)"

"If a function argument's name clashes with a reserved keyword, it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption." (This was taken from https://www.python.org/dev/peps/pep-0008/#id44)

(If you do not have an "l" or a "1" in your code, did you forget to put parentheses around the item being printed? Or is there an unmatched parens "(" or ")" somewhere?)