migrate to git.charlotte.sh
This commit is contained in:
commit
fbd588721e
412 changed files with 13750 additions and 0 deletions
37
db-security-sec300/week5.md
Normal file
37
db-security-sec300/week5.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Week5
|
||||
Emailing failed login attempts
|
||||
|
||||
- create App password at: https://security.google.com/settings/security/apppasswordsLinks to an external site.
|
||||
- install ssmtp
|
||||
- `sudo apt-get update && sudo apt-get install ssmtp`
|
||||
|
||||
- edit `/etc/ssmtp/ssmtp.conf`
|
||||
```
|
||||
root=charlotte.croce@mymail,champlain.edu
|
||||
mailhub=smtp.gmail.com:587
|
||||
AuthUser=charlotte.croce@mymail.champlain.edu
|
||||
AuthPass=YourAuthPass
|
||||
UseSTARTTLS=Yes
|
||||
```
|
||||
|
||||
|
||||
- Testing email functionality
|
||||
```
|
||||
echo "To: charlotte.croce@mymail,champlain.edu" > emailform.txt
|
||||
echo "Subject: Database Incident" >> emailform.txt
|
||||
echo "Incident of Database" >> emailform.txt
|
||||
cat emailform.txt | ssmtp charlotte.croce@mymail,champlain.edu
|
||||
```
|
||||
|
||||
- Script to send email with failed login attempts
|
||||
|
||||

|
||||
|
||||
crontab
|
||||
- add permissions so crontab can execute the script
|
||||
- `chmod +x dbsec.bash`
|
||||
- `crontab -l` : list scheduled tasks
|
||||
- `crontab -e` : edit scheduled tasks
|
||||
- run the script every day at 3:35pm
|
||||
- `35 15 * * * /bin/bash -c "/root/dbsec.bash"`
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue