When I tried to run Winbox on a Windows 2000 machine, I got the following error;
The procedure entry point freeaddrinfo could not be located in the dynamic link library WS2_32.DLL
This is the Winsock 2 library and support for freeaddrinfo wasn't added until Windows XP but there is a solution. You can download a modified WS2_32.DLL from here;
You only need to extract the compiled WS2_32.DLL from the dllfiles folder, then place the DLL in the same folder as the Winbox executable. Leave the original Windows DLL alone.
Exec if $EventID == 4625 or ( $Message =~ /running/m ) drop (); line inside the <Output out_win> block drops the logs with the event id 4625 or
any message containing the word running in them.
These commands all give an output listing all the threads in the selected process along with various details, including the CPU usage percentage. For example, the top command gives an output similar to this:Tasks: 152 total, 0 running, 152 sleeping, 0 stopped, 0 zombie
Cpu(s): 2.0%us, 1.4%sy, 0.0%ni, 94.7%id, 0.8%wa, 0.0%hi, 1.1%si, 0.0%st
Mem: 5008484k total, 4854428k used, 154056k free, 85624k buffers
Swap: 5013496k total, 6516k used, 5006980k free, 3393948k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8706 user.1 20 0 2433m 561m 10m R 32.0 11.5 0:35.45 java
8624 user.1 20 0 2433m 561m 10m S 0.0 11.5 0:00.01 java
8625 user.1 20 0 2433m 561m 10m S 0.0 11.5 0:10.12 java
8626 user.1 20 0 2433m 561m 10m S 0.0 11.5 0:35.60 java
8627 user.1 20 0 2433m 561m 10m S 0.0 11.5 0:00.01 java
8628 user.1 20 0 2433m 561m 10m S 0.0 11.5 0:00.02 java
In this example, we can see that thread ID 8706 is consuming 32% of the CPU.
Produce a stack trace for the PID identified in step 1 using one of the following commands:
kill -3 command (Unix® and Linux® systems only), which consistently produces better results: $ kill -3 [pid]The kill -3 command outputs the stack trace to the log file where the standard output is directed (typically the error log file). The kill -3 command does not stop the running process; it will continue to run after outputting the stack trace.
Convert the thread ID identified as problematic in step 2 to a hex value. In our example output, the thread ID decimal value 8706 converts to hex value 2202.
Search the stack trace output for this hex value using grep. You are looking for a thread nid that matches this hex value: $ cat jstack-output.txt | grep -i 2202This command gives an output similar to this: "Concurrent Mark-Sweep GC Thread" prio=10 tid=0x00007f1448029800 nid=0x2202 runnableIn this example, we can see that the problem is a Garbage Collector (GC) thread, which suggests that GC is not properly tuned.
Option 1 (setting up your own CA) is preferable when you need multiple certificates. In a company you might set up your own CA and install that CA's certificate in the root keystore of all clients. Those clients will then accept all certificates signed by your CA.
Option 2 (self-signing a certificate without a CA) is easier. If you just need a single certificate, then this is sufficient. Install it in the keystores of your clients and you are done. But when you need a second certificate, you need to install that again on all clients.
Self-signing is the simpler route to take, but making one's own CA allows the signing of multiple server certificates using the same CA and involves only a few extra steps.
You have built two or more network cards into one Linux system and each of these cards has its own default gateway. By default, you can only have one default gateway on a system. The case described would lead to asynchronous routing, whereby the router would reject the packets as appropriate.
Solution
The iproute2 program, which is included in all current Linux distributions and already installed even, as a rule, can be used for the solution of this problem. Normally, a Linux system only has one routing table, in which only one default gateway can make entries. With iproute2, you have the ability to setup an additional routing table, for one thing, and allow this table to be used by the system based on rules, for another.
Initial Position
We will assume that we have two interfaces: eth0 and eth1. The two networks that should be used are 192.168.0.0/24 and 10.10.0.0/24, whereby the first IP address in each respective network should be the gateway. Under Debian, the initial configuration would appear as follows. /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
# The secondary network interface
allow-hotplug eth1
iface eth1 inet static
address 10.10.0.10
netmask 255.255.255.0
Adding a Second Routing Table
To add a new routing table, the file, /etc/iproute2/rt_tables must be edited. We will call the routing table “rt2” and set its preference to 1. The named file should then appear as follows.
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1 rt2
Configuring the New Routing Table
From this point, four commands are needed to achieve our goal. First, the new routing table needs to be populated, which is done using the following command.
ip route add 10.10.0.0/24 dev eth1 src 10.10.0.10 table rt2
ip route add default via 10.10.0.1 dev eth1 table rt2
The first command says that the network, 10.10.0.0/24, can be reached through the eth1 interface. The second command sets the default gateway.
Routing Rules
So that the system knows when to use our new routing table, two rules must be configured.
ip rule add from 10.10.0.10/32 table rt2
ip rule add to 10.10.0.10/32 table rt2
These rules say that both traffic from the IP address, 10.10.0.10, as well as traffic directed to or through this IP address, should use the rt2 routing table.
Making the Configuration permanent
The ip rule and ip route commands will become invalid after a re-boot, for which reason they should become part of a script (for example, /etc/rc.local) that will be executed once the network has been started after booting. For Debian, these command can also be written directly into the /etc/network/interfaces file, which would then appear as follows.
iface eth1 inet static
address 10.10.0.10
netmask 255.255.255.0
post-up ip route add 10.10.0.0/24 dev eth1 src 10.10.0.10 table rt2
post-up ip route add default via 10.10.0.1 dev eth1 table rt2
post-up ip rule add from 10.10.0.10/32 table rt2
post-up ip rule add to 10.10.0.10/32 table rt2
More than Two Network Cards or Gateways
If there are more than two networks, a routing table can be created for each additional network analogous to the example presented above.
Testing the Configuration
The following commands can be used to ensure that the rules as well as the routing entries are working as expected.
The worst has happened. Your Node.js app is stuck in a good old-fashioned infinite loop. Express is listening for connections, but never responds.topshows 100% CPU.
You chose Node.js for its single-threaded performance and most days you’re very happy about that. This is not one of those days. Since there is just one thread of execution, all requests reaching this particular process are stuck.
Sure, you’re running one process per core and even on multiple servers. But if a common operation is the cause, all of the processes encounter it before long, and the application is effectively down. You are not having a good day.
No problem, you say as you sync your database down to a dev environment and try to reproduce the issue. Here in dev, you can console.log your way through it if you have to, following a “divide and conquer” strategy.
Except… you can’t. Something is happening in production that you have never thought of, and you don’t know what it is. So you can’t reproduce it. You need to debug this in production. 🙀
You could redeploy your app with lots of additional logging, and that’s not a bad thing. But what if you could find out exactly what code is running right now? Then you could see the problem immediately and save a great deal of downtime.
There’s a way: the Node.js command line debugger.
First, ssh into the server or open a shell in your container, if that’s how you roll. Then run top and find your runaway process. It’ll sort right to the top of the list:
Process 4702, using close to 100% of CPU.
Gee, think maybe that’s the one?
Now, let’s tell the process to listen for debugging requests.
Yes, we’re using a command called kill. No, we’re not killing the process. We’re sending it a different signal.
kill -SIGUSR1 4702
Once you do this, the process is open to a debugger connection. In fact, it will print a special URL to its console log, and you can open that URL in Chrome to debug the process! But, maybe you don’t want to drill a hole through a firewall and a container configuration just to make that connection. Yeah, me neither.
So let’s debug at the command line instead:
node inspect -p 4702
You’ll see this prompt:
debug>
Holy smokes, you’re in the debugger! Let’s print a stack trace to see where you are in the code:
backtrace
But you just get back:
null
Hmm, that’s not very useful. Let’s type help and see if there’s anything about how to pause the process… nope!
Fortunately, I was able to find the command eventually. Sure enough, you just type:
pause
And you get back:
break in file:///somewhere/something.js:555 >555 for (prop in inputObject) {510 if (hasOwnProp(inputObject, prop)) {511 normalizedProp = normalizeUnits(prop);
Yes! We have our first hint. The app was executing line 555 in file something.js.
That might be enough to see the bug right away. But usually we need more information than that. You can type backtrace to get a complete stack trace:
By now you often have enough information to solve the problem. But if not, you can set breakpoints and continue execution to see if they are indeed hit over and over:
Sure enough, you come right back to that line of code when cont continues execution. Hit cont a few times and it becomes clear you’re looping there. You can set breakpoints on other lines to figure out if it’s stuck in this inner loop here, or that outer one there, and so on.
This is helpful, but you still don’t know why you’re stuck in the loop. So let’s watch a variable to find out its value the next time you reach a breakpoint:
watch('counter')cont
And when you reach the breakpoint again, you see:
break in file:///somewhere/something.js:444Watchers:0: counter = NaN>444 counter++;
Gotcha! The counter variable is NaN (“not a number”), so it can’t be incremented and will never reach the end condition for a for loop or while loop.
Now you have enough information to go back to your dev environment, fix the bug, test a fix (forcing the NaN case as a test if you have to!) and ship it to production.
To close the debugger, just press control-D to exit.
Makes outgoing connections to a proxied server originate from the specified local IP address. Parameter value can contain variables (1.11.2). The special value off cancels the effect of the proxy_bind directive inherited from the previous configuration level, which allows the system to auto-assign the local IP address.
The transparent parameter (1.11.0) allows outgoing connections to a proxied server originate from a non-local IP address, for example, from a real IP address of a client:
proxy_bind $remote_addr transparent;
In order for this parameter to work, it is usually necessary to run nginx worker processes with the superuser privileges. On Linux it is not required (1.13.8) as if the transparent parameter is specified, worker processes inherit the CAP_NET_RAW capability from the master process. It is also necessary to configure kernel routing table to intercept network traffic from the proxied server.
While archiving, we can specify stdout as the output file so another command in a pipe can read it as stdin and process the archive.
This technique will transfer data through a Secure Shell (SSH) connection, for example:
$ tar cvf - files/ | ssh user@example.com "tar xv -C Documents/"
In the preceding example, the files/directory is added to a tar archive which is output to stdout (denoted by -) and extracted to the Documents folder on the remote system.
Receiving server(open port 44023)
root@Receiver:/StoragePool/data/logs/Firewalls/2020/11# nc -l 44023 | pv | tar x
2.27GiB 0:01:16 [46.6MiB/s] [ <=> ]
Sending server (send dir named 12 to 22)
root@Sender:/opt/immune/storage/logs/Firewalls/2020/11# ls
01020304050607080910111213141516171819202122
root@Sender:/opt/immune/storage/logs/Firewalls/2020/11# tar cf - 131415161718192021 | nc 172.16.104.39 44023
The sender server should run the following command
$ tar cf - logs/ | netcat 192.168.0.1 9000
and the receiveing server should listen with with this command
$ netcat -l -p 9000 | tar x
This means that the dataset “test” from my ZFS pool “tank” and snapshot “manual-2020-08-27_19-18” are being sent via netcat to host 10.0.1.2 on port 8023.
zfs receive side
nc -l 8023 -w 120 | zfs receive tank/test
This means that netcat is listening on port 8023 for the dataset “test” and adding it to the ZFS pool “tank”.
to see progress use pv eg.
nc -l 8023 -w 120 | pv | zfs receive tank/test
Send Incremenatl Snapshots
root@141:# zfs list -t snapshot
NAMEUSEDAVAILREFERMOUNTPOINT
LP_Pool/storage@1002.16M-1.38G- ## this is already sent