Posts


https://www.vultr.com

The Everywhere Cloud

Deploy an instance.
Accelerate your application.


Navigating IBM i with VS Code

Image
The following procedure shows how to connect to an IBM i (AS400) server and explore it using the Visual Studio Code Integrated Development Environment. ========== 1. INSTALLATION 1.1. Download and install the Visual Studio Code IDE. https://code.visualstudio.com/ 2. PREPARATION 2.1. On the VS Code menu, go to [ Go -> Go to File... ] or press Ctrl+P, and input the command below to install the "Code for IBM i" extension. ext install HalcyonTechLtd.code-for-ibmi 2.2. On the left sidebar, click on the IBM i icon to show the IBM i Servers panel and click on the plus "+" sign at the top to create a connection. 2.3. On the Login tab, input the following IBM i server details and click [ Connect ]. Connection Name: (just a placeholder name for easy identification) Host or IP Address: (network address of IBM i server)   SSH Port: 22 (usually) Username: (username on IBM i server) Password: (password on IBM i server) 3. UTILIZATION 3.1. User Library List Libraries are requir...

Developing ESP32 with Eclipse on Linux

Image
The following procedure shows how to build ESP32 microcontroller projects with the Eclipse Integrated Development Environment on Debian-based Linux distributions. ========== 1. INSTALLATION 1.1. Install Espressif's IoT Development Framework for ESP32 with the RTOS SDK. https://www.sysadsim.com/2022/09/using-esp-idf-on-linux.html 1.2. Download and install the Eclipse IDE. https://www.sysadsim.com/2022/09/installing-eclipse-ide-on-linux.html 2. PREPARATION 2.1. On the Eclipse IDE, click on the following to install ESP-IDF plugins for Eclipse. [ Help -> Install New Software -> Add... ] Name: Espressif IDF Plugin for Eclipse Location: https://dl.espressif.com/dl/idf-eclipse-plugin/updates/latest/ Click [ Add ]. Go to [ Espressif IDF dropdown ]. Check [ CMake Editor ]. Check [ Espressif IDF Plugins for Eclipse ]. Click [ Next -> Accept license terms -> Finish ]. Wait for plugins download and installation to complete. Click [ Select All -> Trust ] if asked to trust some so...

Developing ESP8266 with Eclipse on Linux

Image
The following procedure shows how to build ESP8266 microcontroller projects with the Eclipse Integrated Development Environment on Debian-based Linux distributions. ========== 1. INSTALLATION 1.1. Install Espressif's IoT Development Framework for ESP8266 with the RTOS SDK. https://www.sysadsim.com/2022/09/using-esp8266-rtos-sdk-on-linux.html 1.2. Download and install the Eclipse IDE. https://www.sysadsim.com/2022/09/installing-eclipse-ide-on-linux.html 2. PREPARATION 2.1. On the Eclipse IDE, click on the following to open the target ESP8266 project folder and choose its toolchain. [ File -> Import... ] [ C/C++ -> Existing Code as Makefile Project -> Next ] [ Existing Code Location -> Browse... ] Example: ~/esp/ESP8266_RTOS_SDK/examples/get-started/hello_world [ Toolchain for Indexer Settings -> Cross GCC -> Finish ] 2.2. Set up the project's properties. [ Project Explorer tab -> Right-click on project name -> Properties ] 2.2.1. C/C++ General Indexer Go ...

Developing ESP32 with VS Code on Linux

Image
The following procedure shows how to build ESP32 microcontroller projects with the Visual Studio Code Integrated Development Environment on Debian-based Linux distributions. ========== 1. INSTALLATION 1.1. Install Espressif's IoT Development Framework for ESP32 with the RTOS SDK. https://www.sysadsim.com/2022/09/using-esp-idf-on-linux.html 1.2. Download and install the Visual Studio Code IDE. https://code.visualstudio.com/ 2. PREPARATION 2.1. On the VS Code menu, go to [ File -> Open Folder... ] and open the target ESP32 project folder. Example: ~/esp/esp-idf/examples/get-started/hello_world 2.2. On its bottom panel, click on the Terminal tab. This will automatically change to the location of the opened folder. 2.3. Temporarily add the ESP-IDF toolchain to the shell path. user@host: $ . ~/esp/esp-idf/export.sh or user@host: $ source ~/esp/esp-idf/export.sh 2.4. Verify if the toolchain has been added to the shell path. user@host: $ echo $PATH 3. UTILIZATION 3.1. Maximize the bott...

