linux security

15
Linux Security

Upload: sasha-whitaker

Post on 31-Dec-2015

18 views

Category:

Documents


0 download

DESCRIPTION

Linux Security. See who's logged in. 1) w     (more information) 2) who     (less information). Disable remote logins for "root" account. 1) Deactivate telnet daemon     sudo service telnet stop 1.5) Remove telnet daemon (unless REALLY needed)     sudo apt-get remove telnetd - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Linux Security

Linux Security

Page 2: Linux Security

See who's logged in

1) w    (more information)

2) who    (less information)

Page 3: Linux Security

Disable remote logins for "root" account

1) Deactivate telnet daemon    sudo service telnet stop 1.5) Remove telnet daemon (unless REALLY needed)    sudo apt-get remove telnetd

2) Disable root logins in ssh server (use nano or vi as root)    edit /etc/ssh/sshd_config; find "PermitRootLogin", set to "no"    Restart ssh: sudo service ssh restart

3) Disable all remote root logins in /etc/security/access.conf    add line to access.conf:    "- : root : ALL EXCEPT LOCAL"

Page 4: Linux Security

Disable toor account

a) Delete the account:    sudo userdel toor

b) Disable (Lock) account:    sudo usermod -L toor

c) Set toor's login shell to /usr/sbin/nologin:    (edit /etc/passwd; change  last argument on toor's entry to /usr/sbin/nologin)

Page 5: Linux Security

Enforce Password Length

edit /etc/pam.d/common-password (with sudo) Append the first line containing "pam_unix.so" with    min=8

This will enforce a minimum password length of 8 characters.

NOTE:    Can be set to any desired minimum length

Page 6: Linux Security

Create User Accounts

sudo useradd -m -G users,development,remote username

-m creates home directories-G adds the new user to the listed groups    (users,development,remote)

Page 7: Linux Security

Check Active Network Service

1) Netstat (IPv4, Listening, show Process name)    sudo netstat -4lp

2) Check the Internet Services daemon    cat /etc/inetd.conf

Page 8: Linux Security

Check Active Processes

1) ps -exShow processes for Everything, with eXtended info

2) pstree -aShow process in tree format, with Attributes

Page 9: Linux Security

End suspect processes

1) kill (PID)Ask the specified process to end nicely

2) kill -15 (PID)Tell the process to end3) kill -9 (PID)Tell the system to end the process

4) sudo kill -9 (PID)As root, tell the system to end the process

Page 10: Linux Security

chmod explained

chmod: Change file privileges- identity, privilege Identities are    User = u    Group = g    Other = o

Privileges are    Read = r    Write = w    Execute = x

chmod u+x;  chmod g-w; chmod o-wr

Page 11: Linux Security

chown explained

CHange OWnership, in user:group format.

Change /home/development to be owned by root:    chown root: /home/development

Change /home/development to be owned by wheel group:    chown :wheel /home/development

Change /home/yourfile:    chown you:users /home/yourfile

Page 12: Linux Security

Create a Shared File Folder

Create the folder, give it following permissions:    (group ownership = development)    User, Group, Other: No Execute    Other: No read or write    Group: Read and Write

mkdir /home/Developmentchown -R :development /home/Developmentchmod ugo-x /home/Developmentchmod o-rw /home/Developmentchmod g+rw /home/Development

Page 13: Linux Security

Log File Analysis

Logs are stored in /var/log/

Example:    /var/log/messages    (generic messages)    /var/log/syslog           (kernel messages)    /var/log/auth.log        (Authentication log)  auth.log records all login attempts-- local, ssh, telnet, etc.

Page 14: Linux Security

Reading log files

Dump to the screencat /var/log/auth.log Show entries in scrollable format less /var/log/auth.log

Show last 10 entriestail /var/log/auth.log

Show last ten entries, and any subsequent entriestail -f /var/log/auth.log

Page 15: Linux Security

grep logfiles

Keyword searches on logfiles:

Show login attempts for kdewey:grep 'kdewey' /var/log/auth.log

Show sudo uses:grep 'sudo' /var/log/auth.log