dimecres, 19 de juny del 2013

Repositorios Oficiales debian 7

debian 7

# Repositorios Oficiales
deb http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy main contrib non-free
deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy main contrib non-free
#Repositorios Seguridad
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates
deb http://mirrors.kernel.org/debian wheezy-updates main contrib non-free
deb-src http://mirrors.kernel.org/debian wheezy-updates main contrib non-free
# Repositorios Backports
deb http://mirrors.kernel.org/debian wheezy-backports main contrib non-free
deb-src http://mirrors.kernel.org/debian wheezy-backports main contrib non-free

deb http://download.virtualbox.org/virtualbox/debian wheezy contrib



pero també s'ha de fer per virtualbox

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -

apt-get update
apt-get install virtualbox-4.2

divendres, 31 de maig del 2013

¿Desea continuar [S/n]? s
Configurando linux-image-2.6.32-5-amd64 (2.6.32-48squeeze3) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8105e-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-1.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-1.fw for module r8169
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/pm-utils 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/update-notifier 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
Found linux image: /boot/vmlinuz-2.6.26-2-amd64
Found initrd image: /boot/initrd.img-2.6.26-2-amd64
Found linux image: /boot/vmlinuz-2.6.26-1-amd64
Found initrd image: /boot/initrd.img-2.6.26-1-amd64
/etc/grub.d/README: 2: All: not found
/etc/grub.d/README: 4: 00_*:: not found
/etc/grub.d/README: 5: 10_*:: not found
/etc/grub.d/README: 6: Syntax error: "(" unexpected
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-5-amd64.postinst line 799.
dpkg: error al procesar linux-image-2.6.32-5-amd64 (--configure):
 el subproceso instalado el script post-installation devolvió el código de salida de error 2
configured to not write apport reports
                                      Se encontraron errores al procesar:
 linux-image-2.6.32-5-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

resolució

dpkg --configure -a

Con esta simple orden, le decimos que termine la instalación pendiente. Si después de realizar este paso, seguimos teniendo los mis problemas (no desesperar), pongamos manos a la obra:

1.- Eliminar los archivos:

/var/lib/dpkg/info/"package-name".postrm

/var/lib/dpkg/info/"package-name".list

2.- apt-get clean all

3.- apt-get update

4.- apt-get upgrade

revisió hardware i moduls de hardware

lspci
NAME lspci - list all PCI devices

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)

05:02.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

 lshw

lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work). It currently supports DMI (x86 and IA-64 only), OpenFirmware device tree (PowerPC only), PCI/AGP, CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), SCSI and USB.

*-network
                description: Ethernet interface
                product: RTL8111/8168B PCI Express Gigabit Ethernet controller
                vendor: Realtek Semiconductor Co., Ltd.
                physical id: 0
                bus info: pci@0000:01:00.0
                logical name: eth0
                version: 03
                serial: 20:cf:30:f4:d1:0a
                size: 1GB/s
                capacity: 1GB/s
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autoneg
otiation
                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=N/A ip=192.168.130.2 latency=0 link
=yes multicast=yes port=MII speed=1GB/s
                resources: irq:28 ioport:d800(size=256) memory:f6fff000-f6ffffff(prefetchable) memory:f6ff8000-f6ffbfff(prefetchable) memory:f7ef0000-f7efffff
(prefetchable)


*-network description: Ethernet interface
 product: RTL-8139/8139C/8139C+
vendor: Realtek Semiconductor Co., Ltd.
physical id: 2
bus info: pci@0000:05:02.0
logical name: eth1
version: 10 serial: 00:22:2d:80:99:bf
size: 100MB/s
capacity: 100MB/s
width: 32 bits
clock: 33MHz
capabilities: pm bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=8139too driverversion=0.9.28 duplex=full ip=192.168.0.201 latency=64 link=yes maxlatenc y=64 mingnt=32 multicast=yes port=MII speed=100MB/s
resources: irq:17 ioport:e800(size=256) memory:f7fff000-f7fff0ff memory:f7fc0000-f7fdffff(prefetchable)

 lsmod

 lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded. modprobe modprobe intelligently adds or removes a module from the Linux kernel: note that for convenience, there is no difference between _ and - in module names (automatic underscore conversion is performed). modprobe looks in the module directory /lib/modules/`uname -r` for all the modules and other files, except for the optional /etc/modprobe.conf configuration file and /etc/modprobe.d directory (see modprobe.conf(5)). modprobe will also use module options specified on the kernel command line in the form of .

divendres, 10 de maig del 2013

grub-customizer - grub -

per arreglar grub d'arrancada pero fins i tot per arreglar la part gràfica, a la tercera pestanya.

 sudo add-apt-repository ppa:danielrichter2007/grub- customizer

sudo apt-get update

sudo apt-get install grub-customizer

sudo grub-customizer

només per canviar l'ordre d'arrancada

sudo nano /etc/default/grub
GRUB_DEFAULT=4

update-grub

