Setting up ELK in Azure with Bitnami

To get started with using ELk in Azure, do the following:

Create a VM using the ‘ELK Certified by Bitnami‘ image.

Next, you’ll need to get the credentials to log into the application – look into the serial log of Boot Diagnostics of the VM to access the username and password. If needed, a guide is available.

Access the public IP of the VM created, and log in using the credentials above. Kibana should open up and allow for importing sample data.

Once set up, the first thing to do is reset the default password – you can do that with:

sudo htpasswd -c /opt/bitnami/kibana/conf/password user

More information here.

Send Logs from AKS

To send logs from AKS, set up Fluentd, making sure to open port 9200 to the cluster IP.

Set up Azure AD Authentication

To set up Azure AD Authentication, an Azure AD Premium subscription is required. A guide can be found at Elastic’s site.

Upgrading PHP in Ubuntu

Before doing this, I recommend backing up your system, in case things go wrong.

To upgrade to the latest version of PHP in Ubuntu, first, update the system:

sudo apt-get update && sudo apt-get upgrade

Then add the third-party repository:

sudo apt-get install software-properties-common && sudo add-apt-repository ppa:ondrej/php && sudo apt-get update

Finally, upgrade PHP to the latest version:

sudo apt-get install php7.4

If upgrading PHP for WordPress, you’ll need a few more modules:

sudo apt-get install php7.4-mysql php7.4-curl php7.4-dom php7.4-imagick php7.4-mbstring php7.4-zip php7.4-gd

If using Apache, you’ll need to set the correct PHP version:

# list modules
sudo apache2ctl -M

# deactivate old PHP
sudo a2dismod php7.2

#activate new PHP
sudo a2enmod php7.4

#restart apache
sudo systemctl restart apache2

Using Azure Storage to Backup Data

If you’re looking for an easy and cheap way to back up infrequently used data, you can set up a storage account in Azure with the following settings:

  • Location: closest to your location.
  • Performance: Standard.
  • Account Kind: BlobStorage
  • Replication: Locally-redundant storage
  • Access tier: Cool

After the storage account is created, you can upload your compressed files (suggested to maximize efficiency) to containers inside the storage account.

Once the files are uploaded, you have the option to change to the Archive access tier, which is useful for files you don’t plan on accessing frequently. This data, if ever needed, will take much longer to access.

My suggestion on above – stick to the cool tier and when looking for ways to save money on costs, change different blobs to archive tier as you find you won’t need to access.

Check out more details on pricing and more details on different access tiers.

Configuring Arch Linux

If you’re installed Arch Linux, the next step is configuring the system to work as desired. In this guide, I walk through my general configuration of a newly installed Arch Linux instance.

Configure Internet

Set up networkmanager and if wireless, connect to an internet source:

sudo systemctl enable NetworkManager.service
sudo systemctl start NetworkManager.service

# connect to wireless
nmcli device wifi list
nmcli device wifi connect SSID password PASSWORD

Confirm access using ping.

Set up Desktop Environment

Set up xorg by install the following packages:

  • xorg
  • xterm
  • xorg-xinit
  • xorg-xclock
  • xorg-twm

Test by starting startx.

Install the following packages to set up the window and display manager

  • awesome
  • lightdm
  • lightdm-gtk-greeter
  • (if desktop)
    • nvidia
    • nvidia-settings
    • pkg-config

Configure LightDM:

sudo systemctl enable lightdm.service
sudo systemctl start lightdm.service

You should now have a graphical display running.

Configure Desktop Environment

First, set up firefox and sign in to sync all current changes.

Set up Multi-Monitors

If using multiple monitors, set them up:

sudo nvidia-xconfig

Reboot computer, then run:

sudo nvidia-settings

Save settings to the X config file.

Set up Dropbox

To configure the graphical system, get Dropbox synced to be able to use saved entries. First, install yay:

sudo pacman -S base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Then import public key:

gpg --recv-keys --keyserver hkp://pgp.mit.edu:80 FC918B335044912E

Install Dropbox:

yay -S dropbox

Finally, start and sign in to Dropbox.

Link Existing Configurations

Make symlinks for the following:

mkdir ~/.config/awesome
ln -s ~/Dropbox/config/rc.lua ~/.config/awesome/rc.lua
ln -s ~/Dropbox/config/Xresources-desktop ~/.Xresources

Reboot.

Setting up Laptop

Install the following packages:

  • cbatticon
  • acpilight

