System and Network Administration Syslog Shares Sudo ++
System and Network Administration Syslog Shares Sudo ++
Syslog
Shares
sudo ++
Things of Special interest
to SysAdmins
• Using grep we cannot select and exclude lines at the same time,
so we need to pipe several command together to filter the output
of each one, like this:
# can use cat and a pipe or input redirection to get started
bd="$(date +%b' '%d)"; \
grep "^$bd" < dnsmasq.log |grep -e '-dhcp' |grep -v 'no addr' |grep -v 'wrong' |grep -v 'range'
• Using multitail we can select and exclude lines at the same time, as
long as we follow the rules: [1] You can have multiple -ev (exclude)
but only one -e (select) [2] All -ev must come before -e
• View the filtered local file and the remote file in multitail:
#!/bin/bash
# /usr/local/sbin/dhcpActivity ETH HOST PORT
RPC processes notify portmap when they start, revealing the port number
they are monitoring and the RPC program numbers they expect to serve.
The client contacts portmap on the server with a particular RPC program
number, and portmap redirects the client to the proper port to communicate
with its desired service. (a bit like xinetd)
System & Network Administration
NFS Client
sap p.100-107 rg p.121
/etc/fstab controls what file systems are mounted when the system
boots, as well as supplying default values for others that may be
mounted manually from time to time
Placing a properly formatted line in /etc/fstab has the same effect as
manually mounting the file system.
# specifier mountpoint type options dump check
/dev/hda1 / ext2 defaults 0 1
/dev/sda1 /mnt/usb auto defaults 0 0
none /proc proc defaults 0 0
/dev/hda2 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
192.168.66.78:/var/www /var/www nfs rw,soft,intr,suid 0 0
hostname,
IP address, local mount point must exist before /etc/fstab is read –
or FQDN if there are files here they will be invisible until unmounted
• on the other hand, the following line shares the directory to one host
as read only and shares it to the world as read+write due to a single
space character after the hostname.
/tmp/nfs/ client.example.com (rw)
UserServer
DMZ: demilitarized zone
WebServer
Deny All except
NFS o Incoming ssh
Deny All except Mount o Portmap to webserver
o Anyone to port 80, 443
o Portmap to userserver
o netA, netB, netC
The UserServer should really
• have a public IP address
(Bridged Interface)
• and act as a http/https proxy
(port or URL forwarding)
• “samba”
– Server Message Block protocol
– Designed for Microsoft NetBIOS networking (before TCP/IP)
– Still used by Linux clients to access shared printers
controlled by Windows servers
Monitoring
Unique user ID
Identification
Something you know (password, pin) Authentication
Something you have (card, certificate)
Something you are (fingerprint, retina) Access Controls
With classic distributions (like ours) you can log in as the root user, or you
can issue the command
su –
as a normal user to effectively log in as root (root's home becomes your
home).
To many sysadmins this is a bad idea. They say NEVER log in as the root
user: log in as a standard user and su to become the root user.
With sudo-based distributions such as Ubuntu, the root user account has
been "disabled." You cannot log in as root and you cannot su to become
the root user. All you can do is issue commands with the help of sudo to
gain administrative privileges.
When you open up this file you will notice that it is fairly small in size.
The basic entry for a user looks like this:
user hostlist = (userlist) commandlist
Typically you will find an entry like this:
root ALL=(ALL) ALL
Which indicates that the user root on all hosts can run all commands
as any user.
http://www.linux.com/learn/tutorials/306766:linux-101-introduction-to-sudo
• youtube
http://www.youtube.com/watch?v=hv3QxFfkW-8
http://www.youtube.com/watch?v=BPMNofGgD4Y
If bash is started with the name rbash (via a symlink) the shell becomes
restricted. It behaves identically to the standard shell with the exception
that the following are disallowed or not performed:
• changing directories with cd
• specifying command names containing /
• specifying a file name with a ./ (dot slash)
• setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV
• redirecting output using the >, >|, <>, >&, &>, and >> redirection
operators
However, when a shell script is executed, rbash turns off any restrictions
in the shell spawned to execute the script. This includes the files bash
reads when it starts up.
Good Reference:
http://docs.oracle.com/cd/E37670_01/E36387/html/ol_cj_sec.html
Good exercise
http://how-to.linuxcareer.com/how-to-automatically-chroot-jail-selected-ssh-user-logins
Challenge:
Finding a way to justify the extra work and overhead
Note:
We see this in system descriptions, so we
need to know what it is even if we don’t use it