May 2020
« Mar    


WordPress Quotes

History is a relentless master. It has no present, only the past rushing into the future. To try to hold fast is to be swept aside.
John F. Kennedy
May 2020
« Mar    

Short Cuts

2012 SERVER (64)
2016 windows (9)
AIX (13)
Amazon (40)
Ansibile (19)
Apache (135)
Asterisk (2)
cassandra (2)
Centos (211)
Centos RHEL 7 (270)
centos8 (3)
chef (3)
cloud (2)
cluster (3)
Coherence (1)
DB2 (5)
DISK (25)
DNS (9)
Docker (30)
Eassy (11)
ELKS (1)
Fedora (6)
ftp (5)
GIT (3)
GOD (2)
Grub (1)
Hacking (10)
Hadoop (6)
health (2)
horoscope (23)
Hyper-V (10)
IIS (15)
JAVA (7)
JBOSS (32)
jenkins (1)
Kubernetes (7)
Ldap (5)
Linux (188)
Linux Commands (166)
Load balancer (5)
mariadb (14)
Mongodb (4)
MQ Server (24)
MYSQL (84)
Nagios (5)
NaturalOil (13)
Nginx (35)
Ngix (1)
openldap (1)
Openstack (6)
Oracle (35)
Perl (3)
Postfix (19)
Postgresql (1)
PowerShell (2)
Python (3)
qmail (36)
Redis (12)
RHCE (28)
Security on Centos (29)
SFTP (1)
Shell (64)
Solaris (58)
Sql Server 2012 (4)
squid (3)
SSH (10)
SSL (14)
Storage (1)
swap (3)
TIPS on Linux (28)
tomcat (62)
Ubuntu (1)
Uncategorized (30)
Veritas (2)
vfabric (1)
VMware (28)
Weblogic (38)
Websphere (71)
Windows (19)
Windows Software (2)
wordpress (1)

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Who's Online

0 visitors online now
0 guests, 0 bots, 0 members

Hit Counter provided by dental implants orange county

Linux Security

Centralized SSH Keys

There are times when it is beneficial to take control of SSH key management on a server. This brief tutorial will centralize all user SSH keys to a single location and allow root to manage them.

We will be keeping all keys in a single directory located in /etc/ssh/authorized_keys. Within the directory, there will be a file for each user account containing its authorized_keys.

The below commands will configure the server with centralized SSH keys and add a ssh public key to the keyfile.

Create the directory:

mkdir /etc/ssh/authorized_keys

Create a file for each user account and add a key:

touch /etc/ssh/authorized_keys/username
cat >> /etc/ssh/authorized_keys/username

Ensure the created file has the proper permissions or else authentication will not work.

chmod 600 /etc/ssh/authorized_keys/username

Inside the ssh configuration file, you will have to edit the Authorized_keys. Open /etc/ssh/sshd_config with your favorite text editor (hopefully VIM) and make the following changes.

Change the following.

#AuthorizedKeysFile     .ssh/authorized_keys
AuthorizedKeysFile      /etc/ssh/authorized_keys/%u

Disable Interactive Shell Logins
July 20, 2012 / admin posted in Bash, Linux, Security / No Comments

Often you have a server with users are required an account to access certain services but you do not want them interactively log into the server. This is very common on an ftp/sftp server. If you change their shell to /sbin/nologin or /bin/false this could prevent them from utilizing the service you have put into place. The simplest way to accommodate this is to write your own shell specifically for them.

Create a file with the name of your shell and place the below contents in it. I am using mine to restrict sftp users, so it is call ftponly. This shell will accept their login, display the message and then close their session. I have included a trap to catch any signals in the event a user gets crafty and tries to CTRL+C quickly.



# ftponly shell
trap “/bin/echo Sorry; exit 0” 1 2 3 4 5 6 7 10 15
/bin/echo “***************************************************************”
/bin/echo ”  These credentials are NOT allowed interactive access to “
/bin/echo ”                  <SERVER NAME> Server”
/bin/echo ”              Account restricted to ftp access.”
/bin/echo ”       Contact with any issues.”
/bin/echo “***************************************************************”
exit 0

Place this file in /bin and ensure it is owned by root and excutable.

chown root.root /bin/ftponly
chmod 755 /bin/ftponly

Now place the shell name into the /etc/shells file:

# /etc/shells: valid login shells

You can now assign the shell to a user either in the passwd file or during account creation.

bob:x:1005:100:bob’s ftp accounttg :/home/bob:/bin/ftponly

Disable USB storage support in RHEL 5
June 2, 2011 / admin posted in Linux, Security / No Comments

To easily disable USB storage device support in RHEL 5 just add the following line to /etc/modprobe.conf:

install usb-storage :

This will prevent modprobe from loading the usb-storage module, but will allow administrators to manually load the module with insmod when needed.

If you will never need USB support you can simply remove the USB Storage driver from the kernel. Note: This will have to be repeated after each kernel update.

mv /lib/modules/kernelversion(s)
        /kernel/drivers/usb/storage/usb-storage.ko /root

You could also append nousb to the kernel line in your /etc/grub.conf. Make sure that your /etc/grub.conf is password protected or someone could just edit the line from it in single user mode.

kernel /vmlinuz-version ro vga=ext
        root=/dev/VolGroup00/LogVol00 rhgb quiet nousb

Disable CD/DVD access for normal users.
June 2, 2011 / admin posted in Linux, Security / No Comments

I just set up some workstations that I was required to disable CDROM access for normal users, but retain it for root. The easiest way, with the least amount of impact, is to disable GNOME’s automounting from the gnome-volume-manager program. This program mounts devices and removable media (DVDs, CDs and USB flash drives) when they are inserted into the system.

As root:

gconftool-2 –direct
–config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory
–type bool
–set /desktop/gnome/volume_manager/automount_media false
gconftool-2 –direct
–config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory
–type bool
–set /desktop/gnome/volume_manager/automount_drives false

You can then verify the changes by viewing the output of:

gconftool-2 -R /desktop/gnome/volume_manager

Another, less elegant method to accomplish this task is to relocate the cdrom driver. You can always put it back as root and insmod to reactivate it.

mv /lib/modules/<kernels>/drivers/cdrom/cdrom.ko /root

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




Blue Captcha Image


Protected by WP Anti Spam