Этот скрипт автоматизирует часть после «Готово! Сервер готов к работе с DKIM»
Чтобы облегчить автоматизацию этого процесса, я создал этот сценарий bash. Просто добавьте один домен, например «example.com» на строку внутри массива domains = ().
Этот скрипт создает файлы для вас и проверяет, находится ли строка в файле
[d3 ] Spfs.txt удаляется и воссоздается каждый раз при запуске и проверяет вторую строку default.txt на spfs.txt перед добавлением. Вы должны разместить ваши серверы ipv4 и ipv6 (если они есть) в переменных предоставлена. Он проверяет, не arent empty
, вы можете запустить этот файл несколько раз благодаря добавленным чекам.
#!/bin/bash
# List of domains
domains=(
'example.com'
)
# file paths and directories
dkim="/etc/opendkim"
keys="$dkim/keys"
keyfile="$dkim/KeyTable"
signfile="$dkim/SigningTable"
trustfile="$dkim/TrustedHosts"
spffile="$dkim/spfs.txt"
# Set Ipv6 and Ipv4 addresses for the server here
ipv4=""
ipv6=""
# loopback addresses for the server
loop=( localhost 127.0.0.1 )
function loopback {
for back in "${loop[@]}"
do
if ! grep -q "$back" "$trustfile"; then
echo "$back" >> "$trustfile"
fi
done
}
# Check for files and create / write to them if they dont exist
if [ ! -d "$keys" ]; then
mkdir "$keys"
fi
if [ ! -f "$keyfile" ]; then
touch "$keyfile"
fi
if [ ! -f "$signfile" ]; then
touch "$signfile"
fi
if [ ! -f "$trustfile" ]; then
touch "$trustfile"
loopback
else
loopback
fi
if [ ! -f "$spffile" ]; then
touch "$spffile"
else
rm -rf "$spffile"
touch "$spffile"
fi
if [ ! -z "$ipv6" ]; then
if ! grep -q "$ipv6" "$trustfile"; then
echo "$ipv6" >> "$trustfile"
fi
fi
if [ ! -z "$ipv4" ]; then
if ! grep -q "$ipv4" "$trustfile"; then
echo "$ipv4" >> "$trustfile"
fi
fi
# Generate keys and write the spfs records we need for each domain to one file
for domain in "${domains[@]}"
do
keydir="$keys/$domain"
default="$keydir/default.txt"
if [ ! -d "$keydir" ]; then
mkdir $keydir
fi
cd $keydir
opendkim-genkey -r -d $domain
chown opendkim:opendkim default.private
key="default._domainkey.$domain $domain:default:$keydir/default.private"
sign="$domain default._domainkey.$domain"
trust="$domain"
spf="$(cat $default)"
# Check only the last line against the spf file as the first line is always the same
spflast="$(tail -1 $default)"
if ! grep -q "$key" "$keyfile"; then
echo "$key" >> "$keyfile"
fi
if ! grep -q "$sign" "$signfile"; then
echo "$sign" >> "$signfile"
fi
if ! grep -q "$trust" "$trustfile"; then
echo "$trust" >> "$trustfile"
fi
if ! grep -q "$spflast" "$spffile"; then
echo "$spf" >> "$spffile"
fi
done
На веб-сайте справки Ubuntu:
sudo apt-get install update-manager-core
sudo do-release-upgrade
Также из веб-сайта справки Ubuntu :
DESCRIPTION
Upgrade the operating system to the latest release from the
command-line. This is the preferred command if the machine has no
graphic environment or if the machine is to be upgraded over a remote
connection.
Отказ от ответственности: я всегда устанавливаю (я настраиваю и разбираю вещи на своих установках, поэтому было бы более сложно обновиться, чем начать с нуля), поэтому я никогда не пробовал обновлять ни через графический интерфейс, ни в командной строке. Но это официальный метод обновления, поэтому все должно быть хорошо. Сначала я все же сохранял важные данные.
Попробуйте do-release-upgrade как root. Это должно обновить систему.