September 9 2022

fetchmail ssl error

Get the combined ssl fingerprint:

openssl s_client -connect email.server.wan:993 -showcerts | openssl x509 -fingerprint -noout -md5

Example fetchmailrc:

set logfile /home/user/fetchmail.log
poll email.server.wan proto pop3
user "loginnamehere" password "passwordhere"
ssl
sslcertpath "/home/user/.fetchmail/ssl"
#sslcertck
nokeep
mda "/usr/bin/procmail -f %F -d %T";
sslfingerprint 'md5 thumbprint separated by :'s from first step'

The running script, print attachments with cups

#!/bin/bash
echo -n $(date +%m-%d-%Y_%H:%M:%S) ":>> " >> fetchmail.log
SUPPORTED_FILETYPES=.pdf.jpg
LP_OPTIONS="-d MFCL2710DN -o media=A4,tray1 -o fit-to-page -o position=top -o scaling=100"
FILENAME=$(date +%H%M%S).txt
/usr/bin/fetchmail --bsmtp ~/mailtemp/$FILENAME
if [ "$?" = "0" ]; then
/usr/bin/uudeview +e $SUPPORTED_FILETYPES -p ~/printable -i ~/mailtemp/$FILENAME
# rm ~/mailtemp/$FILENAME

for f in ~/printable/*
do
lp $LP_OPTIONS $f
rm $f
done
fi

https://www.linuxquestions.org/questions/linux-server-73/fetchmail-809435/

How to fix ssl certificate issue on fetchmail

Category: Uncategorized | Comments Off on fetchmail ssl error
March 9 2022

UniFi Site Controller custom SSL

Download the script:

sudo wget https://raw.githubusercontent.com/stevejenkins/unifi-linux-utils/master/unifi_ssl_import.sh -O /usr/local/bin/unifi_ssl_import.sh

Edit the variables in the script

Add your domain
UNIFI_HOSTNAME=unifi.yourdomain.com

Comment the three lines for Fedora/RedHat/Centos by placing a # for it:
# Uncomment following three lines for Fedora/RedHat/CentOS
#UNIFI_DIR=/opt/UniFi
#JAVA_DIR=${UNIFI_DIR}
#KEYSTORE=${UNIFI_DIR}/data/keystore

Uncomment the three lines for Debian/Ubuntu
# Uncomment following three lines for Debian/Ubuntu
UNIFI_DIR=/var/lib/unifi
JAVA_DIR=/usr/lib/unifi
KEYSTORE=${UNIFI_DIR}/keystore

Set the Let’s Encrypt mode to true:
If you only enable the line, by removing the #, you will get a loop ==Yes when running the script. So set it to true. Will still get some warning about missing [[:, but the doesn’t matter.
LE_MODE=true

https://lazyadmin.nl/home-network/unifi-controller-ssl-certificate/
Category: Uncategorized | Comments Off on UniFi Site Controller custom SSL
February 28 2022

Two Default Gateways on One System

You have built two or more network cards into one Linux system and each of these cards has its own default gateway. By default, you can only have one default gateway on a system. The case described would lead to asynchronous routing, whereby the router would reject the packets as appropriate.

The iproute2 program, which is included in all current Linux distributions and already installed even, as a rule, can be used for the solution of this problem. Normally, a Linux system only has one routing table, in which only one default gateway can make entries. With iproute2, you have the ability to setup an additional routing table, for one thing, and allow this table to be used by the system based on rules, for another.

https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System

Category: Uncategorized | Comments Off on Two Default Gateways on One System
September 30 2021

Bleachbit-Portable – Download and clean temp files


$datecurrent = get-date -Format MMddyyyyHmmss
$bleachbit_portable_url = “https://url/download/bleachbit-portable.zip”

$ourpath = “C:\absolute\” + $datecurrent + “\temp”
$zip = $ourpath + “\bleachbit-portable.zip”
$exe = Join-Path $ourpath “\bleachbit-portable\bleachbit_console.exe”

New-Item -ItemType Directory -Force -Path $ourpath
Invoke-WebRequest -Uri $bleachbit_portable_url -OutFile $zip
Expand-Archive -LiteralPath $zip -DestinationPath $ourpath

$Params = ” –clean microsoft_edge.cache chromium.cache firefox.cache google_chrome.cache internet_explorer.cache flash.cache java.cache system.tmp system.updates adobe_reader.cache”
$ParsedParams = $Params.Split(” “)

& $exe $ParsedParams

Category: Uncategorized | Comments Off on Bleachbit-Portable – Download and clean temp files
July 30 2021

MySQL Native Login

Remove the plugin

[mysql] use mysql;
[mysql] update user set plugin=” where User=’root’;
[mysql] flush privileges;
[mysql] \q

https://stackoverflow.com/questions/36864206/sqlstatehy000-1698-access-denied-for-user-rootlocalhost

Category: Uncategorized | Comments Off on MySQL Native Login
July 11 2021

smartctl and megaraid/LSI

Run smartctl –scan to print all devices attached including the device id and RAID type:

# smartctl –scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/bus/0 -d megaraid,0 # /dev/bus/0 [megaraid_disk_00], SCSI device
/dev/bus/0 -d megaraid,1 # /dev/bus/0 [megaraid_disk_01], SCSI device
/dev/bus/0 -d megaraid,2 # /dev/bus/0 [megaraid_disk_02], SCSI device

https://serverfault.com/questions/620019/smartctl-megaraid-how-to-find-the-right-device-node-for-an-adapter

https://unix.stackexchange.com/questions/485463/smartctl-megaraid-n-how-to-find-the-right-value-for-n

Category: Uncategorized | Comments Off on smartctl and megaraid/LSI
March 7 2021

Export all Exchange mailboxes

get-mailbox | select -expand alias > alias.txt

$content = get-content C:\users\user\desktop\alias.txt

foreach ($user in $content) {

New-MailboxExportRequest -Mailbox $user -FilePath \\fileserver\export\$user.pst }

Category: Uncategorized | Comments Off on Export all Exchange mailboxes
February 28 2021

Debian 9,10 rc.local

Setup script:

#!/bin/bash

echo ‘[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target’ > /etc/systemd/system/rc-local.service

echo ‘#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0’ > /etc/rc.local

chmod +x /etc/rc.local
systemctl enable rc-local

https://www.adminsehow.com/2019/10/how-to-add-rc-local-in-debian-9-10/
https://www.troublenow.org/752/debian-10-add-rc-local/

Category: Uncategorized | Comments Off on Debian 9,10 rc.local