ntopng error on pfSense – ntopng requires redis server to be up and running

The Error

ntopng        [Redis.cpp:113] ERROR: to specify a redis server other than the default
ntopng        [Redis.cpp:112] ERROR: Please start it and try again or use -r
ntopng        [Redis.cpp:111] ERROR: ntopng requires redis server to be up and running
ntopng error on pfSense
ntopng error on pfSense

The Fix

1 Login to pfSense via SSH or console or web GUI

1.1 If using web GUI, navigate to “Diagnostics -> Command Prompt” type following command

rm -rf /var/db/ntopng
pfSense -> Command Prompt
pfSense -> Command Prompt

2 Now try to start ntopng from Services Status widget

3 The ntopng service should be able to started successfully

pfSense - Services Status - ntopng
pfSense – Services Status – ntopng

Tips for Let’s Encrypt (certbot etc.)

Ubuntu 18.04 LTS (bionic), Install, Configure “certbot”

https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

Other systems, use following website to find out installation and configuration process

https://certbot.eff.org/

Let Certbot edit your Apache configuration automatically to serve it, turning on HTTPS access in a single step.

sudo certbot --apache
sudo certbot certonly --apache 

Just get a certificate, make the changes to Apache configuration manually

sudo certbot certonly --apache -d contoso.com

With sub-domains

sudo certbot certonly --apache -d contoso.com -d www.contoso.com -d ftp.contoso.com

With multiple domains

sudo certbot certonly --apache -d contoso.com -d www.contoso.com -d ftp.contoso.com -d anotherfakedomain.com -d fakedomain2.com

Test with –dry-run (“–dry-run” switch can be used to Test “renew” or “certonly” without saving any certificates to disk)

sudo certbot certonly --apache -d contoso.com -d www.contoso.com -d ftp.contoso.com -d anotherfakedomain.com -d fakedomain2.com --dry-run

With multiple domains, multiple virtual hosts in different document folders

sudo certbot certonly --apache --webroot -w /var/htdocs/contoso.com/ -d contoso.com -d www.contoso.com -d ftp.contoso.com -w /var/htdocs/anotherfakedomain.com/ -d anotherfakedomain.com -w /var/htdocs/fakedomain2.com/ -d fakedomain2.com --dry-run

Test with Staging server/Environment (higher Rate Limits) (without –dry-run)

Warning: Certificates from Staging server should not be used for production

sudo certbot certonly --server https://acme-staging-v02.api.letsencrypt.org/directory -i apache --webroot -w /var/htdocs/contoso.com/ -d contoso.com -d www.contoso.com

Test with Staging server and with –dry-run

sudo certbot certonly --server https://acme-staging-v02.api.letsencrypt.org/directory -i apache --webroot -w /var/htdocs/contoso.com/ -d contoso.com -d www.contoso.com --dry-run

Test with real server with –dry-run

sudo certbot certonly --server https://acme-v02.api.letsencrypt.org/directory -i apache --webroot -w /var/htdocs/contoso.com/ -d contoso.com -d www.contoso.com --dry-run

Download certificate from real server

sudo certbot certonly --server https://acme-v02.api.letsencrypt.org/directory -i apache --webroot -w /var/htdocs/contoso.com/ -d contoso.com -d www.contoso.com

Use dns as preferred challenge with wild card domain

sudo certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns -d 'contoso.com' -d '*.contoso.com'

For Ubuntu, all certificates, certificate configuration files, renal configuration files, archive, keys etc. are stored in following folder

/etc/letsencrypt

Note

If the certbot complaining about connection issue, it might be that the connection is being blocked by firewall, system firewall or Web Application Firewall (WAF) etc.