Developing ESP8266 with VS Code on Linux

Image
The following procedure shows how to build ESP8266 microcontroller projects with the Visual Studio Code Integrated Development Environment on Debian-based Linux distributions. ========== 1. INSTALLATION 1.1. Install Espressif's IoT Development Framework for ESP8266 with the RTOS SDK. https://www.sysadsim.com/2022/09/using-esp8266-rtos-sdk-on-linux.html 1.2. Download and install the Visual Studio Code IDE. https://code.visualstudio.com/ 2. PREPARATION 2.1. On the VS Code menu, go to [ File -> Open Folder... ] and open the target ESP8266 project folder. Example: ~/esp/ESP8266_RTOS_SDK/examples/get-started/hello_world 2.2. On its bottom panel, click on the Terminal tab. This will automatically change to the location of the opened folder. 2.3. Temporarily add the ESP8266 IDF toolchain to the shell path. user@host: $ . ~/esp/ESP8266_RTOS_SDK/export.sh or user@host: $ source ~/esp/ESP8266_RTOS_SDK/export.sh 2.4. Verify if the toolchain has been added to the shell path. user@host:...

Using the ESP-IDF on Linux

Image
The following procedure shows how to use Espressif's Internet-of-Things Development Framework for ESP32 microcontrollers on Debian-based Linux distributions. The ESP-IDF uses the Real-Time Operating System (RTOS) Software Development Kit (SDK). ========== 1. INSTALLATION 1.1. Update package indexes and install the prerequisites. user@host: $ sudo apt-get update user@host: $ sudo apt-get install bison libbison-dev user@host: $ sudo apt-get install cmake user@host: $ sudo apt-get install flex libfl-dev libfl2 user@host: $ sudo apt-get install git user@host: $ sudo apt-get install gperf user@host: $ sudo apt-get install libncurses-dev user@host: $ sudo apt-get install python3 python3-dev python3-pip python3-venv python3-wheel 1.2. Clone the development repository from GitHub. This will download to a directory with the same name. user@host: $ mkdir esp user@host: $ cd esp user@host: $ git clone --recursive https://github.com/espressif/esp-idf.git 1.2.1. For specific releases, clone the...

Using the ESP8266 RTOS SDK on Linux

Image
The following procedure shows how to use Espressif's Real-Time Operating System Software Development Kit for ESP8266 microcontrollers on Debian-based Linux distributions. ========== 1. INSTALLATION 1.1. Update package indexes and install the prerequisites. user@host: $ sudo apt-get update user@host: $ sudo apt-get install bison libbison-dev user@host: $ sudo apt-get install cmake user@host: $ sudo apt-get install flex libfl-dev libfl2 user@host: $ sudo apt-get install git user@host: $ sudo apt-get install gperf user@host: $ sudo apt-get install libncurses-dev user@host: $ sudo apt-get install python3 python3-dev python3-pip python3-venv python3-wheel 1.2. Clone the repository from GitHub. This will download to a directory with the same name. user@host: $ mkdir esp user@host: $ cd esp user@host: $ git clone --recursive https://github.com/espressif/ESP8266_RTOS_SDK.git 1.3. Install the Python packages required by the ESP8266 Internet-of-Things Development Framework. user@host: $ cd E...

Installing the Eclipse IDE on Linux

