Friday, September 18, 2020

How to remove Cluster from Proxmox 6

 https://pve.proxmox.com/pve-docs/pve-admin-guide.html#pvecm_separate_node_without_reinstall

 
On cluster master server do:
systemctl stop pve-cluster corosync 
pmxcfs -l 
rm /etc/corosync/* 
rm /etc/pve/corosync.conf 
killall pmxcfs 
systemctl start pve-cluster
 
Server should become single node. 

Friday, August 28, 2020

How to Edit a File in a docker container with no Text Editor

 Simply editing a file is an ordeal if you don’t have vim, vi or nano available.

One of the best things to do may be to copy the file from the container to your host machine:

docker cp <container>:/path/to/file.ext .

Edit the file.

Then send it back to the container.

docker cp file.ext <container>:/path/to/file.ext

Thursday, July 9, 2020

Midnight Commander missing syntax highlighting

Midnight Commander missing syntax highlighting


Try to pres Ctl-s, which toggles syntax highlighting on and off in mcedit

Wednesday, March 25, 2020

VLC HowTo/Adjust subtitle delay in advance way

VLC HowTo/Adjust subtitle delay in advance way

Advance Synchronisation

When subtitles are late compared to the audio, and only in this case, you can use the advance synchronisation functionality of VLC :
  • Step 1 : Detect (“hear and see”) that subtitles are out of sync
  • Step 2 : Press Shift H when you hear a sentence that you will be able to easily recognize
  • Step 3 : Press Shift J when you read the same sentence in the subtitle
  • Step 4 : Press Shift K to correct the sync

Wednesday, January 15, 2020

Remove string from file in Windows 10 powershell like sed

Remove string from file in Windows 10 powershell like sed

 
If you need to edit file like stream and replace/remove string in
Windows using powershell

this command will open text.txt file, search for ",,,,," and replace
with nothing "" and save as new file test2.txt

get-content test.txt | %{$_ -replace ",,,,,",""} | set-content test2.txt

Thursday, October 24, 2019

How to check if NTP client works on windows 7/10

How to check if NTP client works on windows 7/10

run this command from command line:

w32tm /stripchart /computer:jp.pool.ntp.org /dataonly /samples:5

Response will be :

C:\Windows\System32>w32tm /stripchart /computer:jp.pool.ntp.org /dataonly /samples:5
Tracking jp.pool.ntp.org [162.159.200.1:123].
Collecting 5 samples.
The current time is 24.10.2019 08:58:22.
08:58:22, -00.3017199s
08:58:24, -00.3021865s
08:58:26, -00.3018570s
08:58:28, -00.3018344s
08:58:30, -00.3017718s

Tuesday, February 26, 2019

Securing the Pi-hole with fail2ban to prevent DNS Amplification attacks

Securing the Pi-hole with fail2ban to prevent DNS Amplification attacks

 

1. Install fail2ban 

sudo apt-get update ; sudo apt-get install fail2ban

2. create jail file


vi /etc/fail2ban/jail.d/pihole-dns.conf

[pihole-dns]
enabled = true
port     = 53
action   = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp]
           %(banaction)s[name=%(__name__)s-udp, port="%(port)s", protocol="udp", chain="%(chain)s", actname=%(banaction)s-udp]
logpath = /var/log/pihole.log
findtime = 60
maxretry = 5
bantime = 3600

 

3. create filter file


vi /etc/fail2ban/filter.d/pihole-dns.conf

# Fail2Ban configuration file
#
# script from www.marek.tokyo
#

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf


[Definition]

_daemon = dnsmasq

# log example from /var/log/pihole.log
#Feb 26 04:41:28 dnsmasq[1887]: query[A] 21cl93vlx5n9p.aikoaiko.net from 67.21.36.3
#(?:DAY )?MON Day 24hour:Minute:Second(?:\.Microseconds)?(?: Year)?



failregex =  .*query\[A\].*from <HOST>
                   .*query\[ANY\].*from <HOST>

ignoreregex =

4. test if regex works


fail2ban-regex /var/log/pihole.log /etc/fail2ban/filter.d/pihole-dns.conf


you should have results like this:








Running tests
=============

Use   failregex filter file : pihole-dns, basedir: /etc/fail2ban
Use   log file : /var/log/pihole.log
Use   encoding : UTF-8


Results
=======

Failregex: 4127 total
|-  #) [# of hits] regular expression
|   1) [4125] .*query\[A\].*from <HOST>
|   2) [2] .*query\[ANY\].*from <HOST>

`-


Ignoreregex: 0 total

Date template hits:
|- [# of hits] date format
|  [15674] (?:DAY )?MON Day 24hour:Minute:Second(?:\.Microseconds)?(?: Year)?
`-

Lines: 15674 lines, 0 ignored, 4127 matched, 11547 missed
[processed in 1.25 sec]

Missed line(s): too many to print.  Use --print-all-missed to print all 11547 lines




Got hits (in red) so regex works !

5. add your`s IP to ignore list to prevent being blocked

use your local IP or global if Pi-hole is open access/relay installed on cloud VPS etc.

 vi /etc/fail2ban/jail.conf

[DEFAULT]

#
# MISCELLANEOUS OPTIONS
#

# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space (and/or comma) separator.
ignoreip = 127.0.0.1/8, 192.168.0.1/24

 

6. restart fail2ban service

 

7. to check if fail2ban works 

fail2ban-client status pihole-dns

Status for the jail: pihole-dns
|- Filter
|  |- Currently failed: 1
|  |- Total failed:     75
|  `- File list:        /var/log/pihole.log
`- Actions
   |- Currently banned: 2
   |- Total banned:     2
   `- Banned IP list:   172.93.106.230 67.21.36.3

 8. (optional for Centos 7)

You can check ipset list directly

ipset list fail2ban-pihole-dns-udp



Name: fail2ban-pihole-dns-udp
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536 timeout 600
Size in memory: 312
References: 1
Number of entries: 2
Members:
67.21.36.3 timeout 558
172.93.106.230 timeout 558


 

based on this

Cybermap

Internet Storm Center Infocon Status

Internet Storm Center Infocon Status
Internet Storm Center Infocon Status