chmod +x /etc/network/if-up.d/iptables
Если же этого файла там нету, то его необходимо создать, вот его содержимое:
#!/bin/sh
/sbin/iptables-restore < /var/lib/iptables/rules
chmod +x /etc/network/if-up.d/iptables
#!/bin/sh
/sbin/iptables-restore < /var/lib/iptables/rules
/var/lib/iptables/rules
disable_functions = dl, shell_exec, posix_mkfifo, exec, system,passthru, symlink, link, set_time_limit, max_execution_time
vi /etc/udev/rules.d/70-persistent-net.rulesи исправляем там mac адрес на новый :)
ps aux
elinks -dump http://localhost:80/server-status
netstat -apnt
# scp
-bash: scp: command not found
# sftp
-bash: sftp: command not found
yum -y install openssh-clients
facter
architecture => x86_64
domain => test.ru
facterversion => 1.5.7
fqdn => 'test'
hardwareisa => x86_64
hardwaremodel => x86_64
hostname => monitor
id => root
interfaces => eth0,sit0
ipaddress => 88.
ipaddress_eth0 => 88.
is_virtual => false
kernel => Linux
kernelmajversion => 2.6
kernelrelease => 2.6.18-164.el5
kernelversion => 2.6.18
macaddress => 00:19
macaddress_eth0 => 00:19
manufacturer => MSI
memoryfree => 3.50 GB
memorysize => 3.80 GB
netmask => 255.255.255.255
netmask_eth0 => 255.255.255.255
network_eth0 => 88.
operatingsystem => CentOS
operatingsystemrelease => 5.4
path => /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
physicalprocessorcount => 1
processor0 => Dual-Core AMD Opteron(tm) Processor 1218
processor1 => Dual-Core AMD Opteron(tm) Processor 1218
processorcount => 2
productname => MS-7252
ps => ps -ef
puppetversion => 0.24.8
rubysitedir => /usr/lib/ruby/site_ruby/1.8
rubyversion => 1.8.5
selinux => false
serialnumber => To Be Filled By O.E.M.
sshdsakey => ''
sshrsakey => ''
swapfree => 4.01 GB
swapsize => 4.01 GB
timezone => CET
type => Desktop
uniqueid => c6583524
uptime => 69 days
uptime_days => 69
uptime_hours => 1670
uptime_seconds => 6012655
virtual => physical
erb -x -T - templates/rpaf.conf.erb
_erbout = ''; _erbout.concat "\n" \n"
_erbout.concat "RPAFenable On\n"
_erbout.concat "RPAFsethostname On\n"
_erbout.concat "RPAFproxy_ips "; print '127.0.0.1' ; _erbout.concat "\n"
_erbout.concat "
_erbout
echo "CP1251" > /usr/local/ispmgr/etc/filemgr.enc
echo "UTF8" >> /usr/local/ispmgr/etc/filemgr.enc
iconv -l |cut -d" " -f1|sed "s|//||g" >> /usr/local/ispmgr/etc/filemgr.enc
killall -9 -r ispm
cat /etc/sysconfig/network
### Hetzner Online AG - installimage
# general networking
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=CentOS-54-64-minimal
sed -e 's/\(HOSTNAME=\).*/\1testdomain.ru/g' /etc/sysconfig/network
### Hetzner Online AG - installimage
# general networking
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=testdomain.ru
sed -e 's/\(HOSTNAME=\).*/\1testdomain.ru/g' /etc/sysconfig/network > /etc/sysconfig/network.new
mv /etc/sysconfig/network.new /etc/sysconfig/network
apt-get install lynx -y --force-yes
apt-get install squid3 -y --force-yes
update-rc.d squid3 defaults
/etc/init.d/squid3 restart
netstat -lnpt | grep squid
tcp 0 0 0.0.0.0:3128 0.0.0.0:* LISTEN 22485/(squid)
vi /etc/squid3/squid.conf
auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/passwd
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users
# And finally deny all other access to this proxy
http_access deny all
htpasswd -c /etc/squid3/passwd user1
New password:
Re-type new password:
Adding password for user user1
chmod o+r /etc/squid3/passwd
/etc/init.d/squid3 restart
http_proxy=http://ip.ad.dr.es:3128 wget --proxy-user user1 --proxy-password qwerty http://ya.ru
Proxy request sent, awaiting response... 407 Proxy Authentication Required
2009-12-28 02:17:05 ERROR 407: Proxy Authentication Required.
Connecting to ip.ad.dr.es:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 4908 (4.8K) [text/html]
tail -f /var/log/squid3/access.log
vzctl enter 1111
enter into CT 1111 failed
Unable to open pty: No such file or directory
vzctl exec 1111 /sbin/MAKEDEV pty
vzctl exec 1111 /sbin/MAKEDEV tty
vzcenter 1111
entered into CT 1111
smartctl -t short /dev/sda
smartctl --all /dev/sda
SMART Disabled. Use option -s with argument 'on' to enable it.
smartctl -s on /dev/sda
smartctl -d ata --all /dev/sda
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 4367 -
cat /etc/gentoo-release
Gentoo Base System release 1.12.13
iptables -A drop-invalid -i venet0 -p tcp -m multiport --dports 100:150 -j DROP
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.8/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.18-128.2.1.el5.028stab064.8/modules.dep: No such file or directory
mkdir -p /lib/modules/2.6.18-128.2.1.el5.028stab064.8
depmod -a
iptables -A drop-invalid -i venet0 -p tcp -m multiport --dports 100:150 -j DROP
fetch "http://download.ispsystem.com/install.sh"
cd /usr/ports/sysutils/screen
make install clean
/usr/local/bin/screen
cd /usr/ports/devel/libtool22/
make install clean
Note that FreeBSD installation may last from 15 minutes to 1 - 2 hours, according to a server capacity.
apt-get install -y --force-yes cron-apt
vi /etc/cron-apt/config
SYSLOGON="always"
cron-apt
tail -f /var/log/syslog
Dec 24 09:50:19 localhost cron-apt: Building dependency tree...
Dec 24 09:50:20 localhost cron-apt: CRON-APT LINE: /usr/bin/apt-get dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
Dec 24 09:50:20 localhost cron-apt: Reading package lists...
Dec 24 09:50:20 localhost cron-apt: Building dependency tree...
Dec 24 09:50:20 localhost cron-apt: The following packages will be upgraded:
Dec 24 09:50:20 localhost cron-apt: acpid dnsutils libbind9-0 libdns22 libisc11 libisccc0 libisccfg1 liblwres9
Dec 24 09:50:20 localhost cron-apt: 8 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Dec 24 09:50:20 localhost cron-apt: Need to get 0B/1258kB of archives.
Dec 24 09:50:20 localhost cron-apt: After unpacking 0B of additional disk space will be used.
Dec 24 09:50:20 localhost cron-apt: Download complete and in download only mode
yum install yum-updatesd -y
chkconfig yum-updatesd on
chkconfig --list | grep upda
yum-updatesd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vi /etc/yum/yum-updatesd.conf
emit_via = syslog
# automatically download updates
do_download = yes
# automatically download deps of updates
do_download_deps = yes
/etc/init.d/yum-updatesd start
Dec 23 16:50:47 xen15 : 174 updates available
In the 5.4 update, several significant additions have been made to file systems support. Base Red Hat Enterprise Linux now includes the Filesystem in Userspace (FUSE) kernel modules and user space utilities, allowing users to install and run their own FUSE file systems on an unmodified Red Hat Enterprise Linux kernel (BZ#457975). Support for the XFS file system has also been added to the kernel for future product enablement (BZ#470845). The FIEMAP input/output control (ioctl) interface has been implemented, allowing the physical layout of files to be mapped efficiently. The FIEMAP ioctl can be used by applications to check for fragmentation of a specific file or to create an optimized copy of a sparsely allocated file (BZ#296951).
cat /var/log/secure|grep fail|wc -l
54887
vi /etc/ssh/sshd_config
Port 2000
/etc/init.d/sshd restart
netstat -lnpt | grep ssh
tcp 0 0 :::2000 :::* LISTEN 6981/sshd
yum install -y fuse-curlftpfs
apt-get install -y curlftpfs
mkdir -p /mnt/backup
curlftpfs backup_server_login:password@backup_host /mnt/backup
fusermount -u /mnt/backup
Dec 23 06:04:56 billing smartd[4494]: Device: /dev/sda, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sda' to turn on SMART features
smartctl --all -d ata /dev/sdb
vi /etc/puppet/fileserver.conf
mkdir -p /etc/puppet/files
[files]
path /etc/puppet/files
allow ip.ad.dr.es
/etc/init.d/puppetmaster restart
vi /etc/puppet/files/sudoers
package {
sudo:
ensure => latest
}
file {
"/etc/sudoers":
mode => 440,
owner => 'root',
group => 'root',
source => "puppet:///files/sudoers"
}
puppetd --verbose --test
yum -y install wget
wget "http://download.ispsystem.com/install.sh"
sh install.sh
fetch "http://download.ispsystem.com/install.sh"
yum update -y
yum install -y puppet-server
ls /etc/puppet/
fileserver.conf manifests puppet.conf
ls -l /usr/lib/ruby/site_ruby/1.8/puppet/provider
augeas host naginator.rb selmodule
computer ldap.rb nameservice service
confine macauthorization nameservice.rb ssh_authorized_key
confine_collection.rb mailalias package sshkey
confine.rb maillist package.rb user
confiner.rb mcx parsedfile.rb zfs
cron mount port zone
group mount.rb selboolean zpool
vi /etc/puppet/manifests/site.pp
package {
sudo:
ensure => latest
}
/etc/init.d/puppetmaster start
chkconfig puppetmaster on
iptables -A INPUT -p tcp --dport 8140 -j ACCEPT
/etc/init.d/iptables save
yum install puppet -y
apt-get install puppet -y
update-rc.d -f puppet remove
/etc/init.d/puppet stop
ls /etc/puppet/
puppet.conf
vi /etc/puppet/puppet.conf
server=puppet.server.ru
puppetd --verbose --test
warning: peer certificate won't be verified in this SSL session
notice: Did not receive certificate
notice: Set to run 'one time'; exiting with no certificate
puppetd --verbose --test --onetime
puppetca --list
client.domain.ru
puppetca --sign client.domain.ru
Signed client.domain.ru
puppetd --verbose --test
warning: peer certificate won't be verified in this SSL session
notice: Got signed certificate
info: No classes to store
info: Caching catalog at /var/lib/puppet/localconfig.yaml
notice: Starting catalog run
notice: //Package[sudo]/ensure: created
notice: Finished catalog run in 10.89 seconds
rpm -qa | grep sudo
sudo-1.6.9p17-5.el5
vi /etc/rsyslog.conf
cat /etc/rsyslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
*.info;mail.none;authpriv.none;cron.none @@xx.xx.xx.xx:514
*.info;mail.none;authpriv.none;cron.none /var/log/messages
*.info;mail.none;authpriv.none;cron.none @@xx.xx.xx.xx:514
/etc/init.d/rsyslog restart
nc -l 514
logger -p ftp.info 'test message suxx'
vi /etc/rsyslog.conf
vi /etc/sysconfig/rsyslog
SYSLOGD_OPTIONS="-m 0"
SYSLOGD_OPTIONS="-m 0 -t514"
$AllowedSender TCP, 127.0.0.1, cli.ent.ip.add
/etc/init.d/rsyslog restart
tail -f /var/log/messages
x-pid="32126" x-info="http://www.rsyslog.com"][x-configInfo udpReception="No" udpPort="514" tcpReception="Yes" tcpPort="514"] restart
logger -p ftp.info 'test remote message suxx'
Dec 22 06:08:09 clienthostname root: test remote message suxx
yum install -y rsyslog
chkconfig syslog off
chkconfig rsyslog on
/etc/init.d/syslog stop
/etc/init.d/rsyslog start
# /etc/init.d/syslog stop
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
# /etc/init.d/rsyslog start
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
tail -f /var/log/messages
...
Dec 22 04:28:19 node yum: Installed: rsyslog-2.0.6-1.el5.x86_64
Dec 22 04:30:39 node kernel: Kernel logging (proc) stopped.
Dec 22 04:30:39 node kernel: Kernel log daemon terminating.
Dec 22 04:30:41 node exiting on signal 15
Dec 22 04:30:46 node rsyslogd: [origin software="rsyslogd" swVersion="2.0.6" x-pid="26857" x-info="http://www.rsyslog.com"][x-configInfo udpReception="No" udpPort="514" tcpReception="No" tcpPort="0"] restart
Dec 22 04:30:46 node kernel: rklogd 2.0.6, log source = /proc/kmsg started.
/etc/init.d/httpd stop # тут имеется в виду отключение админ-панели
/etc/init.d/vz stop
shutdown -r now
apt-get install -y --force-yes memcached
vi /etc/memcached.conf
update-rc.d memcached defaults
/etc/init.d/memcached start
ulimit -n 10000000
[ 4426.552587] CE: hpet increasing min_delta_ns to 15000 nsec
[ 4686.884120] CE: hpet increasing min_delta_ns to 22500 nsec
vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_netbios_ns"
IPTABLES_MODULES="ip_conntrack_netbios_ns ip_conntrack ipt_state"
/etc/init.d/iptables restart
vi /etc/vz/conf/$VEID.conf
IPTABLES="ip_tables ip_conntrack ipt_state iptable_filter"
vzctl restart $VEID
Dec 18 00:15:03 CentOS-54-64-minimal kernel: Route hash chain too long!
Dec 18 00:15:03 CentOS-54-64-minimal kernel: Adjust your secret_interval!
Dec 17 14:15:32 CentOS-54-64-minimal dhclient: parse_option_buffer: option time-offset (255) larger than buffer.
Dec 17 20:50:19 CentOS-54-64-minimal kernel: unregister_netdevice: waiting for venet0=ffff81023f457800 to become free. Usage count
= 3 ve=1730
Dec 17 20:50:50 CentOS-54-64-minimal last message repeated 3 times
Dec 17 20:51:00 CentOS-54-64-minimal kernel: unregister_netdevice: waiting for venet0=ffff81023f457800 to become free. Usage count
= 3 ve=1730
Dec 17 20:51:00 CentOS-54-64-minimal kernel: unregister_netdevice: device ffff81023f457800 marked to leak
Dec 17 20:51:00 CentOS-54-64-minimal kernel: free_netdev: device venet0=ffff81023f457800 leaked
Dec 17 20:51:00 CentOS-54-64-minimal kernel: neighbour leakage
Dec 17 20:51:00 CentOS-54-64-minimal kernel: CT: 1730: stopped
Dec 17 20:51:02 CentOS-54-64-minimal kernel: CT: 1730: started
Dec 18 00:15:03 CentOS-54-64-minimal kernel: Route hash chain too long!
Dec 18 00:15:03 CentOS-54-64-minimal kernel: Adjust your secret_interval!
Dec 18 01:15:20 CentOS-54-64-minimal syslogd 1.4.1: restart.
Several customer have pointed out that Linux has this periodic latency
resulting from us flushing the route cache. We do this purposefully, since we
don't want to use the same hash secret too long and risk having an attacker
flood our system with carefully selected packets, creating route cache entries
that all hash to the same value. It would be nice if we could, instead of
flushing every X seconds weather we need to or not, to flush only when we detect
that a chain in our hash table is growing suspiciously long.
As a workaround downgrade to RHEL 5.3 based kernel or decrease your /proc/sys/net/ipv4/route/secret_interval value (default 600), but not too much.
But I hope that a permanent fix is on it's way.
/usr/local/ispmgr/sbin/up2prof.sh
killall -9 -r ispmgr # без этого не обновится
journal
All data is committed into the journal prior to being written into the main file system.
ordered
This is the default mode. All data is forced directly out to the main file system prior to its metadata being committed to the journal.
writeback
Data ordering is not preserved - data may be written into the main file system after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal file system integrity, however it can allow old data to appear in files after a crash and journal recovery.
journal All data are committed into the journal prior to being written into the main file system.
ordered (*) All data are forced directly out to the main file system prior to its metadata being committed to the journal.
writeback Data ordering is not preserved, data may be written into the main file system after its metadata has been committed to the journal.
* writeback mode
In data=writeback mode, ext3 does not journal data at all. This mode provides
a similar level of journaling as that of XFS, JFS, and ReiserFS in its default
mode - metadata journaling. A crash+recovery can cause incorrect data to
appear in files which were written shortly before the crash. This mode will
typically provide the best ext3 performance.
* ordered mode
In data=ordered mode, ext3 only officially journals metadata, but it logically
groups metadata and data blocks into a single unit called a transaction. When
it's time to write the new metadata out to disk, the associated data blocks
are written first. In general, this mode performs slightly slower than
writeback but significantly faster than journal mode.
* journal mode
data=journal mode provides full data and metadata journaling. All new data is
written to the journal first, and then to its final location.
In the event of a crash, the journal can be replayed, bringing both data and
metadata into a consistent state. This mode is the slowest except when data
needs to be read from and written to disk at the same time where it
outperforms all other modes.
apt-get -y --force-yes install sudo
yum info rsyslog
Name : rsyslog
Arch : x86_64
Version : 2.0.6
Release : 1.el5
Size : 201 k
Repo : base
Summary : Enhanced system logging and kernel message trapping daemons
URL : http://www.rsyslog.com/
License : GPLv2+
Description: Rsyslog is an enhanced multi-threaded syslogd supporting, among others, MySQL,
: syslog/tcp, RFC 3195, permitted sender lists, filtering on any message part,
: and fine grain output format control. It is quite compatible to stock sysklogd
: and can be used as a drop-in replacement. Its advanced features make it
: suitable for enterprise-class, encryption protected syslog relay chains while
: at the same time being very easy to setup for the novice user.
yum info syslog-ng
Available Packages
Name : syslog-ng
Arch : x86_64
Version : 2.1.4
Release : 1.el5
Size : 263 k
Repo : epel
Summary : Next-generation syslog server
URL : http://www.balabit.com/products/syslog_ng/
License : GPLv2+
Description: syslog-ng, as the name shows, is a syslogd replacement, but with new
: functionality for the new generation. The original syslogd allows
: messages only to be sorted based on priority/facility pairs; syslog-ng
: adds the possibility to filter based on message contents using regular
: expressions. The new configuration scheme is intuitive and powerful.
: Forwarding logs over TCP and remembering all forwarding hops makes it
: ideal for firewalled environments.
yum -y install logwatch
ls -la /usr/share/logwatch/scripts/services/
vi /etc/logwatch/conf/logwatch.conf
# Local configuration options go here (defaults are in /usr/share/logwatch/default.conf/logwatch.conf)
Service = All
# отключаем отчет о свободном месте, т.к. за этим следит другая система мониторинга
Service = "-zz-disk_space"
# т.к. у Пофикса очень большие логи и этот скрипт не очень прямой и сильно спамит
Service = "-postfix"
/usr/local/ispmgr/sbin/mgrctl eventlist
mkdir -p /usr/local/ispmgr/event
vim /usr/local/ispmgr/event/usrparam.set
chmod 700 /usr/local/ispmgr/event/usrparam.set
killall -9 -r ispmgr
tail -f /usr/local/ispmgr/var/ispmgr.log
vi /etc/postfix/main.cf
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
mynetworks = 127.0.0.0/8, ip.ad.dr.es, ip.ad.dr.es
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_unlisted_recipient, reject_unverified_recipient
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unlisted_recipient, reject_unverified_recipient, reject
reject_unauth_destination
Reject the request unless one of the following is true:
* the resolved destination address matches $relay_domains or a subdomain thereof, and the address contains no sender-specified routing (user@elsewhere@domain),
* Postfix is the final destination: any destination that matches $mydestination, $inet_interfaces, $virtual_alias_domains, or $virtual_mailbox_domains.
The relay_domains_reject_code parameter specifies the response code for rejected requests (default: 554).
/etc/init.d/httpd restart
yum-versionlock.noarch : Yum plugin to lock specified packages from being updated
yum -y install yum-versionlock
vi /etc/yum/pluginconf.d/versionlock.list
kernel-xen*
vi /usr/lib/mailman/Mailman/Defaults.py
DEFAULT_MAX_MESSAGE_SIZE = 200
/usr/local/ispmgr/etc/rotate.conf
cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
dpkg-reconfigure tzdata
nmap -p0-65535 -v -A domain.ru
yum -y install pwgen
perl -Mstrict -e 'my @ls = qw/host1 host2 host3 host4 host5 host6/; for my $user (@ls) { $_ = `/usr/bin/pwgen 16 1`; chomp; open my $passwd, "|/usr/bin/passwd --stdin $user" or die "$!"; print {$passwd} "$_\n"; close($passwd); print "$user $_\n" }'
nc -vv -l 6969 > /tmp/disk.iso
nc -w1 domain.ru 6969 < disk.iso
yum -y install monit
vi /etc/monit.conf
set daemon 35
check process sp-daemon with pidfile /var/run/sp-daemon.pid
start = "/etc/init.d/sp-daemon start"
stop = "/etc/init.d/sp-daemon stop"
if children < 2 then restart
/sbin/chkconfig monit on
/etc/init.d/monit start
chown -R named:named /var/named/
yum -y update bind && chown -R named:named /var/named/ && /etc/init.d/named restart && ls -la /var/named | head
iptables -A INPUT -p tcp --dport 67:68 -m mac --mac-source 00:50:56:2F:97:69 -j ACCEPT
iptables -A INPUT -p tcp --dport 67:68 -j DROP
The URLs listed in source directives are for convenience and future reference only. RPM will not download these files.
yum -y install nfs-utils portmap
/etc/init.d/portmap start
/etc/init.d/nfs start
vi /etc/exports
/mnt/host2 10.0.100.100(rw,no_root_squash)
vi /etc/hosts.allow
portmap: 10.0.100.100
/etc/init.d/portmap restart
/etc/init.d/nfs restart
exportfs
yum -y install nfs-utils portmap
/etc/init.d/portmap start
/etc/init.d/nfs start
mkdir -p /mnt/nfsdisk
mount 10.0.100.100:/mnt/host5 /mnt/nfsdisk
tail -f /var/log/messages
svn pe svn:log -r 5826 --revprop
svn: Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook
cp pre-revprop-change.tmpl pre-revprop-change
chmod +x pre-revprop-change
grep -HiR 'text' * | grep -v svn
/sbin/iptables -A INPUT -m iprange --src-range 193.169.0.0-193.169.255.255 -j DROP
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install -y zabbix-agent
vi /etc/zabbix/zabbix_agentd.conf
Server=ip.ad.dr.es
Hostname=хостнейм_машинки
Timeout=30
chkconfig zabbix-agent on
/etc/init.d/zabbix-agent start
1. Входим на: http://где_у_вас_стоит_заббикс.ru
2. "Настройка" => "Узлы сети"
3. В списке выбираем "узлы сети", далее щелкаем "Создать узел сети"
4. Имя "hostname.ru" (хостнейм машинки)
5. Ставим: "Подключиться к IP адрес"
6. Вписываем DNS имя и IP машинки
7. Связать с шаблоном, жмем "добавить" и выбираем там "Template_Linux" для обычных серверов
8. Тыкаем "Ok"
cpan
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.
cpan[1]> upgrade
PERL_MM_USE_DEFAULT=1 cpan Catalyst
yum install -y ntp
vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -L"
/usr/sbin/ntpdate 0.rhel.pool.ntp.org europe.pool.ntp.org
/sbin/chkconfig ntpd on
/etc/init.d/ntpd start
sntp time.nist.gov
2010 Feb 19 16:33:10.653 + 79.089 +/- 0.152 secs
/etc/init.d/ntpd stop
/usr/sbin/ntpdate 0.rhel.pool.ntp.org europe.pool.ntp.org
/etc/init.d/ntpd start
sntp time.nist.gov
2010 Feb 19 16:33:25.111 - 0.009 +/- 0.151 secs
Dec 17 15:35:01 ovz18 kernel: CT: 1830: started
Dec 17 15:59:16 ovz18 kernel: CT: 1830: stopped
Dec 17 16:00:02 ovz18 kernel: CT: 1830: started
Dec 17 12:46:10 ovz18 kernel: free_netdev: device venet0=ffff81029897f800 leaked
Dec 17 16:44:59 ovz18 kernel: unregister_netdevice: waiting forvenet0=ffff810213b61800 to become free. Usage count= 4 ve=1818
Message from syslogd@ at Sat Dec 19 22:32:17 2009 ...
CentOS-54-64-minimal kernel: unregister_netdevice: waiting for lo=ffff810128413000 to become free. Usage count = 4 ve=1612
Message from syslogd@ at Sat Dec 19 22:32:57 2009 ...
CentOS-54-64-minimal last message repeated 4 times
Message from syslogd@ at Sat Dec 19 22:32:57 2009 ...
CentOS-54-64-minimal kernel: unregister_netdevice: device ffff810128413000 marked to leak
Message from syslogd@ at Sat Dec 19 22:32:58 2009 ...
CentOS-54-64-minimal kernel: free_netdev: device lo=ffff810128413000 leaked
# cat /proc/net/sockstat
sockets: used 3228
TCP: inuse 341 orphan 0 tw 541 alloc 497 mem 490
UDP: inuse 17 mem 0
RAW: inuse 0
FRAG: inuse 0 memory 0
cat /proc/sys/net/ipv4/tcp_mem
188416 192512 196608
vi /etc/sysctl.conf
net.ipv4.tcp_mem = 786432 1048576 1572864
sysctl -p
cat /proc/sys/net/ipv4/tcp_mem
786432 1048576 1572864
yum install -y kernel-doc
vi /usr/share/doc/kernel-doc-2.6.18/Documentation/networking/ip-sysctl.txt
tcp_mem - vector of 3 INTEGERs: min, pressure, max
min: below this number of pages TCP is not bothered about its
memory appetite.
pressure: when amount of memory allocated by TCP exceeds this number
of pages, TCP moderates its memory consumption and enters memory
pressure mode, which is exited when memory consumption falls
under "min".
max: number of pages allowed for queueing by all TCP sockets.
Defaults are calculated at boot time from amount of available
memory.
cat /proc/net/sockstat
sockets: used 1720
TCP: inuse 146 orphan 0 tw 29 alloc 207 mem 9
UDP: inuse 3 mem 0
RAW: inuse 0
FRAG: inuse 0 memory 0
cat /proc/net/sockstat
sockets: used 3402
TCP: inuse 412 orphan 0 tw 478 alloc 570 mem 205
UDP: inuse 17 mem 0
RAW: inuse 0
FRAG: inuse 0 memory 0
atomic_t tcp_memory_allocated; /* Current allocated memory. */
rm -f /usr/local/ispmgr/etc/vdsmgr.lic
wget http://lic.ispsystem.com/vdsmgr.lic?ip=ip.ad.dr.es -O/usr/local/ispmgr/etc/vdsmgr.lic
killall -9 -r vdsmgr
## IPv4 iptables kernel modules
IPTABLES="ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length"
vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_netbios_ns"
IPTABLES_MODULES="ip_conntrack_netbios_ns ip_conntrack_ftp"
/etc/init.d/iptables restart
cat /proc/modules | grep ftp
ip_conntrack_ftp 42192 0 - Live 0xffffffff8869b000 (U)
ip_conntrack 101396 6 ip_conntrack_ftp,ip_conntrack_netbios_ns,iptable_nat,xt_state,ip_nat, Live 0xffffffff8853f000 (U)
vi /etc/vz/conf/1420.conf
IPTABLES="ip_tables iptable_filter iptable_mangle ipt_limit ipt_REJECT ipt_length ip_conntrack iptable_nat ipt_REDIRECT "
IPTABLES="ip_tables iptable_filter iptable_mangle ipt_limit ipt_REJECT ipt_length ip_conntrack iptable_nat ipt_REDIRECT ip_conntrack_ftp"
vzctl restart 1420
strace -s 1024 -f -p 4939
Внутренняя ошибка malformed result
yum install -y perl-XML-LibXML perl-HTML-Parser perl-Compress-Zlib gcc make
apt-get install libxml-libxml-perl make lynx
cpan
cpan> force install HTML::TreeBuilder
# http://search.cpan.org/~petek/HTML-Tree-3.23/lib/HTML/TreeBuilder.pm
cd /tmp
wget http://search.cpan.org/CPAN/authors/id/P/PE/PETEK/HTML-Tree-3.23.tar.gz
tar -xf HTML-Tree-3.23.tar.gz
cd HTML-Tree-3.23
perl Makefile.PL
make
make install
killall -9 -r ispmgr
mkdir /tmp/apache_package/
dpkg --extract apache2_2.2.9-10+lenny6_all.deb /tmp/apache_package/
ls -la /tmp/apache_package/
total 20K
drwxr-xr-x 3 root root 4.0K 2009-11-14 23:25 .
drwxrwxrwt 5 root root 12K 2009-12-18 23:58 ..
drwxr-xr-x 3 root root 4.0K 2009-11-14 23:25 usr
apt-get clean
apt-get --reinstall install apache2
ls /var/cache/apt/archives
apt-get --download-only install apache2
ethtool -k eth0
Offload parameters for eth0:
Cannot get device udp large send offload settings: Operation not supported
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: off
udp fragmentation offload: off
generic segmentation offload: off
generic-receive-offload: off
root@CentOS-54-64-minimal ~ # /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down interface venet0: Shutting down interface venet0:
[ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
RTNETLINK answers: File exists
[ OK ]
Bringing up interface venet0: Bringing up interface venet0:
Configuring interface venet0:
net.ipv4.conf.venet0.send_redirects = 0
[ OK ]
root@CentOS-54-64-minimal ~ # ethtool -k eth0
Offload parameters for eth0:
Cannot get device udp large send offload settings: Operation not supported
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: off
udp fragmentation offload: off
generic segmentation offload: off
generic-receive-offload: off
vi /root/.bashrc
echo 'ALERT - Root Shell Access (hzgde.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" user@domain.ru
yum install -y mailx
vzmigrate --remove-area no --online new_node.ru 1201
OPT:--remove-area
OPT:--online
OPT:new-node.ru
Starting online migration of CT 1201 to new-node.ru
Preparing remote node
Initializing remote quota
Syncing private
Live migrating container...
Syncing 2nd level quota
Error: Failed to undump container
vzquota : (error) Quota is not running for id 1201
vzmigrate -v --remove-area no --online newnode.ru 1201
OPT:-v
OPT:--remove-area
OPT:--online
OPT:new.node.ru
Starting online migration of CT 1201 to new-node.ru
OpenVZ is running...
Loading /etc/vz/vz.conf and /etc/vz/conf/1201.conf files
Check IPs on destination node: new-node.ru
Preparing remote node
Copying config file
1201.conf 100% 1778 1.7KB/s 00:00
Saved parameters for CT 1201
Creating remote container root dir
Creating remote container private dir
Initializing remote quota
Quota init
Turning remote quota on
Syncing private
Live migrating container...
Suspending container
Setting up checkpoint...
suspend...
get context...
Checkpointing completed succesfully
Dumping container
Setting up checkpoint...
join context..
dump...
Checkpointing completed succesfully
Copying dumpfile
dump.1201 100% 32MB 10.7MB/s 00:03
Syncing private (2nd pass)
Syncing 2nd level quota
Dumping 2nd level quota
Copying 2nd level quota
quotadump.1201 100% 967 0.9KB/s 00:00
Load 2nd level quota
Undumping container
Restoring container ...
Starting container ...
Container is mounted
undump...
vzquota : (warning) Quota is running for id 1201 already
Error: undump failed: Invalid argument
Restoring failed:
Error: Unknown image version: 303. Can't restore.
Container start failed
Container is unmounted
Error: Failed to undump container
Resuming...
vzquota : (error) Quota is not running for id 1201
vzmigrate -v --remove-area no new-node.ru 1201
ssh-keygen -t rsa
ssh-keygen -t rsa -q -f /root/.ssh/id_rsa -P ""
ssh-copy-id -i ~/.ssh/id_rsa.pub my_login_on_target_system@target-hostname.ru
ssh-copy-id target-hostname.ru
ssh target-hostname.ru uname -r
yum upgrade vzctl -y
vzlist
vzlist | grep 1201
1201 42 running ip.ad.dr.es domain.ru
vzlist | grep 1201
Container(s) not found
yum install screen -y
screen
# а если у Вас отцепится ssh, при повторном входе делаете screen -r
IPTABLES="ip_tables iptable_filter iptable_mangle ipt_limit ipt_REJECT ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ipt_state iptable_nat ipt_REDIRECT "
vi /etc/vz/conf/1201.conf
IPTABLES=""
vzctl stop 1201; vzctl start 1201
vzmigrate -v --remove-area no --online --rsync="-v" host_target_ip 1201
--exclude-from=/root/exclude.txt
Starting online migration of CT 1201 to host_target_ip
Error: Can't connect to destination address using public key
Error: Please put your public key to destination node
OPT:--online
OPT:88.198.37.23
Starting online migration of CT 1201 to 88.198.37.23
Preparing remote node
Initializing remote quota
Syncing private
Live migrating container...
Syncing 2nd level quota
Cleanup
vzlist | grep 1201
vzlist | grep 1201
1201 42 running ip.ad.dr.es domain.ru
rm -f /root/.ssh/authorized_keys
sed -i 's/178.63.175.246/' /etc/vz/conf/1201.conf
vzctl stop 1201
vzctl start 1201
export OLD_IP=12.1.1.1
export NEW_IP=122.33.44.55
vzctl enter 1201
# Debian
sed -i "s/$OLD_IP/$NEW_IP/" /etc/nginx/nginx.conf
sed -i "s/$OLD_IP/$NEW_IP/" /etc/apache2/apache2.conf
sed -i "s/$OLD_IP/$NEW_IP/" /etc/apache2/conf.d/rpaf.conf
sed -i "s/$OLD_IP/$NEW_IP/" /etc/apache2/mods-enabled/rpaf.conf
sed -i "s/$OLD_IP/$NEW_IP/" /etc/hosts
/etc/init.d/nginx restart
/etc/init.d/apache2 restart
# CentOS
sed -i "s/$OLD_IP/$NEW_IP/" /etc/nginx/nginx.conf
sed -i "s/$OLD_IP/$NEW_IP/" /etc/httpd/conf/httpd.conf
sed -i "s/$OLD_IP/$NEW_IP/" /etc/hosts
/etc/init.d/httpd restart
/etc/init.d/nginx restart
cd /etc
grep -HiR "$OLD_IP" *
vi /usr/local/ispmgr/etc/vdsmgr.conf
vds "xx.xx.xx.xx" {
Name test.domain.ru
Owner admin
CPULimit 0
TrafLimit 99999999
TrafUsed 574
Backup none
}
killall -9 vdsmgr
/usr/local/ispmgr/sbin/dostat.pl