Modifying DNS Entry for Domain

Search /etc/named.conf to find the zone file for the domain.

Find the domain name and see where the zone file is.  Example zone block.

zone "incredigeek.com" in {
 type master;
 file "/var/named/mzones/incredigeek.com.hosts";
 allow-query { any; };
 forwarders {};
};

The file is /var/named/mzones/incredigeek.com.hosts

Edit your zone file by opening it up in a text editor.

Example.  Text in bold added for comments.

$TTL 21600
$ORIGIN com.
incredigeek IN SOA dns1.dns-server.com. dns2.dns-server.com.(
 0000147 ; serial  <- This needs to be incremented so it is greater than the previous version of this file
 43200 ; refresh (12 hours)
 7200 ; retry (2 hours)
 604800 ; expire (7 days)
 21600 ) ; minimum
 NS dns1.dns-server.com.
 NS dns2.dns-server.com.
 300 A 10.0.0.11   <- A record for root domain
$ORIGIN incredigeek.com.
localhost IN A 127.0.0.1
www 300 IN A 10.0.0.11  <- www subdomain A record
login 300 IN A 10.0.0.12 <- another subdomain A record

Save file and reload Bind

On FreeBSD

rndc reload incredigeek.com

you can reload everything with

rndc reload

On Fedora/CentOS/REHL

service named reload

On Ubuntu/Debian

service bind9 restart

You may need to reload Bind on any slave servers

How to install Broadcom WiFi drivers in Fedora 27

Install RPM Fusion

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Install packages

sudo dnf install -y kernel-devel-$(uname -r)
sudo dnf install -y akmodssudo dnf install -y broadcom-wl

Give the computer a reboot and the Broadcom card should now work.

Install Hashcat Utils

Hashcat - Kali Linux

Hashcat on Kali Linux

Here is a quick way to download and install the Hashcat utils.

Download the Hashcat utils

wget https://github.com/hashcat/hashcat-utils/archive/master.zip

Run the following commands to unzip and make the binaries

unzip master.zip
cd hashcat-utils-master/src
make

You can now convert an aircrack file by invoking the cap2hccapx binary

./cap2hccapx.bin /path/to/aircrack.cap /path/for/output

Check out the following article for more details on converting Aircrack files to Hashcat hccapx

Need to install Hashcat on Fedora?

How to convert an Aircrack capture file to a Hashcat hccapx

Using Aircrack

aircrack-ng input.cap -J hashcat_output

Unfortunately the above command doesn’t seem to work anymore.

If you try to run Hashcat with the outputted file you’ll get an error.

hashcat_output.hccap: Old hccap format detected! You need to update: https://hashcat.net/q/hccapx

Using Hashcat utils

Refer to this guide for installing the Hashcat utils.

Basic syntax is

./cap2hccapx.bin input.cap output.hccapx

Example

~/Downloads/hashcat-utils-master/src/cap2hccapx.bin aircrack-01.cap aircrack.hccapx

Allow KDE Connect through firewall

Firewalld

sudo firewall-cmd --zone=public --permanent --add-port=1714-1764/tcp
sudo firewall-cmd --zone=public --permanent --add-port=1714-1764/udp
sudo systemctl restart firewalld.service

UFW firewall

sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp
sudo ufw reload

More information https://community.kde.org/KDEConnect

Increase Disk Size of Linux VM in VMware

This is for extending a regular Ubuntu Linux partition, if you need to resize, expand a LVM partition refer to this guide.  I am using Gparted as I ran into some issues using parted for moving the partitions around.

Shut the VM down,

sudo shutdown -h now

It is a good idea to take a snapshot of the VM before resizing the disk, so if you run into an issue you have something to revert back to.  In the vSphere Client, right click on the VM -> Snapshot -> Take Snapshot.

Change VM Disk size by right clicking on the VM and going to Edit Settings

You can now boot up the VM.  Fire up GParted and it should show some unallocated space at the end of your drive.

