Null route ssh attacks on your debian server

October 29, 2018 Comments off

I Use these scripts to catch and null route failed ssh attempts.
I have my data stored in /root/firewall. You may need to direct the script at mail.log depending on your Postfix mail filtering options. If so just change the target.

The first script “NULLAUTH” retrieves the IP address of failed ssh attempts.
The second script “RMNULL” erases previously stored null routes.
I recommend creating a crontab entry for NULLAUTH and running it periodically.

##NULLAUTH
cd /root/firewall
BLACKLIST=’cat BLACKLIST’
RMNULL
egrep “authentication failure” /var/log/auth.log | grep -Eo “([0-9]{1,3}\.){3}[0-9]{1,3}” > authfailure
sort -u authfailure | uniq -u > BLACKLIST
## Null route BLACKLIST
for x in `$BLACKLIST`; do
echo “Null routing $x…”
ip route add blackhole $x
done

##RMNULL
#!/bin/bash
cd /root/firewall
BLACKLIST=’cat BLACKLIST’
for x in `$BLACKLIST`; do
echo “unblocking $x…”
ip route delete $x
done

Categories: sysadmin

Fix eth0 on fresh install of Debian 9

April 24, 2018 Comments off

You can disable these stable names and go back to the kernel-provided ones
(which don’t have a stable order) in one of two ways:

– Put “net.ifnames=0” into the kernel command line (e. g. in
/etc/default/grub’s GRUB_CMDLINE_LINUX_DEFAULT, then run “update-grub”).

– Disable the default *.link rules with
“ln -s /dev/null /etc/systemd/network/99-default.link”
and rebuild the initrd with “update-initramfs -u”.
The above is from a debian readme file.

Categories: sysadmin

Use CSS to keep footer on the bottom of a container when you vary the size

April 2, 2018 Comments off

You can keep the footer on the bottom of a CSS container like this example. The
Height statement in the the #topofpage ID (1280px) controls the whole page container.
The #pages statement is the lower page half below the horizontal navigation bar.
If you vary the page size with the #topofpage height the #pages and #footer sections
will keep the footer on the bottom.

#topofpage {
width:870px;max-width:100%;height:1280px;max-height:100%;margin-right:auto;margin-left:auto;margin-bottom:auto;border-bottom:1px solid black;box-shadow: 400px 0px 0px 0px rgb(100,125,100), -400px 0px 0px 0px rgb(100,125,100);border:1px solid black;

#pages {
font-family: “Helvetica”, “Arial”, sans-serif;
height:calc(100% – 340px);
# height:940px;
position:relative;
margin-bottom:0px;
margin-top: 0px;
margin-bottom: 0px;
border:none;
# border-radius: 20px;
font-size:13pt;
text-align:justify;
}
#footer {
clear;
height:40px;
font-size: 15px;
bottom:0;
font-family:”Times New Roman”;
text-align:center;
border:none;
# border-radius: 20px;
}

Categories: sysadmin

Use SMS for a reminder for meds, birthdays, etc. *

March 17, 2018 Comments off

You can use SMS to remind yourself with a text message if you have access to one the cellphone
gateways for SMS and run your own mail server (you can use a client too but this example
is for a linux server).

Here are the major US SMS gateways. Most all the MNVO providers are listed on line too.

Sprint [insert 10-digit number]@messaging.sprintpcs.com
T-Mobile [insert 10-digit number]@tmomail.net
U.S. Cellular [insert 10-digit number]@email.uscc.net
Verizon [insert 10-digit number]@vtext.com

Just use the sendmail command and set up a crontab entry (Debian example):

30 22 * * * echo “take your meds” | /usr/sbin/sendmail 12345678910@cellgateway
will send you “take your meds” at 10:30pm every day.
* Works for android. Iphone’s work however text may not be formatted correctly.

Other reminders can be added.

I find this more useful than email or cell phone alarms.

Categories: sysadmin

Easily add to pdf file

October 30, 2017 Comments off

You can easily add to a pdf file with pdftk (Debian apt install pdftk).

Simple syntax:

pdftk file1 file2 cat output file3.pdf

It does much more than that. Read the man pages for more info.

Categories: sysadmin

vim on Debian 9 issue with cut and paste

July 25, 2017 Comments off

While using vi (vim) on Debian 9 via cli, there is an issue with cut and paste with a mouse.
This can be corrected by adding a .vimrc file to your user folder as shown below
##CONTENTS OF .vimrc
.vimrc
set mouse=””

This will re-enable the mouse cut and paste feature from a terminal.

Categories: sysadmin

Upgrade Debian Jessie to Strech

June 24, 2017 Comments off

The upgrade process is easy via the cli.
Just complete the following and answer any questions.
I let the system restart daemons automatically and kept original conf files.
This has worked on three Debian 8 systems without a hitch.

apt-get update
apt-get upgrade
apt-get dist-upgrade
cp /etc/apt/sources.list /etc/apt/sources.list_backup
sed -i ‘s/jessie/stretch/g’ /etc/apt/sources.list
apt-get update
apt list –upgradable
apt-get upgrade
apt-get dist-upgrade

After completing you can reboot and autoremove old packages.

Categories: sysadmin