Ron and Ella Wiki Page

Extremely Serious

Page 24 of 33

Schedule Certbot-Auto to Auto Renew Weekly with NGINX

  1. Create the file in /etc/cron.weekly/certbot-renewal using the following command
    sudo vi /etc/cron.weekly/certbot-renewal
  2. Place in the following in the file and save it:
    #!/bin/sh
    
    /usr/sbin/certbot-auto renew --no-bootstrap --no-self-upgrade --post-hook "service nginx restart"
  3. Change the mode of file to 755 using the following command:
    sudo chmod 755 /etc/cron.weekly/certbot-renewal

Securing Ubuntu SSH

  1. Update the /etc/ssh/sshd_config file to have the following added:
    PermitRootLogin no
  2. Install fail2ban using the following command:
    sudo apt-get install fail2ban
  3. Create the file /etc/fail2ban/jail.d/jail-debian.local file to have the following:
    [sshd]
     enabled = true
     port = ssh
     filter = sshd
     logpath = /var/log/auth.log
     maxretry = 6
     bantime = -1
    
  4. Restart the service using the following command:
    sudo service fail2ban restart

See Unbanning an IP

Using Scanner to Read a Text File

Reading a text file using java.util.Scanner in Java.

StringBuilder text = new StringBuilder();
try(Scanner scanner = new Scanner(new BufferedReader(new FileReader("<FILENAME>")))) {
    while(scanner.hasNext()) {
        text.append(scanner.nextLine()).append("\n");
    }
} catch (FileNotFoundException e) {
    e.printStackTrace();
}
System.out.println(text.toString());

Where:

FILENAME The text file to read.

Deploy Function using Azure Functions Core Tools

Use the following command to deploy a(some) locally developed function(s) to azure function app.

func azure functionapp publish <AZURE_FUNCTION_APP>

Note: This command will only work if your terminal session was signed in to azure. The login using the command found here.

Where:

AZURE_FUNCTION_APP The name of the function app found in azure portal.

Using Proxy with NodeJS

Execute the following command to set the proxy for HTTP:

npm config set proxy <HOST>:<PORT>

Execute the following command to set the proxy for HTTPS:

npm config set https-proxy <HOST>:<PORT>

Where:

HOST The host that is running the proxy server
PORT The port the proxy server is listening.
« Older posts Newer posts »