To make backlight changes using keyboard shortcuts, edit the /etc/rc.local file.

chgrp -R backlighters /sys/class/backlight
chmod g+w /sys/class/backlight/*/*

Then add your user to the ‘backlighters’ group:

sudo groupadd backlighters
sudo usermod -aG backlighters dfar

Restart and test the ability to inc/dec backlight with Fn+F11/F12

Installing and Configure Software

Essentials

Install nautilus, flameshot, evince, and calc.

Using yay, install systemd-numlockontty, and then enable numLockOnTty

sudo systemctl enable numLockOnTty

Web Browsing/Mail/Chat

Install qbittorrent, gnome-keyring, and libsecret.

Install mailspring via yay, then add accounts, set to dark, and set signature.

Install franz via yay and sign in to all accounts, then turn on dark more and turn off todos.

Sound/Video Management

Install vlc, pulseaudio, pasystray, and pavucontrol.

Software Development

Install the following packages:

  • code
  • dotnet-sdk
  • otf-fira-code
  • nodejs
  • terraform
  • intellij-idea-community-edition
  • insomnia (yay)
  • azure-cli (yay)
  • azure-functions-core-tools-bin (yay)
  • azuredatastudio (yay)

Sync settings in VSCode.

Networking

For VPN, install openvpn, network-manager-applet, and networkmanager-openvpn. Connect to all OpenVPN instances (log in using web and download profiles).

For RDP, install remmina and freerdp, then connect to all RDP boxes.

Virtualization

Install gnome-boxes, then create a Win10 box with 8GB memory, 100GB HDD. Install the following software using chocolatey:

  • git
  • visualstudio2019community
  • sql-server-management-studio
  • sql-server-express

Scanner/Printer

Install sane and imagescan. Then run utsushi for scanning.

For printing, install cups, nss-mdns, avahi, python-gobject, pygtk, python-dbus, and then enable and start the services:

sudo systemctl enable org.cups.cupsd.service
sudo systemctl start org.cups.cupsd.service
sudo systemctl start avahi-daemon.service

Edit /etc/nsswitch.conf and change the hosts line to include before resolve and dns:

mdns_minimal [NOTFOUND=return]

Now find the printer’s IP address:

avahi-discover

And add the printer:

lpadmin -p OfficePrinter -E -v ipp://IP_ADDRESS/ipp/print -m everywhere

Installing Arch Linux

Setting up USB Boot Media

Windows – use Rufus (you may need to use GPT && DD image mode)

Installation

First, boot the Arch Linux USB stick onto the computer of choice. After finished loading, you should see a command terminal.

To increase font size during install, use:

setfont /usr/share/kbd/consolefonts/latarcyrheb-sun32.psfu.gz

Connect To Internet

Wired, use ping to confirm access.

Wireless – run: wifi-menu -o, select a network, then verify access using ping.

Synchronize Clock

To set the clock, run:

timedatectl set-ntp true
timedatectl status

Set up Partitions

If needed, set up partitions for the overall system. First, use parted -l to determine both:

  • Which disk you want to use
  • Whether partition table is GPT

If needed, convert to GPT using fdisk disk.

Use cfdisk to create the following partitions (remember when sizing, you can use +512M for ease):

Mount PointPartitionPartition TypeSize
/mnt/boot/dev/sda1EFI System512MB
/mnt/dev/sda2Linux root (x86-64)remaining
SWAP/dev/sda3Linux swap8GB

Format & Mount Partitions

Now format the partitions (using parted -l to list disks):

mkfs.fat <EFI_DISK>
mkfs.ext4 <PRIMARY_DISK>
mkswap <SWAP_DISK>
swapon <SWAP_DISK>

Mount the newly formatted partitions:

mount <PRIMARY_DISK> /mnt
mkdir /mnt/boot
mount <EFI_DISK> /mnt/boot

Perform Arch Installation

Edit the /etc/pacman.d/mirrorlist file and set it to have just 12 United States entries.

Install base Arch Linux:

pacstrap /mnt base linux linux-firmware nano grub efibootmgr networkmanager git firefox sudo

Generate an fstab file:

genfstab -U /mnt >> /mnt/etc/fstab

Change root into the new system to set time zone and localization:

arch-chroot /mnt

ln -sf /usr/share/zoneinfo/America/Detroit /etc/localtime
hwclock --systohc

Change the default console font size at /etc/vconsole.conf:

FONT=latarcyrheb-sun32

Generate locales and set locale:

# comment out needed locales
nano /etc/locale.gen
locale-gen

nano /etc/locale.conf

# set content to LANG=en_US.UTF-8

Set up network configuration (computer name):

# set computer name
nano /etc/hostname 

# configure hosts file, add contents below
nano /etc/hosts

127.0.0.1	localhost
::1		localhost
127.0.1.1	YOUR_HOSTNAME.localdomain	YOUR_HOSTNAME

Create a root password with passwd.

Configure GRUB boot loader:

grub-install /dev/sda --efi-directory=/boot

grub-mkconfig -o /boot/grub/grub.cfg

(Optional) Create Non-Root User

You’ll want to perform your daily activities without using the root user.

useradd -m dfar
passwd dfar
usermod -aG wheel,audio,video,optical,storage dfar

Edit the /etc/sudoers file and allow users of wheel group to execute any command.

Conclusion

Finally, reboot the system:

exit

shutdown now

To verify, remove the USB stick used for installation, and turn on the computer.

You should be able to log in as either the root user or the newly created user specified earlier. If you end up at the terminal, you’ve successfully installed Arch Linux!

Next step involves configuring the base system.

Test Disk I/O Benchmarks in Linux

To test read/write speeds of a drive in Linux, you can run dd to check write speed:

dd if=/dev/zero of=./test bs=512k count=2048 oflag=direct

and read speed (need to clear cache beforehand to get an accurate reading, read more):

sudo /sbin/sysctl -w vm.drop_caches=3
dd if=./test of=/dev/zero bs=512k count=2048

Should get a result like the following for write speed:

and read speed:

Forcing Delete of Azure Recovery Services Vault

When trying to delete a Recovery Services vault, you can run into issues with trying to actually delete the vault from the tenant – to solve this issue, you’ll have to use the CLI and Azure CLI to do this.

Before starting, make sure to disable soft delete within the vault as well, and then delete any currently existing soft delete items.

#login to tenant
az login

#get the item's container and item name
az backup item list --vault-name VAULT_NAME --resource-group RESOURCE_GROUP

#disable protection
az backup protection disable --container-name "CONTAINER_NAME" --delete-backup-data true --item-name "ITEM_NAME" --resource-group RESOURCE_GROUP --vault-name VAULT_NAME --yes --backup-management-type AzureIaasVM

#get list of policies
az backup policy list --vault-name VAULT_NAME --resource-group RG

#delete each policy
az backup policy delete --name POLICY_NAME --vault-name VAULT_NAME --resource-group RG

#delete vault
az backup vault delete --name VAULT_NAME --resource-group RG

Setting Up Ubuntu

Recently switched over to using Ubuntu from Windows due to having some issues with running Windows 10 on the desktop. Here’s a quick guide on what I did to get everything set up.

Installation

Pretty simple, just set up a USB stick with Ubuntu on it. When install, using the following configurations:

  • Minimal installation
  • Install third party tools (save time later)

Once the installation completes, I make sure to set up the display correctly for monitors, including:

  • Setting scale to %200
  • Turning on the night light

And then a few steps before installing software:

  • Set up Livepatch (security updates)
  • Unpin favorites
  • Signing into Firefox with my Firefox account.
  • Move Dock to the bottom.

Software

I install the following:

  • Dropbox
  • Franz (login, set dark mode, turn off todos, notifications)
  • Mailspring (dark theme, add accounts, turn notifications off)
  • VSCode (download FiraCode, sync settings)
  • PyGrid (set xdivs to 3, automatic startup)
  • Azure CLI
  • MySQL Workbench
  • OpenVPN Connect (sudo apt-get install openvpn, set up server profiles)
  • Remmina (for remoting into Windows PCs)
  • Terraform
  • kubectl
  • Gnome Tweak Tools (animations off, set dark theme, application menu off, 1 static workspace)
  • .NET Core SDK
    • Azure Functions Core Tools
  • VirtualBox (with a Windows 10 VM with 8GB memory, 100GB hard drive space) with the following installed:
    • VS2019
    • SSMS
    • SQL Server Express
    • Dropbox
    • Git

Setting Up WordPress With An Azure VM

This guide will walk though setting up a WordPress site using an Azure VM. Some of the perks of doing this are:

  • Cost-wise, you can spend as little as ~$8 a month to get a fully functional WordPress site running. If you try using MySQL and App Services in Azure, you’ll looking to spend ~$40 a month for worse specs.
  • You can scale the site up as needed if performance demands arise.

Procedure

Step 1: Create An Azure VM

First, create an Azure VM with the following specs:

  • Image of Ubuntu 18.04 LTS
  • Size of B1s (anything less and you’ll run into issues)
  • Azure Backup (optional, provides a means to restore VM from scratch)

Once the VM is set, set the following Network Security Group rules:

  • Public Access – ports 80/443
  • Private Access (such as your IP address) – ports 22/3306

Step 2: Set up LAMP Server

SSH into the server and install a LAMP server with the following:

sudo apt update && sudo apt -y install lamp-server^ php-curl php-dom php-mbstring php-imagick php-zip

After installation, verify correct installation:

apache2 -v && mysql -V && php -v

Step 3: Configure MySQL

Run the following:

sudo mysql_secure_installation

Do the following:

  • Install the Validate Password Plugin at “Medium”
  • Say yes to all options except “Disallow root login remotely”

Run a query to allow access:

sudo mysql -u root -p

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'GENERATED_PASSWORD' WITH GRANT OPTION; FLUSH PRIVILEGES;

exit

Edit the file /etc/mysql/mysql.conf.d/mysqld.cnf and comment out the bind-address line.

Restart MySQL:

sudo service mysql restart

Finally, test connecting to the database server using a tool like MySQL Workbench. When connected to the database server, do the following:

  • Create a DB (either copied from a migration or a fresh database)
  • Create a user that has access to the DB above.

Step 4: Install WordPress

Download and unzip WordPress into /var/www/html:

wget https://wordpress.org/latest.tar.gz
sudo tar -xzf latest.tar.gz -C /var/www/html --strip-components=1

Configure /etc/apache2/apache2.conf and allow AllowOverride to All in the /var/www directory.

Set the correct permissions for Apache:

sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;

sudo a2enmod rewrite && sudo systemctl restart apache2

As a final step, delete the index.html file from Apache:

sudo rm /var/www/html/index.html

You should now be able to run the WordPress installer and connect the database.

Once the WordPress Installer has run, log into the backend and check the site health to see if there are any misconfigurations within the system:

Optional Steps

Setting Up SSL With Let’s Encrypt

Before setting up SSL, you’ll need to set up a domain and set the appropriate DNS settings to be able to run the Let’s Encrypt process.

Enable SSL and restart Apache:

sudo a2enmod ssl && sudo a2ensite default-ssl && sudo systemctl reload apache2

Run the commands provided by CertBot.

Enable Mail

The easiest way to enable mail is to use the WP Mail SMTP plugin. Once configured, you can use the plugin to set up alongside the email carrier of choice and test the submission functionality.

Increase Upload Size

To increase upload size (for things like uploading themes/plugins/media), edit the /etc/php/7.2/apache2/php.ini file:

upload_max_filesize = 16M
post_max_size = 16M

Then restart Apache:

sudo service apache2 restart

Restore from a Backup

If opted into backup when creating the VM, the VM will have an automatic daily backup progress that you can use to restore the VM at any point.

To restore a new VM, access the Recovery Vault and go to Backup Items -> Your VM Name -> Restore VM. Once you go this, you have two options:

  • Completely create a new VM with the data restored.
  • Restore the disks into your current VM (VM must be turned off to do this).

Notes on Asperger Syndrome and Long-Term Relationships

This is an old read, decided to go through and skim it again to see if any of my thoughts have changed over time – I found that a lot of the things I highlighted from before, no longer apply. Maybe over time, things have just improved.

As I read this, I think about how a lot of the things mentioned about those with mild autism exhibit traits like:

  • Preference for structure
  • Depth over variety
  • Difficulty in social situations

A lot of these things sound like something an introverted person would prefer. Maybe just a correlation there.

The book mostly focuses on marriages between an Aspie and Neurotypical, and reads to the neurotypical. The variation is major, showing scenarios where the AS partner is pretty reasonable, and then having them be very hard to deal with.

Some other takeaways:

  • Aspies tend to stick with their first impression (I find this accurate)
  • Having a home is important for an Aspie, as it serves as a place of comfort.
  • The focusing tendencies of an Aspie makes for a double edged sword – easy to choose a single direction and move forward, but can cause tunnel vision.
  • Aspies don’t have a strong drive for socialization – which leads to a drive for less social activities.