mod-evasive apache

/etc/apache2/conf.d# more mod-evasive.conf DOSHashTableSize 3097 DOSPageCount 13 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 15 DOSLogDir /tmp DOSWhitelist 127.0.0.1 aquest son els valors que menys problemes ens donen per treballar en local, i amb moodle i eines com prestashop i joomla que fan moltes peticions per web..... a2enmod mod-evasive Module mod-evasive already enabled administrator@ubuntu:~$ sudo /etc/init.d/apache2 restart * Restarting web server apache2 de fer la prova amb f5 obtenim al fitxer error.log d'apache [Fri May 10 01:38:48 2013] [error] [client 192.168.2.252] client denied by server configuration: /srv/www/moodle2/ [Fri May 10 01:38:48 2013] [error] [client 192.168.2.252] client denied by server configuration: /var/cache/munin/www/localdomain/localhost.localdomain/apache_volume-week.png, referer: http://ies-sabadell.cat/munin/localdomain/localhost.localdomain/index.html i al directori /tmp /tmp# ls -la -rw-r--r-- 1 www-data www-data 5 may 10 01:38 dos-188.77.249.218 -rw-r--r-- 1 www-data www-data 5 may 9 10:13 dos-192.168.0.228 -rw-r--r-- 1 www-data www-data 5 may 7 13:12 dos-192.168.1.240 -rw-r--r-- 1 www-data www-data 6 may 8 10:10 dos-192.168.1.244 -rw-r--r-- 1 www-data www-data 5 may 7 13:23 dos-192.168.128.239 -rw-r--r-- 1 www-data www-data 5 may 7 18:51 dos-192.168.128.89 -rw-r--r-- 1 www-data www-data 6 may 7 13:51 dos-192.168.129.181 -rw-r--r-- 1 www-data www-data 6 may 7 16:46 dos-192.168.129.208 -rw-r--r-- 1 www-data www-data 6 may 8 08:34 dos-192.168.129.222 -rw-r--r-- 1 www-data www-data 6 may 8 10:01 dos-192.168.129.53 -rw-r--r-- 1 www-data www-data 6 may 7 13:54 dos-192.168.129.78 -rw-r--r-- 1 www-data www-data 6 may 9 12:01 dos-192.168.130.34 -rw-r--r-- 1 www-data www-data 6 may 8 11:56 dos-192.168.130.41 -rw-r--r-- 1 www-data www-data 5 may 10 01:38 dos-192.168.2.252 -rw-r--r-- 1 www-data www-data 5 may 10 01:39 dos-79.151.132.218 http://www.electromech.info/linux-apache-mod-evasive-module-howto.html WHAT IS MOD_EVASIVE ? mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection tool, and can be easily configured to talk to ipchains, firewalls, routers, and etcetera. Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following: - Requesting the same page more than a few times per second - Making more than 50 concurrent requests on the same child per second - Making any requests while temporarily blacklisted (on a blocking list) This method has worked well in both single-server script attacks as well as distributed attacks, but just like other evasive tools, is only as useful to the point of bandwidth and processor consumption (e.g. the amount of bandwidth and processor required to receive/process/respond to invalid requests), which is why it's a good idea to integrate this with your firewalls and routers. This module instantiates for each listener individually, and therefore has a built-in cleanup mechanism and scaling capabilities. Because of this, legitimate requests are rarely ever compromised, only legitimate attacks. Even a user repeatedly clicking on 'reload' should not be affected unless they do it maliciously. Three different module sources have been provided: Apache v1.3 API: mod_evasive.c Apache v2.0 API: mod_evasive20.c HOW IT WORKS A web hit request comes in. The following steps take place: - The IP address of the requestor is looked up on the temporary blacklist - The IP address of the requestor and the URI are both hashed into a "key". A lookup is performed in the listener's internal hash table to determine if the same host has requested this page more than once within the past 1 second. - The IP address of the requestor is hashed into a "key". A lookup is performed in the listerner's internal hash table to determine if the same host has requested more than 50 objects within the past second (from the same child). If any of the above are true, a 403 response is sent. This conserves bandwidth and system resources in the event of a DoS attack. Additionally, a system command and/or an email notification can also be triggered to block all the originating addresses of a DDoS attack. Once a single 403 incident occurs, mod_evasive now blocks the entire IP address for a period of 10 seconds (configurable). If the host requests a page within this period, it is forced to wait even longer. Since this is triggered from requesting the same URL multiple times per second, this again does not affect legitimate users. The blacklist can/should be configured to talk to your network's firewalls and/or routers to push the attack out to the front lines, but this is not required. mod_evasive also performs syslog reporting using daemon.alert. Messages will look like this: Aug 6 17:41:49 elijah mod_evasive[23184]: [ID 801097 daemon.alert] Blacklisting address x.x.x.x: possible attack. WHAT IS THIS TOOL USEFUL FOR? This tool is *excellent* at fending off request-based DoS attacks or scripted attacks, and brute force attacks. When integrated with firewalls or IP filters, mod_evasive can stand up to even large attacks. Its features will prevent you from wasting bandwidth or having a few thousand CGI scripts running as a result of an attack. If you do not have an infrastructure capable of fending off any other types of DoS attacks, chances are this tool will only help you to the point of your total bandwidth or server capacity for sending 403's. Without a solid infrastructure and address filtering tool in place, a heavy distributed DoS will most likely still take you offline. Howto Install on Apache 2.X [root@station100 ~]# rpm -q httpd httpd-2.2.3-31.el5 First download it from internet or given location. [root@station100 ~]# wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz [root@station100 ~]# cp mod_evasive_1.10.1.tar.gz /tmp/ [root@station100 ~]# cd /tmp/ [root@station100 tmp]# tar -zxf mod_evasive_1.10.1.tar.gz [root@station100 tmp]# cd mod_evasive [root@station100 mod_evasive]# ls CHANGELOG Makefile.tmpl mod_evasive.c README LICENSE mod_evasive20.c mod_evasiveNSAPI.c test.pl [root@station100 mod_evasive]# ls CHANGELOG Makefile.tmpl mod_evasive.c README LICENSE mod_evasive20.c mod_evasiveNSAPI.c test.pl [root@station100 mod_evasive]# locate apxs /usr/sbin/apxs /usr/share/man/man8/apxs.8.gz /var/www/manual/programs/apxs.html /var_old/www/manual/programs/apxs.html [root@station100 mod_evasive]# /usr/sbin/apxs -i -a -c mod_evasive20.c /usr/lib/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fno-strict-aliasing -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -c -o mod_evasive20.lo mod_evasive20.c && touch mod_evasive20.slo mod_evasive20.c: In function 'access_checker': mod_evasive20.c:212: warning: implicit declaration of function 'getpid' mod_evasive20.c:212: warning: format '%ld' expects type 'long int', but argument 4 has type 'int' mod_evasive20.c:229: warning: ignoring return value of 'system', declared with attribute warn_unused_result mod_evasive20.c: In function 'destroy_hit_list': mod_evasive20.c:301: warning: control reaches end of non-void function mod_evasive20.c: In function 'create_hit_list': mod_evasive20.c:118: warning: control reaches end of non-void function /usr/lib/apr-1/build/libtool --silent --mode=link gcc -o mod_evasive20.la -rpath /usr/lib/httpd/modules -module -avoid-version mod_evasive20.lo /usr/lib/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib/apr-1/build/libtool' mod_evasive20.la /usr/lib/httpd/modules /usr/lib/apr-1/build/libtool --mode=install cp mod_evasive20.la /usr/lib/httpd/modules/ cp .libs/mod_evasive20.so /usr/lib/httpd/modules/mod_evasive20.so cp .libs/mod_evasive20.lai /usr/lib/httpd/modules/mod_evasive20.la cp .libs/mod_evasive20.a /usr/lib/httpd/modules/mod_evasive20.a chmod 644 /usr/lib/httpd/modules/mod_evasive20.a ranlib /usr/lib/httpd/modules/mod_evasive20.a PATH="$PATH:/sbin" ldconfig -n /usr/lib/httpd/modules ---------------------------------------------------------------------- Libraries have been installed in: /usr/lib/httpd/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- chmod 755 /usr/lib/httpd/modules/mod_evasive20.so [activating module `evasive20' in /etc/httpd/conf/httpd.conf] [root@station100 mod_evasive]# [root@station100 mod_evasive]# ls /usr/lib/httpd/modules/ libmodnss.so mod_cgid.so mod_logio.so libphp5.so mod_cgi.so mod_mem_cache.so mod_actions.so mod_dav_fs.so mod_mime_magic.so mod_alias.so mod_dav.so mod_mime.so mod_asis.so mod_dbd.so mod_negotiation.so mod_auth_basic.so mod_deflate.so mod_perl.so mod_auth_digest.so mod_dir.so mod_proxy_ajp.so mod_authn_alias.so mod_disk_cache.so mod_proxy_balancer.so mod_authn_anon.so mod_dumpio.so mod_proxy_connect.so mod_authn_dbd.so mod_env.so mod_proxy_ftp.so mod_authn_dbm.so mod_evasive20.so mod_proxy_http.so mod_authn_default.so mod_expires.so mod_proxy.so mod_authn_file.so mod_ext_filter.so mod_rewrite.so mod_authnz_ldap.so mod_file_cache.so mod_setenvif.so mod_authz_dbm.so mod_filter.so mod_speling.so mod_authz_default.so mod_headers.so mod_ssl.so mod_authz_groupfile.so mod_ident.so mod_status.so mod_authz_host.so mod_imagemap.so mod_suexec.so mod_authz_owner.so mod_include.so mod_unique_id.so mod_authz_user.so mod_info.so mod_userdir.so mod_autoindex.so mod_ldap.so mod_usertrack.so mod_cache.so mod_log_config.so mod_version.so mod_cern_meta.so mod_log_forensic.so mod_vhost_alias.so [root@station100 mod_evasive]# CONFIGURATION mod_evasive has default options configured, but you may also add the following block to your httpd.conf: APACHE v1.3 ----------- DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 APACHE v2.0 ----------- DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 DOSHashTableSize ---------------- The hash table size defines the number of top-level nodes for each child's hash table. Increasing this number will provide faster performance by decreasing the number of iterations required to get to the record, but consume more memory for table space. You should increase this if you have a busy web server. The value you specify will automatically be tiered up to the next prime number in the primes list (see mod_evasive.c for a list of primes used). DOSPageCount ------------ This is the threshhold for the number of requests for the same page (or URI) per page interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list. DOSSiteCount ------------ This is the threshhold for the total number of requests for any object by the same client on the same listener per site interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list. DOSPageInterval --------------- The interval for the page count threshhold; defaults to 1 second intervals. DOSSiteInterval --------------- The interval for the site count threshhold; defaults to 1 second intervals. DOSBlockingPeriod ----------------- The blocking period is the amount of time (in seconds) that a client will be blocked for if they are added to the blocking list. During this time, all subsequent requests from the client will result in a 403 (Forbidden) and the timer being reset (e.g. another 10 seconds). Since the timer is reset for every subsequent request, it is not necessary to have a long blocking period; in the event of a DoS attack, this timer will keep getting reset. DOSEmailNotify -------------- If this value is set, an email will be sent to the address specified whenever an IP address becomes blacklisted. A locking mechanism using /tmp prevents continuous emails from being sent. NOTE: Be sure MAILER is set correctly in mod_evasive.c (or mod_evasive20.c). The default is "/bin/mail -t %s" where %s is used to denote the destination email address set in the configuration. If you are running on linux or some other operating system with a different type of mailer, you'll need to change this. DOSSystemCommand ---------------- If this value is set, the system command specified will be executed whenever an IP address becomes blacklisted. This is designed to enable system calls to ip filter or other tools. A locking mechanism using /tmp prevents continuous system calls. Use %s to denote the IP address of the blacklisted IP. DOSLogDir --------- Choose an alternative temp directory By default "/tmp" will be used for locking mechanism, which opens some security issues if your system is open to shell users. http://security.lss.hr/index.php?page=details&ID=LSS-2005-01-01 In the event you have nonprivileged shell users, you'll want to create a directory writable only to the user Apache is running as (usually root), then set this in your httpd.conf. WHITELISTING IP ADDRESSES IP addresses of trusted clients can be whitelisted to insure they are never denied. The purpose of whitelisting is to protect software, scripts, local searchbots, or other automated tools from being denied for requesting large amounts of data from the server. Whitelisting should *not* be used to add customer lists or anything of the sort, as this will open the server to abuse. This module is very difficult to trigger without performing some type of malicious attack, and for that reason it is more appropriate to allow the module to decide on its own whether or not an individual customer should be blocked. To whitelist an address (or range) add an entry to the Apache configuration in the following fashion: DOSWhitelist 127.0.0.1 DOSWhitelist 127.0.0.* Wildcards can be used on up to the last 3 octets if necessary. Multiple DOSWhitelist commands may be used in the configuration. -- So we will add our network as whitelist ip #our network is 192.168.2.0/24 DOSWhitelist 127.0.0.1 DOSWhitelist 192.168.2.* So finally our entry in httpd.conf is #mod_evasive20 configuration start here------- DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 #our network is 192.168.2.0/24 DOSWhitelist 127.0.0.1 DOSWhitelist 192.168.2.* #mod_evasive20 configuration end here-------- Let us restart the service [root@station100 ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@station100 ~]# Before running final test ... What is mod_evasive? mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to ipchains, firewalls, routers, and etcetera. mod_evasive presently reports abuses via email and syslog facilities. Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following: Requesting the same page more than a few times per second Making more than 50 concurrent requests on the same child per second Making any requests while temporarily blacklisted (on a blocking list) This method has worked well in both single-server script attacks as well as distributed attacks, but just like other evasive tools, is only as useful to the point of bandwidth and processor consumption (e.g. the amount of bandwidth and processor required to receive/process/respond to invalid requests), which is why it’s a good idea to integrate this with your firewalls and routers for maximum protection. This module instantiates for each listener individually, and therefore has a built-in cleanup mechanism and scaling capabilities. Because of this per-child design, legitimate requests are never compromised (even from proxies and NAT addresses) but only scripted attacks. Even a user repeatedly clicking on ‘reload’ should not be affected unless they do it maliciously. mod_evasive is fully tweakable through the Apache configuration file, easy to incorporate into your web server, and easy to use.

