Compare commits
No commits in common. "b010f17c9e4ce5a66ec95618551ae5b1019d9552" and "4628db3109925cf214a02de65cd26c31a921ba2f" have entirely different histories.
b010f17c9e
...
4628db3109
1
mail_on_ssh/.gitignore
vendored
1
mail_on_ssh/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
mail_on_ssh.conf
|
|
@ -1,8 +0,0 @@
|
|||||||
# Installation
|
|
||||||
|
|
||||||
After setting up mail_on_ssh.conf, add the following configuration to `/etc/pam.d/sshd`
|
|
||||||
|
|
||||||
```
|
|
||||||
# Send an email if somebody logs in successfully over SSH
|
|
||||||
session optional pam_exec.so seteuid $PATH2SERVER_SCRIPTS/mail_on_ssh/mail_on_ssh.sh -c $PATH2SERVER_SCRIPTS/mail_on_ssh/mail_on_ssh.conf
|
|
||||||
```
|
|
@ -1,4 +0,0 @@
|
|||||||
#################################################################
|
|
||||||
# Config
|
|
||||||
#################################################################
|
|
||||||
RECEPIENT='' # Send email to this address
|
|
@ -1,55 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#################################################################
|
|
||||||
# Check availability of software
|
|
||||||
#################################################################
|
|
||||||
function availability {
|
|
||||||
if [[ ! $(command -v $1) ]]; then
|
|
||||||
echo Error: '$1' is not available but required. Please install it!
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
availability mail
|
|
||||||
|
|
||||||
#################################################################
|
|
||||||
# Get arguments
|
|
||||||
#################################################################
|
|
||||||
missingArg()
|
|
||||||
{
|
|
||||||
echo "Error: Please define the configuration to be used!"
|
|
||||||
echo " Usage: $0 -c <configuration_file>"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
while getopts "c:" opt
|
|
||||||
do
|
|
||||||
case "$opt" in
|
|
||||||
c ) CONFIG_FILE="$OPTARG" ;;
|
|
||||||
? ) missingArg ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if config was empty
|
|
||||||
if [ -z "$CONFIG_FILE" ]
|
|
||||||
then
|
|
||||||
missingArg
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if config file exists
|
|
||||||
if [ ! -f $CONFIG_FILE ]
|
|
||||||
then
|
|
||||||
echo "$CONFIG_FILE does not exist!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source $CONFIG_FILE
|
|
||||||
|
|
||||||
#################################################################
|
|
||||||
# Send email
|
|
||||||
#################################################################
|
|
||||||
if [ "$PAM_TYPE" != "close_session" ]; then
|
|
||||||
host="`hostname`"
|
|
||||||
subject="SSH Login: $PAM_USER from $PAM_RHOST on $host"
|
|
||||||
message=$(env)
|
|
||||||
echo "$message" | mail -s "$subject" "$RECEPIENT"
|
|
||||||
fi
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Source of script:
|
|
||||||
# https://support.plesk.com/hc/en-us/articles/12377216464279-How-to-back-up-all-MySQL-databases-via-a-command-line-interface-in-Plesk-for-Linux
|
|
||||||
|
|
||||||
# Create a directory where backup files will be stored
|
|
||||||
mkdir -p /root/mysql_dumps_all
|
|
||||||
|
|
||||||
# Get a list of all databases
|
|
||||||
cd /root && /usr/sbin/plesk db -e "show databases" | grep -v -E "^Database|information_schema|performance_schema|phpmyadmin" > dblist.txt
|
|
||||||
|
|
||||||
# Create a dump of each MySQL database
|
|
||||||
cat /root/dblist.txt | while read i; do /usr/sbin/plesk db dump "$i" > /root/mysql_dumps_all/"$i".sql; done
|
|
Loading…
Reference in New Issue
Block a user