Posts

Showing posts with the label nano

https://www.vultr.com

The Everywhere Cloud

Deploy an instance.
Accelerate your application.


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...

Enabling REST Apps in Home Assistant

Image
The following procedure shows how to make Home Assistant communicate periodically [ every thirty (30) seconds, by default ] with other endpoints like remote devices or web services. This is made possible by the polling mechanism of its REST "sensor" platform. By default, the "sensor" polls those endpoints for new data every thirty seconds. ========== 1. Log in as the system account (-u), with $HOME "bin" included in $PATH (-i). user@host: $ sudo -i -u homeassistant 2. Go to the directory containing the YAML configuration files. user@host: $ cd ~/.homeassistant 3. BACK UP the main YAML configuration file. user@host: $ cp configuration.yaml configuration_yaml.back 4. Open the main YAML configuration file. user@host: $ nano configuration.yaml 5. Add the following YAML lines and save the file. # BEGIN CODE # ... sensor:   - platform: rest     name: "Dyn Check IP"     resource: http://checkip.dyn.com     method: GET...

Enabling HTTPS in Home Assistant

Image
The following procedure activates HTTPS for the Home Assistant server. The secure protocol uses TLS/SSL certificates to encrypt the data transferred between user and server. Although it is possible to make this home automation system, whether in  Linux or  FreeBSD , accessible over the Internet, Home Assistant is usually operated within private networks, either physical or virtual. In this case, self-signed certificates may be acceptable to use and quicker to deploy. ========== 1. Log in as the system account. 1.1. Linux, with $HOME "bin" included in $PATH (-i) of system account (-u). user@host: $ sudo -i -u homeassistant 1.2. FreeBSD, coming from "root" superuser. root@host: # su - homeassistant 2. Go to the Home Assistant configuration directory. user@host: $ cd ~/.homeassistant 3. Make a directory for SSL certificates. user@host: $ mkdir ssl 4. Ensure that only the system account and members of its group can access the directory. user@host:...

Self-Signed Certs for Apache in Debian-based Linux

Image
The following procedure shows how to apply self-signed certificates to the Apache web server in Debian-based Linux distributions. After creating and installing  the TLS/SSL certificate/key pair, they can be utilized to  secure Debian-based Linux 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. Go to the directory containing the Apache site configuration files. user@host: $ cd /etc/apache2/sites-available 2.  BACK UP the default HTTPS configuration file for the secure site. user@host: $ sudo cp default-ssl.conf default-ssl-conf.back 3. Open the default HTTPS configuration file. user@host: $ sudo nano default-ssl.conf 4. Find and modify the following Apache directives. # BEGIN CODE # ... SSLCertificateFile /etc/ssl/certs/myserver.crt # The self-signed certificate. SSLCertificateKeyFile /...

Enabling .htaccess in Apache for Drupal

Image
Content management systems like Drupal require specific web server directives in order to work properly. The following steps enable Apache to recognize .htaccess files containing those specific web server directives. The steps outlined here require the use HTTPS for better security on both Debian-based Linux distributions and the FreeBSD operating system . ========== 1. DEBIAN-BASED LINUX DISTRIBUTIONS 1.1. Go to the directory containing the Apache site configuration files. user@host: $ cd /etc/apache2/sites-available 1.2.  BACK UP the default HTTPS configuration file for the secure site. user@host: $ sudo cp 000-default-ssl.conf 000-default-ssl-conf.back 1.3. Open the default HTTPS configuration file. user@host: $ sudo nano 000-default-ssl.conf 1.4. Find the "DocumentRoot" section and add the "Directory" block marked "For Drupal" as follows. # BEGIN CODE <IfModule mod_ssl.c>         <VirtualHost _default_:443> # .....

Redirect Apache HTTP to HTTPS in Debian-based Linux

Image
Once HTTPS is enabled on the web server, remote users can be redirected to this secure protocol by automatically rewriting the URL. ========== 1. Enable the Rewrite module. user@host: $  sudo a2enmod rewrite 2. Change the current working directory to the Apache site configuration files. user@host: $ cd /etc/apache2/sites-available 3.  BACK UP the default HTTP configuration file for the non-secure site. user@host: $ sudo cp 000-default.conf 000-default-conf.back 4. Open the default HTTP configuration file. user@host: $ sudo nano 000-default.conf 5. Replace all contents in the default HTTP configuration with the following code. # BEGIN CODE RewriteEngine On # Enables directives for rewriting. RewriteCond %{HTTPS} !=on # Verifies that the connection is not yet in HTTPS. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] # Redirects to the current location but in HTTPS. # END CODE 6. Restart the web serve...

Disable Web Server Signatures in Debian-based Linux

Image
Hide server details from potential online threats in a few easy steps. ========== 1. Open the Apache security configuration file. user@host: $ sudo nano /etc/apache2/conf-enabled/security.conf 2. 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 3. List the PHP "x.y" versions available and open the configuration file of the appropriate version. user@host: $ ls -lha /etc/php user@host: $ sudo nano /etc/php/x.y/apache2/php.ini 4. Find and modify the following PHP config. ; BEGIN CODE ; ... expose_php = Off ; "Off" removes the PHP signature sent by the server in its HTTP response header. ; More info at https://php.net/expose-php ; ... ; END CODE 5. Restart the ser...