Extended Reading

  • Root Certificate for Staging Server/Environment ( https://acme-staging-v02.api.letsencrypt.org/directory )
    • The staging environment intermediate certificate (“Fake LE Intermediate X1”) is issued by a root certificate not present in browser/client trust stores. If you wish to modify a test-only client to trust the staging environment for testing purposes you can do so by adding the “Fake LE Root X1” certificate to your testing trust store. Important: Do not add the staging root or intermediate to a trust store that you use for ordinary browsing or other activities, since they are not audited or held to the same standards as our production roots, and so are not safe to use for anything other than testing.

How to fix: macOS – Software Update “Unable to check for updates” “Make sure you are connected to the Internet”

The Issue

Software Update
"Unable to check for updates"
"Make sure you are connected to the Internet"

Other symptoms including:

Some websites can be opened in Safari, some can’t and the safari is saying not connected to internet etc.

App Store is complaining about internet connection “Can’t connect to the App Store” “Safari Can’t Open the Page” etc.

Fix 1 – Make sure your macOS time is correct

1 Click on the clock on top right corner

2 Click on “Open Date & Time Preferences”

3 Click on the lock icon at the bottom left corner near “Click the lock to make changes”

4 Authorize the change

5 Check the “Set date and time automatically” or correct the date and time manually.

6 Close the window, now the macOS and the software update should be working correctly.

Fix 2 – Reset NVRAM or PRAM

1 Power off the Mac

2 Hold the Option + Command + P + R keys

3 Power up the Mac (Till the screen flashed three times or hold for approximately 15 seconds)

4 Release the keys.

5 Now the issue should be fixed.

Note: Reset NVRAM or PRAM might change some system settings and preferences. We may need to update the display resolution and startup disk preference in System Preferences and volume as well.

(If you can’t start up your Mac after resetting NRVAM or PRAM) try below steps

1 Power off the Mac

2 Hold the Option key, start the Mac

3 When we see the prompt, select the correct startup disk

4 After the Mac starts up, Navigate to “Apple menu -> System Preferences -> Startup Disk” then select the correct startup disk.


How to: Force Reboot or troubleshoot during Windows 10 Autopilot out-of-box experience (OOBE) configuration/setup

During Windows 10 Autopilot/OOBE setup, we will see screen similar to following screenshot.

Setting up your device for work
Setting up your device for work

While there is no button or any other choices to let us restart the device etc.

We can use following method to force reboot the device.

1 Force Reboot/Shutdown

1.1 Use following key combination to open command prompt

Shift + F10

1.2 Enter following command to restart immediately or shutdown immediately.

#Restart
shutdown /r /t 0
#Shutdown
shutdown /s /t 0

2 Troubleshooting/Diagnostic

2.1 Follow step 1.1 to launch command prompt

2.2 Type “eventvwr” to open “Event Viewer”

2.3 Find the event

  • (Windows 10 before version 1903) Navigate to “Application and Services Logs -> Microsoft -> Windows -> Provisioning-Diagnostics-Provider -> Autopilot”
  • (Windows 10 above version 1903) “Application and Services Logs –> Microsoft –> Windows –> ModernDeployment-Diagnostics-Provider –> AutoPilot”

2.4 Now we can diagnostic the issues related to Autopilot. During OOBE setup process.

Resources


How to fix: Office 365 Autopilot – Error 640 StorageError

The Error

Internal error
ERROR CODE:
640 - StorageError
CSV LINE NUMBERS AFFECTED:
x
Office 365 Autopilot - Error 640 StorageError
Office 365 Autopilot – Error 640 StorageError

Usually it means the Office 365 has the device detail in the system.

Which means you have added the device to Office 365/Azure Active Directory (AAD) beforehand.

Even after you have removed the device from AAD from device settings.

The same error will appear if you try to import CSV again.

The Fix

Method 1: We can try add the device back to the AAD, then delete the device from Office 365/AAD not on the device.

Method 2: We can try to delete remove the device from Office 365/AAD from the device (not Office 365/AAD) then wait till next day or 24 hours, then try to import the CSV again.

Linux – Basics, Useful Terminal commands and Basic File manipulation, (QuickStart)

Basics/ Useful Terminal commands

Home Directory

Where most of the time the user files are stored.

Usually, the home directory is stored under “/home/” e.g. If we have created a user named “Bob” his home directory will be “/home/bob/” Bob will have full control over this folder including Create, Retrieve, Update, Delete (CRUD).

The corresponding folder for Microsoft Windows is usually “C:\Users\bob\”

Check current working directory

Which directory am I working in?

pwd
pwd
pwd

Switch directory/Directory navigation

Switch working directory, navigating through different directory/folders

e.g. Current working directory is “/tmp”, we want to navigate to “/tmp/test/”

cd test
cd
cd

Or using the absolute path

cd /tmp/test

List files and folders under a folder

List files and folders under current directory

ls
ls
ls

list files and folders under specific path

ls /tmp/test
ls /tmp/test
ls /tmp/test

Color scheme for “ls” command

BlueDirectory/Folder
RedArchive files
WhiteText file

Create a new text file

Create a “b.txt” text file under current working directory. File extension like “txt” is not necessary, but it’s easier for users when the extension is present.

touch b.txt
touch b.txt
touch b.txt

Create a new folder

mkdir newFolder

We can also use standard stream redirection to create file and write content to the text file.

ls > ls.txt
ls > ls.txt
ls > ls.txt

The output of “ls” command will be redirected and written to the “ls.txt” file

Copy, Delete, Move/Rename

Copy

cp ls.txt ls1.txt
cp
cp

Delete

rm ls1.txt
rm ls1.txt
rm ls1.txt
  • -f: –force ignore nonexistent files and arguments, never prompt
  • -r, -R: –recursive remove directories and their contents recursively
  • /*: Anything under root directory (Warning: Use carefully and do not try /* without full backup)
#Delete trash folder and everything within it
rm -rf trash

Rename

mv ls.txt ls1.txt

Move

#Under same working directory/folder
mv ls.txt ls1.txt
#With full path
mv /tmp/test/ls.txt /tmp/test/ls1.txt 
#Move to another folder with same file name
mv /tmp/test/ls.txt /tmp/ls.txt
#Move to another folder with different file name
mv /tmp/test/ls.txt /tmp/new.txt

Search/Find file

Find

Search from root level with “find”

find / -name abc.txt
find / -name abc.txt
find / -name abc.txt

Search from other specific path with “find”

find /tmp/test -name abc.txt

locate

Search with “locate”

updatedb
locate abc.txt
locate abc.txt
locate abc.txt

Search from other specific path with “locate”

updatedb
locate "/bob/*abc.txt"
locate "/root/*.abc.txt"
locate “/root/*.abc.txt”

“find” is usually slower than “locate”

It’s best to do “updatedb” before using “locate”

Search text in file

grep

Search text file (case-sensitive by default)

grep TextWeWantToSearch /tmp/test/textfile.txt

Search test file (ignore case)

grep -i TextWeWantToSearch /tmp/test/textfile.txt
grep, search text from file
grep, search text from file

Search all “txt” files under same directory

grep SearchCriteria /tmp/test/*.txt
grep, search text from any txt file under folder
grep, search text from any txt file under folder

Add “-n” switch to show line numbers

grep -n SearchCriteria /tmp/test/*.txt
grep with line numbers
grep with line numbers

If we want to search sub-directories as well, we need to add “-R” (recursive) parameter

grep -nR SearchCriteria /tmp/test/*
grep including sub-directories and any file with line number
grep including sub-directories and any file with line number

Autocomplete

When typing command, e.g. “fin” then hit “Tab” key twice.

Autocomplete
Autocomplete

If we continue to type “c” at the end, then hit “Enter”, “finecore” will automatically completed.

Same technique can be used for folder names as well. If there is only one folder start with “mus” then after we hit “Tab” key, music will be automatically completed, If there is multiple folder stars with “mus”, then hit “Tab” key twice, options will appear just like for other commands.

Basic File manipulation

Check metadata (Privilege, Size etc.)

ls -l
ls -l
ls -l

Basically the layout has 7 sections

File permissions + No. of hard links + File owner + Group the file belongs + File Size + File modification time + File Name

The 1st character represent file type

dFolder/Directory
File
sSocket
lLink

etc.

ls, output explained
ls, output explained

Following 9 characters:

r: Read, w: Write, x: Execute -: No privilege

The following group of three characters represent owner’s permission, next group of three characters represent the permission for the group which the user belongs to, last three characters represent privilege for others who is not owner and not the group the file belongs to.

Add “-h” switch together with “-l” to list files and folders with human readable size format

ls -hl
ls -hl
ls -hl

Add “-a” switch to show all files and folders including hidden ones

ls -al

We can also use stat to find detailed information about a file/folder/directory

stat filename

Output

[email protected]:/# stat home
   File: home
   Size: 4096            Blocks: 8          IO Block: 4096   directory
 Device: 801h/2049d      Inode: 5242881     Links: 2
 Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
 Access: 2020-01-05 15:31:07.026808761 +1100
 Modify: 2019-11-09 20:18:26.000000000 +1100
 Change: 2019-12-01 13:40:26.043449434 +1100
  Birth: -

Change/Modify file permission

Method 1: “chmod” with characters

+: Add, -: Remove, =: set permission.

a: all, o: others, u:user/owner,g:group

Set Read,Write,Execute rights for the file owner/user

chmod u=rwx a.txt

Add write permission for others

chmod o+w a.txt

Remove read permission from group

chmod g-r a.txt

Add execute permission for all users

chmod a+x a.sh

If we do not define which user/group etc to set the permission for. It will change the permission for all, including owner, group, others.

chmod +x a.sh

Method 2: “chmod” with numbers

4: r, 2: w, 1: x

They adds up in group of three.

Following command gives owner, group and others: rwx, rw, r permission. 7 = sum of r,w,x. 6 = sum of r, w. 1 = x.

chmod 761 a.txt

Change/Modify Access time/Modify time

Change access and modify time to 2001-01-01 00:00:01.000000000

touch -t 200101010000.01 file
touch -t 200101010000.01 a
touch -t 200101010000.01 a

Other ways to define date/time

touch -d "2001-01-01 00:00:01" -a file
 
touch -d "5 hours ago" -a file
 
touch -d "next monday" -m file

-d: Human readable date format

-a: access time

-m: modification time

Find out File type

file FileName
file /folder/*
file *
file *
file FileName
file FileName

Can’t run downloaded Program/Execute script etc.

We need to give the program or the script execute permission for it to run.

We can use “chmod” command which we have mentioned before.

Folder/Directory/File disk usage

#All file and folders under this folder
du -h *
du -h *, ls-hl
du -h *, ls-hl

-h switch represents human readable unit

Note: “du” outputs size occupied on the disk not the actual file size, whereas “ls -hl” outputs file size.

du -h a.png
du -h a.png
a.png Properties in Microsoft Windows
a.png Properties in Microsoft Windows

-s: Show total size of all files and sub-folders

-S: Show size of individual folders

du -hs
du -hS
du -hs, du -hS
du -hs, du -hS

Use “df” to show size of system folders

df
df -h
df -h, df
df -h, df

Compress/Extract file/Archive file

Deal with .tar, .tar.gz, .bz2 files

Create archive (.tar)

tar -cvf archive.tar folderName/

-c: Create archive

-v: Show files added to tarball

-f: Specify file name

Extract archive

tar -xvf archive.tar

-x: Extract

(-C: To extract to other location)

Create archive (.tar.gz, .tar.bz2)

To create “.tar.gz” use “-z”

tar -zcvf archive.tar.gz folderName/

To create “tar.bz2” use “-j”

tar -jcvf archive.tar.bz2 folderName/

To list content within archive file

tar -tvf archive.tar
tar -tvf archive.tar.gz
tar -tvf archive.tar.bz2

To extract “.tar.gz” and “tar.bz2”

tar -zxvf archive.tar.gz
tar -jxvf archive.tarb.z2

Extract to specific directory/folder

tar -zxvf archive.tar.gz --directory /folder/path
tar -jxvf archive.tarb.z2 --directory /folder/path

Perameters

  • x : Extract files
  • f : Tar archive name
  • –directory : Set directory name to extract files
  • -C : Set dir name to extract files
  • -j : Work on .tar.gz file format
  • -z : Work on .tar.bz2 file format
  • -v : Verbose output i.e. show progress on screen

Create Zip file

zip -r archive.zip folder
zip -r archive.zip folder1 folder2
zip archive.zip /path/to/folder1 /path/to/folder2

Extract Zip file

#Extract archive.zip to tmp folder
unzip archive.zip -d /tmp

View and Save output from command at same time, Output to two files at same time

We will use “tee” command

#echo "test" on screen and output to "1.txt" file
echo "test" | tee 1.txt
#echo "test" on screen and output to file "1.txt" and "2.txt"
echo "test" | tee 1.txt > 2.txt

Linux, Ubuntu etc. How to find where the program is installed

Keywords: Linux, Unix, Ubuntu, Kali Linux, Debian, where the program is installed, where the package is installed, program location, software location, package location, package path, program path, software path, installation path, installation location

whereis command

whereis packagname
 
#e.g.
whereis apache2
whereis apache2
whereis apache2
Usage:
 whereis [options] [-BMS … -f] 
Locate the binary, source, and manual-page files for a command.
Options:
-b         search only for binaries
-B   define binaries lookup path
-m         search only for manuals and infos
-M   define man and info lookup path
-s         search only for sources
-S   define sources lookup path
-f         terminate  argument list
-u         search for unusual entries
-l         output effective lookup paths
-h, --help     display this help
-V, --version  display version

which command

which filename
 
#e.g.
which apache2
which apache2 mysql
which apache2, which apache2 mysql
which apache2, which apache2 mysql
Usage:
 which which [filename1] [filename2] …
which command in Linux is a command which is used to locate the executable file associated with the given command by searching it in the path environment variable. It has 3 return status as follows:
0 : If all specified commands are found and executable.
1 : If one or more specified commands is nonexistent or not executable.
2 : If an invalid option is specified. 

find command

find / -name packagename
 
#e.g.
find / -name apache2
find / -name apache2
find / -name apache2