Image
The following procedure shows how to quickly install the Eclipse Integrated Development Environment on desktop Linux distributions. ========== 1. Download the Eclipse tarball at [ https://www.eclipse.org/downloads/ ]. 2. Open a terminal and extract the installer folder. user@host: $ tar -xf eclipse-inst-jre-linux64.tar.gz 3. Run the installer to launch the graphical user interface. user@host: $ cd eclipse-installer user@host: $ ./eclipse-inst 4. On the GUI, choose the desired package. 4.1. For C/C++ programming, select [ Eclipse IDE for Embedded C/C++ Developers ]. 4.1.1. Use the suggested defaults and click [ Install ]. 4.1.2. When the installation is finished, click [ Launch ]. 4.1.3. Use the suggested Workspace and click [ Launch ]. ==========

Monitoring network traffic with tcpdump

Image
The following procedure demonstrates how to use tcpdump to sniff and log packets going in and out of a machine's network interfaces. ========== 1. Identify the network interfaces available. user@host: $ tcpdump --list-interfaces 1.wlp6s0 [Up, Running] 2.lo [Up, Running, Loopback] 3.any (Pseudo-device that captures on all interfaces) [Up, Running] 4.enp5s0 [Up] 2. Set the sniffing tool to listen on a network interface for packets and send the output to a file for easy review later. 2.1. To and from a target port, such as HTTP, regardless of host. user@host: $ sudo tcpdump -A -i any -l -s 0 -vvv tcp port 80 > mytcpdumpout.txt 2>&1 2.2. To and from a target host, regardless of port. user@host: $  sudo tcpdump -A -i any -l -s 0 -vvv host nameOfMachine > mytcpdumpout.txt 2>&1 2.3. The flags used to adjust the behavior of tcpdump are as follows. [ -A ] prints packets in ASCII format and make them readable, excluding data link layer headers. [ -i any ] c...

Accessing the GlobalProtect VPN via Terminal

Image
The following procedure demonstrates how to connect to the GlobalProtect VPN via command-line terminals. ========== 1. Install openconnect (at least version 8) and dnsmasq. 1.1. Debian-based Linux user@host: $ sudo apt-get update user@host: $ sudo apt-get install openconnect dnsmasq 2. Make a simple shell script to automate the login. #!/bin/sh #BEGIN CODE with the shebang above. user=`whoami`; if [ $user != "root" ]; then echo "sudo required"; exit; fi echo -n "VPN_PASSWORD" | sudo openconnect --protocol=gp --user=VPN_USERNAME --passwd-on-stdin https://VPN_DOMAIN_NAME #END CODE 3. Save the shell script and execute. 3.1. Using the shell command. user@host: $ sh myshellscript.sh 3.2. By itself after changing the mode to executable. user@host: $ chmod +x myshellscript.sh user@host: $ ./myshellscript.sh ==========

Using cURL for response timing

Image
cURL is a command-line tool that connects to a uniform resource locator (URL) for data transfer. Although this tool is commonly used to quickly check if websites are up and running, it can also be used to time the response of services. This may help administrators gather data for analysis to match against baseline response times for performance tuning. cURL has many options or flags available to adjust its behavior. For the purpose of timing, the following flags shall be utilized. [ -k ] tells cURL to disable peer verification of the SSL/TLS certificate. This is useful for connecting to URLs that have  self-signed certificates . [ -s ] tells cURL to operate in silent mode. This suppresses standard error messages and the progress meter. [ -o /dev/null ] tells cURL to dump its standard output to the null device. All messages are effectively discarded and no output file is produced. [ -w '%{time_total}\n' ] tells cURL to write the declared variables to standard output after all tr...

Installing Node.js on Linux

Image
Node.js is a runtime environment that allows JavaScript to be executed directly on the operating system. This enables the use of JavaScript to develop server-side applications. In some Linux distributions, the Node.js implementation may not be properly maintained and may lag from the releases of its official website. The following procedure shows how to manually acquire and install Node.js in order to have the most recent packages. ========== 1. Download the desired Node.js version. 1.1. Node.js x64 and other 64-bit Long-term Support (LTS) https://nodejs.org/en/download/ user@host: $ wget https://nodejs.org/dist/v [ ersionNum ] /node-v [ ersionNum ] -linux-[CPU64].tar.xz user@host: $ tar -xf node-v [ ersionNum ] -linux-[CPU64].tar.xz user@host: $ cd node-v [ ersionNum ] -linux-[CPU64] 1.2. Node.js x64 and other 64-bit previous LTS https://nodejs.org/download/release/ user@host: $ wget https://nodejs.org/download/release/latest-v [ ersionMaj ].x /node-v[ersionNum]-linux-[C...

Running Home Assistant on FreeBSD Servers

Image
Home Assistant is an open-source home automation system powered by Python, primarily intended to run on single-board computers like the Raspberry Pi, with Linux as the host operating system. The following procedure shows how to run Home Assistant Core on FreeBSD servers, on either physical or virtual machines. ========== 1. PREPARING THE SERVER 1.1. Update the package list and upgrade the existing packages. root@host: # pkg update && pkg upgrade -y 1.2. Install Python and other required packages. root@host: # pkg install python38 py38-sqlite3 openssl autoconf libffi rust 1.3. Create a system account with disabled login (-w no), a dedicated home directory (-m), and some informational text (-c comment). root@host: #  pw useradd homeassistant -w no -m -c "Home Assistant" 1.3.1. If groups for hardware input/output are present, append the system account. Else, skip this step for now. root@host: #  pw groupmod gpio -m homeassistant root@host: #  pw groupmod i2c -m ...

Running FreeBSD Commands at Startup

Image
The following procedure enables FreeBSD programs to start automatically after booting, without requiring users to log in first. This method is useful when automating custom daemons to act as servers with user-specific privileges. This is almost identical to the Linux procedure , except for one redirection parameter excluded here. ========== 1. Edit the user crontab file. user@host: $ crontab -e 2. Add the @reboot line with the desired command. # BEGIN CODE @reboot /myfolder/mydaemon.sh > /dev/null & # "> /dev/null" discards standard output by redirecting to the null device. # Terminating with "&" executes the command in the background. # END CODE 3. Save and exit crontab, then reboot the machine. ========== The default shell configured in an account's environment variables is used by crontab to process the listed commands. In Linux crontab , the default Bourne Again shell (bash) accepts parameters like "2>&1" which redirects standa...

Configuring the FreeBSD Firewall with IPFW

Image
IPFW is one of several firewalls included in FreeBSD by default. It has a command-line tool to handle the policies for incoming and outgoing connections. In the configurations discussed here, network connections "from any to any" are deliberately avoided to prevent potential bounce attacks from happening, if the server is not intended to act as a router. Instead, a request/respond or incoming/outgoing rule pair is adopted to direct the flow of network traffic. The main objective is to set up IPFW to block unauthorized remote access to unsecured ports on the server. But if attackers manage to break in through a vulnerability on some programs running on authorized incoming ports, the outgoing restrictions will prevent massive data exfiltration, stopping intruders dead in their tracks. A similar approach can be done on Debian-based Linux distributions using UFW . ========== 1. STRICT CONFIGURATION 1.1. Create a custom shell script for IPFW commands. root@host: #  ee /etc/...

Samba Print Client in Debian-based Linux

Image
The following procedure demonstrates how to enable Debian-based Linux distributions to access printers hosted on old Windows 7 machines via Samba protocols. This process has been tested on Epson L210 Series inkjet printers. ========== 1. Open the Samba configuration file. user@host: $ sudo nano -c /etc/samba/smb.conf 2. Under "Global Settings", specify the following protocols. # BEGIN CODE # ... [global] client min protocol = CORE client max protocol = NT1 # ... # END CODE 3. Temporarily stop the "Common Unix Printing System" (CUPS) service. user@host: $ sudo service cups stop 4. Open the CUPS printer configuration file. user@host: $ sudo nano -c /etc/cups/printers.conf 5. Find and modify (or add) the following directive. # BEGIN CODE # ... # UUID ... AuthInfoRequired username,password # This allows the printer service to receive user/pass authentication. # The words "username,password" must be written as is, not as actual user/pass. # ... # END CODE 6. St...

Redirect Apache HTTP to HTTPS in FreeBSD

Image
After enabling HTTPS on the web server in FreeBSD, remote users can be redirected to this secure protocol by automatically rewriting the URL. ========== 1. Log in to "root". Regular users must be part of the "wheel" group in order to do this. user@host: $ su - 2. Open the Apache main configuration file. root@host: # ee /usr/local/etc/apache24/httpd.conf 3. Find and uncomment the following Apache directives. # BEGIN CODE # ... LoadModule rewrite_module libexec/apache24/mod_rewrite.so # Apache rewrite engine Include etc/apache24/Includes/*.conf # Custom configuration files # ... # END CODE 4. Create a custom config file in the "Includes" directory. root@host: # ee /usr/local/etc/apache24/Includes/myrewrite.conf 5. Place the following code in the custom config file. # BEGIN CODE # ... RewriteEngine On # Enables directives for rewriting. RewriteCond %{HTTPS} !=on # Verifies that the connection is not yet in HTTPS. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$...

Enable Apache HTTPS in FreeBSD

Image
The following procedure activates HTTPS for the Apache web server in FreeBSD. This secure protocol uses TLS/SSL certificates to encrypt the data transferred between the remote user and the web server. Sensitive information is protected from being captured by malicious actors using sniffing tools along the network route. ========== 1. PREREQUISITES 1.1. Make a self-signed SSL certificate. [  Details  ] 2. ACTIVATION 2.1. Log in to "root". Regular users must be part of the "wheel" group in order to do this. user@host: $ su - 2.2. Open the Apache main configuration file. root@host: # ee /usr/local/etc/apache24/httpd.conf 2.3. Find and uncomment the following Apache directives. # BEGIN CODE # ... LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so # Needed by the "SSLSessionCache" directive in httpd-ssl.conf # ... LoadModule ssl_module libexec/apache24/mod_ssl.so # Needed by the "SSLCipherSuite" directive in httpd-ssl.conf # ... ...

Self-Signed Certs for Apache in FreeBSD

Image
The following procedure shows how to apply self-signed certificates to the Apache web server in FreeBSD. After  creating and installing the TLS/SSL certificate/key pair, they can be utilized to secure FreeBSD web services with encryption during the development and testing process. It is important to keep in mind that self-signing may be deemed UNTRUSTWORTHY in a production environment. ========== 1. Log in to "root". Regular users must be part of the "wheel" group in order to do this. user@host: $ su - 2. Go to the directory containing the Apache site configuration files. root@host: # cd /usr/local/etc/apache24/extra 3. BACK UP the default HTTPS configuration file for the secure site. root@host: # cp httpd-ssl.conf httpd-ssl-conf.back 4. Open the default HTTPS configuration file. root@host: # ee httpd-ssl.conf 5. Find and modify the following Apache directives. # BEGIN CODE # ... SSLCertificateFile "/usr/local/etc/apache24/server.crt" # The self-signe...

Disable Web Server Signatures in FreeBSD

Image
Hide server details from potential online threats in a few easy steps. ========== 1. Log in to "root". Regular users must be part of the "wheel" group in order to do this. user@host: $ su - 2. Open the Apache main configuration file. root@host: # ee /usr/local/etc/apache24/httpd.conf 3. Find and uncomment the following Apache directive. # BEGIN CODE # ... Include etc/apache24/extra/httpd-default.conf # Default config for the Apache web server. # ... # END CODE 4. Open the Apache default settings configuration file. root@host: # ee /usr/local/etc/apache24/extra/httpd-default.conf 5. Find and modify the following Apache directives. # BEGIN CODE # ... ServerTokens Prod # "Prod" reduces Apache info sent by the server in its HTTP response header. # ... ServerSignature Off # "Off" removes info on server, host, and port from error pages and other auto-generated docs. # ... # END CODE 6. Open the PHP configuration file. root@host: # ee /usr/local/etc/ph...