ver modulos apache cargados

/usr/sbin/apache2ctl -t -D DUMP_MODULES Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm_prefork_module (static) http_module (static) so_module (static) actions_module (shared) alias_module (shared) auth_basic_module (shared) auth_mysql_module (shared) authn_file_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) include_module (shared) mime_module (shared) evasive20_module (shared) security2_module (shared) negotiation_module (shared) perl_module (shared) php5_module (shared) reqtimeout_module (shared) rewrite_module (shared) setenvif_module (shared) ssl_module (shared) status_module (shared) suexec_module (shared) unique_id_module (shared) userdir_module (shared) Syntax OK todos los módulos de Apache instalados y disponibles para activar se encuentran en un directorio llamado mods-available, bajo /etc/apache2. ls mods-enabled actions.load authn_file.load autoindex.conf dir.conf mime.load perl.load rewrite.load status.conf userdir.load alias.conf authz_default.load autoindex.load dir.load mod-evasive.load php5.conf setenvif.conf status.load alias.load authz_groupfile.load cgi.load env.load mod-security.load php5.load setenvif.load suexec.load auth_basic.load authz_host.load deflate.conf include.load negotiation.conf reqtimeout.conf ssl.conf unique_id.load auth_mysql.load authz_user.load deflate.load mime.conf negotiation.load reqtimeout.load ssl.load userdir.conf ls sites-enabled 000-default 000-default.save default-ssl Habilitando y Desactivando Módulos en Apache: a2enmod y a2dismod Para activar y desactivar módulos en Apache, usamos las instrucciones a2enmod y a2dismod (del inglés "Apache 2 enable module" o "Apache 2 habilitar módulo" y "Apache 2 disable module" o "Apache 2 desactivar módulo"). Lo primero es asegurarnos de que se encuentra físicamente en el directorio /etc/apache2/mods-available. Si existe allí, basta con escribir el comando de activación seguido del nombre del módulo y luego recargar Apache. sudo a2dismod nombre-del-modulo sudo /etc/init.d/apache2 reload Por ejemplo, para desactivar PHP, hacemos: sudo a2dismod php5 sudo /etc/init.d/apache2 reload http://www.socinfo.com/ubuntu/apache/modulos/activar-e-instalar