Now in the next two images we are moving the Extended partition, which contains the Swap Partition to the end of the drive, so the unallocated space is adjacent to our root partition.

  1. Turn off the swap space by right clicking on the swap partition and hit Swapoff.
  2. Right click on the extended partition and extend to the the end of the Drive
  3. Right click on linux-swap and move to the end of drive.
  4. You should now have something similar to this

Hit Apply and write the changes to the disk then

  1. Right click on the extended partition and shrink to the end
  2. Right click on /dev/sda1 “Root partition” and extend to extended partition.

It should now look like this

Hit apply, then right click on the linux-swap and turn Swapon.

Enjoy the extra space.

Parted resizing notes

Launch parted with the following command.  Specify the disk you want to modify.  In this case /dev/sda.

sudo parted /dev/sda

Print partition and available free space.  If you just run print, it will not show you the available free space.

(parted) print free

You can resize, or rather extend a partition using the “resizepart” command inside parted.  Command syntax is as follows

(parted) resizepart PartitionNumber End

Example: Resize partition 1 to 30GB.  Note you’ll need to specify the end part with the GB, otherwise, you’ll be shrinking the partition or making a mess…  You can see what space is available with the “print free” command above

(parted) resizepart 1 30GB

After you have run the resizepart in parted, you’ll need to grow the filesystem, so run one of the following commands from the local shell.

resize2fs /dev/sda1

Or for XFS partitions

xfs_growfs /dev/sda1

You can check the partition size with

df -h

or

sudo fdisk -l /dev/sda

Setup Secure FTP server on CentOS

Setup SFTP Server

When finished you’ll have a SFTP server setup that is configured so the users are in a chroot environment, and can not ssh, or telnet to the server.

Install SSH server if it is not already

yum install openssh-server openssh-client

Create group that is limited to sftp so they can’t ssh, scp etc.

groupadd sftpusers

Add chroot settings to /etc/ssh/sshd_config.  The %u is a variable, which is the users username.

Match Group sftpusers
ChrootDirectory /sftp/%u
ForceCommand internal-sftp

Make ftp directory

mkdir /sftp

Add SFTP user

useradd -g sftpusers -d /sftp -s /sbin/nologin newsftpuser

Create password for new user

passwd newsftpuser

Create directory for user

mkdir /sftp/newsftpuser

Create directory to put ftp files

mkdir /sftp/newsftpuser/files

Change permissions

chown newsftpuser:sftpusers /sftp/newsftpuser/files/

Restart sshd

systemctl restart sshd

Should be good to go.  Test it by logging in with your favorite FTP client.

Add Self Signed SSL certificate to LibreNMS in CentOS

Install mod_ssl

yum install mod_ssl -y

Create Directory for SSL key.

mkdir /etc/ssl/key
chmod 700 /etc/ssl/key

Create certificate.

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/pki/tls/certs/localhost.crt

Fill out the info or what is applicable.

Now edit the LibreNMS Apache config file /etc/httpd/conf.d/librenms.conf

All you have to do is add the following three lines under the VirtualHost and change *:80 to *:443.

SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSL CertificateKeyFile /etc/pki/tls/private/localhost.key

So when your finished the file should look like this.

<VirtualHost *:443>
 DocumentRoot /opt/librenms/html/
 ServerName server_hostname_or_IP
 SSLEngine on
 SSLCertificateFile /etc/pki/tls/certs/localhost.crt
 SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
 CustomLog /opt/librenms/logs/access_log combined
 ErrorLog /opt/librenms/logs/error_log
 AllowEncodedSlashes NoDecode
 <Directory "/opt/librenms/html/">
 Require all granted
 AllowOverride All
 Options FollowSymLinks MultiViews
 </Directory>
</VirtualHost>

Don’t forget to allow https/port 443 traffic through the firewall.  Guide here

If you have any issues, you may need to chmod the key and crt file.

chmod 644 /etc/pki/tls/certs/localhost.crt
chmod 644 /etc/pki/tls/private/localhost.key

You should now be able to access LibreNMS using https.  Note, you’ll need to allow an exception in your browser for your self signed certificate.

https://LibreNMS_IP_Address