Os dejo con un interesante video de "Security by default" de como securizar una instalación de SO CentOS, totalmente válido para Red Hat.
Saludos,
[root@localhost system]# ls -ltrha
total 52K
lrwxrwxrwx. 1 root root 39 Jun 27 19:12 syslog.service -> /usr/lib/systemd/system/rsyslog.service
drwxr-xr-x. 2 root root 4.0K Jun 27 19:12 getty.target.wants
drwxr-xr-x. 2 root root 4.0K Jun 27 19:12 default.target.wants
drwxr-xr-x. 2 root root 4.0K Jun 27 19:12 graphical.target.wants
lrwxrwxrwx. 1 root root 41 Jun 27 19:12 dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service
drwxr-xr-x. 2 root root 4.0K Jun 27 19:12 basic.target.wants
lrwxrwxrwx. 1 root root 44 Jun 27 19:12 dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service
drwxr-xr-x. 2 root root 4.0K Jun 27 19:13 sysinit.target.wants
drwxr-xr-x. 2 root root 4.0K Jun 27 19:13 sockets.target.wants
drwxr-xr-x. 2 root root 4.0K Jun 27 19:13 printer.target.wants
lrwxrwxrwx. 1 root root 46 Jun 27 19:13 dbus-org.freedesktop.NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
drwxr-xr-x. 2 root root 4.0K Jun 27 19:13 system-update.target.wants
drwxr-xr-x. 2 root root 4.0K Jun 27 19:13 spice-vdagentd.target.wants
lrwxrwxrwx. 1 root root 41 Jun 27 19:14 dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service
drwxr-xr-x. 2 root root 4.0K Jun 27 19:14 bluetooth.target.wants
lrwxrwxrwx. 1 root root 35 Jun 27 19:14 display-manager.service -> /usr/lib/systemd/system/gdm.service
lrwxrwxrwx. 1 root root 37 Oct 10 11:00 default.target -> /lib/systemd/system/multi-user.target
drwxr-xr-x. 4 root root 4.0K Oct 11 14:37 ..
lrwxrwxrwx. 1 root root 57 Oct 11 14:47 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
drwxr-xr-x. 13 root root 4.0K Oct 11 14:47 .
drwxr-xr-x. 2 root root 4.0K Oct 11 14:48 multi-user.target.wants
#proxy.sh
export http_proxy=http://host.com:port/
export ftp_proxy=http://host.com:port/
export no_proxy=.domain.com
proxy
|
URL of a proxy server including the port number. |
proxy_password
|
Password for authentication with a proxy server. |
proxy_username
| User name for authentication with a proxy server. |
[root@myserver ~]# php -v
PHP 5.3.3 (cli) (built: Jun 25 2012 04:41:23)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root@myserver ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-11.ius.el6.noarch.rpm
[root@myserver ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noarch.rpm
[root@myserver ~]# rpm -Uvh epel-release-6-5.noarch.rpm
[root@myserver ~]# rpm -Uvh ius-release-1.0-11.ius.el6.noarch.rpm
[root@myserver ~]#yum install yum-plugin-replace
[root@myserver ~]# yum replace php --replace-with php53u
Loaded plugins: replace
Excluding Packages in global exclude list
Finished
Replacing packages takes time, please be patient...
This may be normal depending on the package. Continue? [y/N] y
Removed:
php.x86_64 0:5.1.6-27.el5 php-cli.x86_64 0:5.1.6-27.el5 php-common.x86_64 0:5.1.6-27.el5
php-devel.x86_64 0:5.1.6-27.el5 php-pear.noarch 1:1.4.9-6.el5
Installed:
php53.x86_64 0:5.3.2-6.ius.el5 php53-cli.x86_64 0:5.3.2-6.ius.el5
php53-common.x86_64 0:5.3.2-6.ius.el5 php53-devel.x86_64 0:5.3.2-6.ius.el5
php53-pear.noarch 1:1.8.1-4.ius.el5 php53-pspell.x86_64 0:5.3.2-6.ius.el5
Complete!
[root@myserver ~]# php -v
PHP 5.3.26 (cli) (built: Jun 24 2013 15:05:00)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
Which are the goals of this repository ?
Providing the latest versions of the LAMP stack, and some other software, to the Fedora and Enterprise Linux (RHEL, CentOS, Oracle, Scientific Linux, ...) users. It mainly contains :
packages I also maintains in Fedora
backports of packages available in Fedora development version
some packages incompatible with Fedora policy
some packages in progress before being submitted to Fedora repository
(nearly) vanilla versions
This is quite away from backporting fixes policy of Enterprise Linux.
What is the IUS Community Project?
The IUS Community Project is an effort to package rpms of the latest stable versions of the most commonly requested software on Red Hat Enterprise Linux and CentOS. IUS provides a better way to upgrade PHP/MySQL/Python/Etc on RHEL or CentOS. The project is run by professional Linux Engineers that are primarily focused on RPM Development in the web hosting industry.
What is it NOT?
For one, IUS is not a service of Rackspace but rather is Sponsored by Rackspace. Additionally, IUS is not the same as Fedora EPEL or similar repos. EPEL is geared towards adding packages to RHEL, and has strict guidelines that none of their packages replace anything in RHEL. IUS on the other hand is explicitly geared towards providing packages that do replace existing software in RHEL. Essentially, we are offering a proper way to upgrade software on RHEL when you really need it the latest upstream versions of software.
# passwd
# vi /etc/sysconfig/network
# vi /etc/hosts
# hostname NEWHOSTNAME
# cd /etc/sysconfig/network-scripts/
# vi ifcfg-eth0
# vi ifcfg-eth1
# vi /etc/sysconfig/network
# service network restart
# cd /etc/.sshLas claves de usuario, por ejemplo root, también se tendrán que borrar y volver a generar si existieran.
# rm -f *_key*
# reboot
[root@server1 ~]# yum whatprovides *semanage
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
libsemanage-2.0.43-4.2.el6.x86_64 : SELinux binary policy manipulation library
Repo : www-repo
Matched from:
Other : libsemanage = 2.0.43-4.2.el6
policycoreutils-python-2.0.83-19.30.el6.x86_64 : SELinux policy core python
: utilities
Repo : www-repo
Matched from:
Filename : /usr/sbin/semanage
libsemanage-2.0.43-4.2.el6.i686 : SELinux binary policy manipulation library
Repo : www-repo
Matched from:
Other : libsemanage = 2.0.43-4.2.el6
libsemanage-2.0.43-4.2.el6.x86_64 : SELinux binary policy manipulation library
Repo : installed
Matched from:
[root@server1 ~]# yum install policycoreutils-python
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.0.83-19.30.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================
Package Arch Version Repository Size
====================================================================================
Installing:
policycoreutils-python x86_64 2.0.83-19.30.el6 www-repo 342 k
Transaction Summary
====================================================================================
Install 1 Package(s)
Total download size: 342 k
Installed size: 920 k
Is this ok [y/N]: y
Downloading Packages:
policycoreutils-python-2.0.83-19.30.el6.x86_64.rpm | 342 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : policycoreutils-python-2.0.83-19.30.el6.x86_64 1/1
Verifying : policycoreutils-python-2.0.83-19.30.el6.x86_64 1/1
Installed:
policycoreutils-python.x86_64 0:2.0.83-19.30.el6
Complete!
[root@server1 ~]# semanage
/usr/sbin/semanage:
semanage [ -S store ] -i [ input_file | - ]
semanage [ -S store ] -o [ output_file | - ]
semanage login -{a|d|m|l|D|E} [-nrs] login_name | %groupname
semanage user -{a|d|m|l|D|E} [-LnrRP] selinux_name
semanage port -{a|d|m|l|D|E} [-nrt] [ -p proto ] port | port_range
semanage interface -{a|d|m|l|D|E} [-nrt] interface_spec
semanage module -{a|d|m} [--enable|--disable] module
semanage node -{a|d|m|l|D|E} [-nrt] [ -p protocol ] [-M netmask] addr
semanage fcontext -{a|d|m|l|D|E} [-efnrst] file_spec
semanage boolean -{d|m} [--on|--off|-1|-0] -F boolean | boolean_file
semanage permissive -{d|a|l} [-n] type
semanage dontaudit [ on | off ]
Primary Options:
-a, --add Add a OBJECT record NAME
-d, --delete Delete a OBJECT record NAME
-m, --modify Modify a OBJECT record NAME
-i, --input Input multiple semange commands in a transaction
-o, --output Output current customizations as semange commands
-l, --list List the OBJECTS
-E, --extract extract customizable commands
-C, --locallist List OBJECTS local customizations
-D, --deleteall Remove all OBJECTS local customizations
-h, --help Display this message
-n, --noheading Do not print heading when listing OBJECTS
-S, --store Select and alternate SELinux store to manage
Object-specific Options (see above):
-f, --ftype File Type of OBJECT
"" (all files)
-- (regular file)
-d (directory)
-c (character device)
-b (block device)
-s (socket)
-l (symbolic link)
-p (named pipe)
-F, --file Treat target as an input file for command, change multiple settings
-p, --proto Port protocol (tcp or udp) or internet protocol version of node (ipv4 or ipv6)
-M, --mask Netmask
-e, --equal Substitue source path for dest path when labeling
-P, --prefix Prefix for home directory labeling
-L, --level Default SELinux Level (MLS/MCS Systems only)
-R, --roles SELinux Roles (ex: "sysadm_r staff_r")
-s, --seuser SELinux User Name
-t, --type SELinux Type for the object
-r, --range MLS/MCS Security Range (MLS/MCS Systems only)
--enable Enable a module
--disable Disable a module
Requires 2 or more arguments
#ls -ltrha /home/ricard/isos/rhel-server-6.4-x86_64-dvd.iso
-rw-rw-r-- 1 ricard ricard 3.5G Mar 26 13:39 /home/ricard/isos/rhel-server-6.4-x86_64-dvd.iso
#mount -o loop /home/ricard/isos/rhel-server-6.4-x86_64-dvd.iso /home/apache/rhel6
mount: warning: /home/apache/rhel6 seems to be mounted read-only.
#echo "/home/ricard/isos/rhel-server-6.4-x86_64-dvd.iso /home/apache/rhel6 udf,iso9660 user,loop 0 0" >> /etc/fstab
DocumentRoot /home/apache/
<Directory />
Order deny,allow
Allow from all
</Directory>
[www-repo]
enabled=1
gpgcheck=0
name=Red Hat Linux $releasever - $basearch - HTTP
baseurl=http://192.168.122.1/rhel6
# yum search nmap
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
www-repo | 3.9 kB 00:00
www-repo/primary_db | 3.1 MB 00:00
============================================================================ N/S Matched: nmap ============================================================================
nmap.x86_64 : Network exploration tool and security scanner
Name and summary matches only, use "search all" for everything.
[local-repo]
enabled=1
gpgcheck=0
name=Red Hat Linux $releasever - $basearch - LOCALbaseurl=file:///home/apache/rhel6
# md5sum rhel-server-6.4-i386-dvd.iso
2f1927af5bca9a34f2d9488655b4fdf4 rhel-server-6.4-i386-dvd.iso
ftp_proxy=http://yourproxy.yourdomain.com:80 http_proxy=http://yourproxy.yourdomain.com:80 https_proxy=http://yourproxy.yourdomain.com:80
# rhn_register --proxy=http://yourproxy.yourdomain.com:80
En la siguiente pantalla seleccionaremos "Next".
Pondremos nuestro usuario y password de Red Hat Network y "Next".
Nos indicará el nombre del perfil del servidor y si queremos enviar la información de hardware y red.
Seleccionaremos "Next".
Enviaremos el catalogo de paquetes instalados. Seleccionamos "Next".
Enviamos la información a la RHN. Seleccionamos "Next".
Finalmente "OK".
Y "Finish".
Si no disponemos de licencias o si no hay canales disponibles saldrá un mensaje de advertencia indicándolo.
El servidor ya está registrado, lo podemos probar haciendo un búsqueda de un paquete:
#yum search
nmap Loaded plugins: downloadonly, rhnplugin, security ============================================ Matched: nmap =============================================
nmap.i386 : Network exploration tool and security scanner nmap-frontend.i386 : Gtk+ frontend for nmap