Herramientas de la línea de comandos para supervisar el rendimiento de Linux

http://www.linux-party.com/index.php/15-documentacion/8709-15-herramientas-de-la-linea-de-comandos-para-supervisar-el-rendimiento-de-linux 15 Herramientas de la línea de comandos para supervisar el rendimiento de Linux Publicado el Lunes, 06 Mayo 2013 12:00 | Escrito por Super User | | Es realmente un trabajo muy duro para todo administrador Linux supervisar y depurar los problemas de rendimiento del sistema todos los días. Después de ser un administrador de Linux en la industria de TI, me enteré de que lo difícil es vigilar y mantener los sistemas en funcionamiento. Por esta razón, he compilado la lista de las 15 herramientas utilizadas para el monitoreo del sistema desde la línea de comandos que pueden ser útiles para cualquier administrador de sistemas Linux / Unix. Estos comandos están disponibles en todas las versiones de Linux y puede ser útil para controlar y encontrar las causas reales de los problemas de rendimiento. Esta lista de comandos que se muestran aquí para que pueda escoger la que sea más adecuada para su escenario de supervisión. El Comando Top Linux es un programa para la supervisión del rendimiento que utilizan con mucha frecuencia la mayoría de los administradores de sistemas para comprobar el rendimiento de Linux y está disponible en muchos sistemas Linux / Unix. El comando top se utiliza para mostrar todo el funcionamiento y los procesos en tiempo realmente activos en una lista que actualiza regularmente. Se mostrará el uso de CPU, uso de memoria, la memoria de intercambio, Cache, Tamaño de búfer, PID de proceso, usuario, Comandos y mucho más. También muestra la carga de memoria y de la CPU de un proceso en ejecución. El comando top es mucho útil para el administrador de sistema para supervisar y tomar acción correcta cuando se requiera. Vamos a ver la parte superior de comandos en acción. # top top - 13:17:44 up 3:35, 3 users, load average: 0.30, 0.61, 0.71 Tasks: 195 total, 1 running, 194 sleeping, 0 stopped, 0 zombie Cpu(s): 8.6%us, 1.5%sy, 0.0%ni, 89.4%id, 0.0%wa, 0.3%hi, 0.2%si, 0.0%st Mem: 3950228k total, 3669632k used, 280596k free, 260276k buffers Swap: 5128188k total, 0k used, 5128188k free, 1039232k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 6832 javier 20 0 2594m 1.2g 44m S 11.0 31.9 4:09.29 firefox 6929 javier 20 0 746m 204m 23m S 5.6 5.3 0:26.26 plugin-containe 7023 javier 20 0 547m 27m 20m S 2.3 0.7 0:02.30 konsole 2840 root 20 0 141m 30m 15m S 0.7 0.8 6:42.59 X 684 root 20 0 7408 316 212 S 0.3 0.0 0:00.48 gpm 1250 mysql 20 0 539m 46m 3496 S 0.3 1.2 0:14.68 mysqld 4759 javier 20 0 2890m 32m 19m S 0.3 0.8 1:54.24 kwin 1 root 20 0 50164 4804 2056 S 0.0 0.1 0:01.24 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.31 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H 8 root RT 0 0 0 0 S 0.0 0.0 0:00.20 migration/0 9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 10 root 20 0 0 0 0 S 0.0 0.0 0:03.62 rcu_sched 11 root RT 0 0 0 0 S 0.0 0.0 0:00.03 watchdog/0 12 root RT 0 0 0 0 S 0.0 0.0 0:00.04 watchdog/1 13 root 20 0 0 0 0 S 0.0 0.0 0:00.32 ksoftirqd/1 14 root RT 0 0 0 0 S 0.0 0.0 0:00.11 migration/1 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H 17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper 2. Vmstat - estadísticas de la memoria virtual Comando vmstat de Linux se utiliza para mostrar las estadísticas de la memoria virtual, hilos kernerl, discos, procesos de sistema, bloques de E / S, interrupciones, actividad de la CPU y mucho más. Al comando vmstat predeterminada no está disponible en los sistemas Linux es necesario instalar un paquete llamado sysstat que incluye un programa vmstat. El uso común del formato del comando es. vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 2 0 49896 62100 1178240 4316436 0 0 146 131 6 49 3 0 96 1 3. Lsof - Lista de archivos abiertos Comando lsof se utiliza en muchos Linux / Unix como sistema que se utiliza para motar todos los archivos abiertos y los procesos que los utilizan. Los archivos abiertos incluidos son archivos de disco, de la red, tuberías, dispositivos y procesos. Una de las principales razones para el uso de este comando es que cuando un disco no se puede desmontar y muestra el error de que hay archivos que lo están utilizando o están. Con este comando puede identificar fácilmente qué archivos están en uso. El formato más común para este comando. ies-sabadell:~# lsof |grep /12 migration 12 root txt unknown /proc/12/exe kjournald 1234 root txt unknown /proc/1234/exe kjournald 1235 root txt unknown /proc/1235/exe kjournald 1236 root txt unknown /proc/1236/exe kjournald 1237 root txt unknown /proc/1237/exe kjournald 1238 root txt unknown /proc/1238/exe kjournald 1239 root txt unknown /proc/1239/exe kjournald 1240 root txt unknown /proc/1240/exe sftp-serv 1612 12smx2a26 cwd DIR 8,3 4096 1223729 /home/alumnes/smx2a-12/12smx2a26 mysqld 1908 mysql 14u REG 8,7 7168 317713 /var/lib/mysql/12smx2a26/ps_product.MYI mysqld 1908 mysql 15u REG 8,7 1240 317714 /var/lib/mysql/12smx2a26/ps_product.MYD mysqld 1908 mysql 16u REG 8,7 4096 317716 /var/lib/mysql/12smx2a26/ps_product_shop.MYI mysqld 1908 mysql 17u REG 8,7 700 317717 /var/lib/mysql/12smx2a26/ps_product_shop.MYD mysqld 1908 mysql 18u REG 8,7 6144 317734 /var/lib/mysql/12smx2a26/ps_product_lang.MYI mysqld 1908 mysql 19u REG 8,7 10068 317735 /var/lib/mysql/12smx2a26/ps_product_lang.MYD mysqld 1908 mysql 20u REG 8,7 5120 317567 /var/lib/mysql/12smx2a26/ps_image.MYI mysqld 1908 mysql 21u REG 8,7 312 317600 /var/lib/mysql/12smx2a26/ps_image.MYD mysqld 1908 mysql 22u REG 8,7 3072 318597 /var/lib/mysql/12smx2a26/ps_image_shop.MYI mysqld 1908 mysql 23u REG 8,7 260 318598 /var/lib/mysql/12smx2a26/ps_image_shop.MYD 4. Tcpdump - Packet Analyzer Tcpdump es el analizador de paquetes de la línea de comandos más utilizado o programa de succionador de paquetes que se utiliza tanto para la captura o el filtro de paquetes TCP/IP que recibieron o han sido transferidos en una interfaz específica a través de una red. También proporciona una opción para guardar los paquetes capturados en un archivo para su posterior análisis. tcpdump esta casi siempre disponible en las principales distribuciones de Linux. # tcpdump -i eth0 22:19:22.443542 IP 208.92.53.111.http > localhost.localdomain.33461: Flags [P.], seq 4213809828:4213810056, ack 3942125296, win 1716, options [nop,nop,TS val 1933996291 ecr 1717147], length 228 22:19:22.443634 IP localhost.localdomain.33461 > 208.92.53.111.http: Flags [.], ack 4294965856, win 1395, options [nop,nop,TS val 1717306 ecr 1933996173,nop,nop,sack 1 {0:228}], length 0 22:19:22.443669 IP 208.92.53.111.http > localhost.localdomain.33461: Flags [.], seq 4294965856:0, ack 1, win 1716, options [nop,nop,TS val 1933996291 ecr 1717147], length 1440 22:19:22.443702 IP localhost.localdomain.33461 > 208.92.53.111.http: Flags [.], ack 228, win 1395, options [nop,nop,TS val 1717306 ecr 1933996291], length 0 5. Netstat - Estadísticas de la red Netstat es una herramienta de línea de comandos para controlar los paquetes de red, estadísticas entrantes y salientes, así como estadísticas de la interfaz. Es una herramienta muy útil para todos los administradores de sistema para monitorear el desempeño de la red y solucionar problemas relacionados con la red. # netstat -a | more Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:https *:* LISTEN tcp 0 0 *:db-lsp *:* LISTEN tcp 0 0 localhost:atmtcp *:* LISTEN tcp 0 0 *:40643 *:* LISTEN tcp 0 0 *:24837 *:* LISTEN tcp 0 0 *:mysql *:* LISTEN tcp 0 0 *:rfb *:* LISTEN tcp 0 0 *:sunrpc *:* LISTEN tcp 0 0 *:http *:* LISTEN tcp 0 0 localhost.locald:domain *:* LISTEN tcp 0 0 *:ssh *:* LISTEN tcp 0 0 localhost:ipp *:* LISTEN tcp 0 0 *:59897 *:* LISTEN tcp 0 0 localhost:smtp *:* LISTEN tcp 0 0 localhost.localdo:60709 108.160.163.40:http ESTABLISHED tcp 0 0 localhost.localdo:58334 db3msgr5010618.gat:msnp ESTABLISHED tcp 0 0 localhost.localdo:49572 wb-in-f125.:xmpp-client ESTABLISHED tcp 0 0 localhost.localdo:39190 mad01s08-in-f21.1:https ESTABLISHED tcp 0 0 localhost.localdo:57934 195.57.81.34:http ESTABLISHED tcp 0 0 localhost.localdo:34153 ec2-23-21-236-70.c:http ESTABLISHED tcp 0 0 localhost.localdo:34152 ec2-23-21-236-70.c:http ESTABLISHED tcp 0 0 localhost.localdo:34154 ec2-23-21-236-70.c:http TIME_WAIT tcp 0 0 localhost.localdo:55572 s3-1.amazonaws.co:https ESTABLISHED netstat -antpe netstat -anpte|grep ESTABLISHED netstat -anpte|grep ESTABLISHED| wc ies-sabadell:~# netstat -tulpn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1536/portmap tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 3050/perl tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN 2360/inetd tcp 0 0 0.0.0.0:4949 0.0.0.0:* LISTEN 2751/munin-node tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1748/sshd tcp 0 0 0.0.0.0:901 0.0.0.0:* LISTEN 2360/inetd tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1908/mysqld tcp6 0 0 :::80 :::* LISTEN 1054/apache2 tcp6 0 0 :::22 :::* LISTEN 1748/sshd tcp6 0 0 :::443 :::* LISTEN 1054/apache2 udp 0 0 0.0.0.0:5353 0.0.0.0:* 1735/avahi-daemon: udp 0 0 0.0.0.0:111 0.0.0.0:* 1536/portmap udp 0 0 192.168.0.201:123 0.0.0.0:* 2404/ntpd udp 0 0 192.168.130.2:123 0.0.0.0:* 2404/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 2404/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 2404/ntpd udp 0 0 0.0.0.0:10000 0.0.0.0:* 3050/perl udp 0 0 0.0.0.0:39320 0.0.0.0:* 1735/avahi-daemon: udp6 0 0 :::32980 :::* 1735/avahi-daemon: udp6 0 0 :::5353 :::* 1735/avahi-daemon: udp6 0 0 fe80::22cf:30ff:fef:123 :::* 2404/ntpd udp6 0 0 ::1:123 :::* 2404/ntpd udp6 0 0 fe80::222:2dff:fe80:123 :::* 2404/ntpd udp6 0 0 :::123 :::* 2404/ntpd 6. Htop - Seguimiento de procesos Linux Htop es una herramienta mucho más avanzada, interactiva y en tiempo real Linux para el seguimiento de procesos. Es similar al comando top de Linux pero tiene algunas características avanzadas como interfaz fácil de usar para la gestión de procesos, teclas de acceso directo, vista vertical y horizontal de los procesos y mucho más. Htop es una herramienta de terceros y no se incluye en los sistemas Linux, debe instalarlo utilizando YUM (o APT-GET) o el que sea su herramienta de gestión de paquetes. Para obtener más información sobre la instalación, lea nuestro artículo siguiente. Administración: Glances - herramienta de monitoreo y supervisión para Linux # htop 7. Iotop - Monitor Linux disco I / O Iotop es también muy similar a al comando top y al programa htop, pero tiene la función de contabilidad para monitorear y visualizar en tiempo real las E/S del disco y procesos. Esta herramienta es muy útil para encontrar el proceso exacto y disco utilizado alta lectura / escritura de los procesos. Total DISK READ: 18.63 M/s | Total DISK WRITE: 239.53 K/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND 1228 be/4 root 18.60 M/s 0.00 B/s 0.00 % 7.93 % clamscan / -r -i -l resutlat-antivirus.txt 1929 be/4 mysql 31.41 K/s 3.93 K/s 0.00 % 2.45 % mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysq~ysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306 1237 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.07 % [kjournald] 1536 be/4 daemon 0.00 B/s 0.00 B/s 0.00 % 0.00 % portmap 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init [2] 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] 3 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0] 4 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0] 5 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0] 8. Iostat - Estadísticas Entrada / Salida Iostat es una herramienta sencilla que recoger y mostrar las estadísticas de entrada y salida de un dispositivo de almacenamient del sistema y. Esta herramienta se utiliza a menudo para rastrear problemas de rendimiento de los dispositivos de almacenamiento, incluyendo dispositivos, discos locales, discos remotos como NFS. iostat Linux 2.6.32-5-amd64 (ies-sabadell.xtec.net) 10/05/13 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 2,87 0,01 0,45 1,13 0,00 95,54 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 14,63 255,34 207,11 54897797 44528426 sdc 6,90 602,27 620,46 129486752 133399232 sdb 1,98 323,02 222,52 69449840 47842056 9. IPTraf - Monitoreo en tiempo real LAN IP IPTraf es una utilidad de monitorización de código abierto basada en consola y en tiempo real de la red para Linux. (IP LAN) - Recoge una gran variedad de información como monitor de tráfico IP que pasa a través de la red, incluida la información de flags TCP, detalles ICMP, TCP / averías tráfico UDP, paquete de conexión TCP y cuenta Byne. También recoge información de estadísticas de la interfaz general y detaled de TCP, UDP,,,, errores de suma de comprobación IP no IP ICMP IP, interfaz actividad, etc 10. Psacct or Acct - Monitor de actividad del usuario La herramientas psacct o acct son muy útiles para el seguimiento de cada actividad de los usuarios en el sistema. Ambos demonios se ejecutan en segundo plano y mantienen una estrecha vigilancia sobre la actividad global de cada usuario en el sistema y también qué recursos están siendo consumidos por ellos. Estas herramientas son muy útiles para los administradores de sistemas para el seguimiento de cada actividad de los usuarios, que les gusta o que están haciendo, qué comandos ejecutan, la cantidad de recursos utilizados por ellos, el tiempo que están activos en el sistema, etc 11. Monit - Proceso de Linux y Seguimiento de Servicios Monit es una utilidad para la supervisión de procesos basado en web que monitoriza automáticamente los procesos, programas, archivos, directorios, permisos, sumas de control y sistemas de archivos. Efectuará un seguimiento de los servicios como Apache, MySQL, correo, FTP, ProFTP, Nginx, SSH, etc. El estado del sistema se puede verse desde la línea de comandos o usar la propia interfaz web. 12. NetHogs - Monitor por proceso Ancho de banda de red NetHogs es un pequeño programa agradable (similar al comando top Linux) que mantiene una ficha en cada actividad de red de proceso en el sistema. También mantiene una pista de ancho de banda de tráfico de red en tiempo real que utiliza cada programa o aplicación. 13. iftop - Control de ancho de banda de red iftop es otra utilidad basada en terminal para el control que muestra una lista actualizada con frecuencia de utilización del ancho de banda de red (hosts de origen y de destino) que pasa a través de la interfaz de red en el sistema. iftop se considera a la red, lo que 'top' hace uso de la CPU. iftop es una herramienta 'top' para monitorear una interfaz seleccionada y muestra un uso de ancho de banda actual entre dos hosts. 14. Monitorix - Sistema y Red de Monitoreo Monitorix es una ligera utilidad gratuita que está diseñado para ejecutar y supervisar los recursos del sistema y de la red con el mayor número posible de servidores Linux / Unix. Se ha incorporado un servidor web HTTP que recoge regularmente información del sistema y de la red y los muestra en los gráficos. Efectuará un seguimiento de la carga promedio del sistema y su uso, la asignación de memoria, la salud del disco, los servicios del sistema, puertos de red, estadísticas de correo (Sendmail, Postfix, Dovecot, etc), las estadísticas de MySQL y muchos más. Es diseñado para controlar el rendimiento general del sistema y ayuda en la detección de fallas, cuellos de botella, actividades anormales, etc 15. Arpwatch - Ethernet Activity Monitor Arpwatch es un programa que está diseñado para controlar de resolución de direcciones (MAC y cambios en la dirección IP) del tráfico de red Ethernet en una red Linux. Está continuamente vigilando el tráfico Ethernet y registra los cambios en las direcciones IPs y direcciones MACs, los cambios de pares junto con las marcas de tiempo en una red. También tiene una función para enviar un e-mail avisando al administrador, cuando una pareja es agregada o cambia. Es muy útil en la detección de suplantación ARP en una red.