# ntpdate 0.ru.pool.ntp.org
пятница, 25 ноября 2011
# ln -sf /usr/share/zoneinfo/Etc/GMT-4 /etc/localtime
# ntpdate 0.ru.pool.ntp.org
# ntpdate 0.ru.pool.ntp.org
вторник, 22 ноября 2011
1 Запуск
Для запуска добавить в /etc/rc.conf
firewall_enable="YES"
firewall_type="open" # разрешаем весь трафик
firewall_logging="YES" # включаем логирование
Для логирования добавить в /etc/sysctl.conf
net.inet.ip.fw.verbose=1
net.inet.ip.fw.verbose_limit=5
RE: для запуска ipfw не обязательно перекомпиллировать ядро до тех пор пока не потребуется поддержка NAT
2 Ядро
options IPFIREWALL # включает фаерволл как часть ядра
options IPFIRWALL_VERBOSE # включает логирование
options IPFIREWALL_VERBOSE_LIMIT=5 # предельное число логируемых пакетов в единицу времени. Спасает от некоторых типов атак.
options IPFIREWALL_DEFAULT_TO_ACCEPT #разрешает прохождение всего трафика через фаерволл
options IPDIVERT #необходимо для поддержки NAT
3 Команды управления
ipfw list # список всех правил
ipfw -t list # вывод списка правил с временной меткой показывающей последнее срабатывание правила
ipfw -a list # показывает подробную информацию по списку правил
ipfw -d list # показывай динамические правила в дополнение к статическим
ipfw -d -e list # также показывай "просроченные"??? динамические правила
ipfw zero # сброс счётчиков
ipfw zero NUM # сброс счётчика за номером NUM
4 Синтаксис
CMD RULE_NUMBER ACTION LOGGING SELECTION STATEFUL
CMD - add
RULE_NUMBER - 1..65535
ACTION - allow | accept | pass | permit # любое из этих слов разрешает прохождение пакетов
check-state # проверять пакет сначала динамическими правилами.
deny | drop # отбрасывать пакеты совпадающие с этим правилом
LOGGING - log or logamount # когда log сообщение будет записано через syslog с меткой SECURITY. logamount указывает предельное количество записей которое не должно превышаться. Если logamount не указан предел будет взять из параметра net.inet.ip.fw.verbose_limit указываемый через переменную sysctl.
Если лимит превышен, то журнал может быть перезапущен командой ipfw reset log
SELECTION - udp | tcp | icmp или любой другой протокол из файла /etc/protocols
from src to dst # диапазон ip адресов источника пакетов и приёмника
port number # номер порта на который принимать пакет
in | out # обозначает пакеты на вход или пакеты на выход
via IF # пакеты проходят через указанный интерфейс
keep-state # открывает постоянный канал между источником и получателем
limit {src-addr | src-port | dst-addr | dst-port} # фаервол разрешит прохождение только N числу пакетов. Эта опция несовместима с keep-state
Для запуска добавить в /etc/rc.conf
firewall_enable="YES"
firewall_type="open" # разрешаем весь трафик
firewall_logging="YES" # включаем логирование
Для логирования добавить в /etc/sysctl.conf
net.inet.ip.fw.verbose=1
net.inet.ip.fw.verbose_limit=5
RE: для запуска ipfw не обязательно перекомпиллировать ядро до тех пор пока не потребуется поддержка NAT
2 Ядро
options IPFIREWALL # включает фаерволл как часть ядра
options IPFIRWALL_VERBOSE # включает логирование
options IPFIREWALL_VERBOSE_LIMIT=5 # предельное число логируемых пакетов в единицу времени. Спасает от некоторых типов атак.
options IPFIREWALL_DEFAULT_TO_ACCEPT #разрешает прохождение всего трафика через фаерволл
options IPDIVERT #необходимо для поддержки NAT
3 Команды управления
ipfw list # список всех правил
ipfw -t list # вывод списка правил с временной меткой показывающей последнее срабатывание правила
ipfw -a list # показывает подробную информацию по списку правил
ipfw -d list # показывай динамические правила в дополнение к статическим
ipfw -d -e list # также показывай "просроченные"??? динамические правила
ipfw zero # сброс счётчиков
ipfw zero NUM # сброс счётчика за номером NUM
4 Синтаксис
CMD RULE_NUMBER ACTION LOGGING SELECTION STATEFUL
CMD - add
RULE_NUMBER - 1..65535
ACTION - allow | accept | pass | permit # любое из этих слов разрешает прохождение пакетов
check-state # проверять пакет сначала динамическими правилами.
deny | drop # отбрасывать пакеты совпадающие с этим правилом
LOGGING - log or logamount # когда log сообщение будет записано через syslog с меткой SECURITY. logamount указывает предельное количество записей которое не должно превышаться. Если logamount не указан предел будет взять из параметра net.inet.ip.fw.verbose_limit указываемый через переменную sysctl.
Если лимит превышен, то журнал может быть перезапущен командой ipfw reset log
SELECTION - udp | tcp | icmp или любой другой протокол из файла /etc/protocols
from src to dst # диапазон ip адресов источника пакетов и приёмника
port number # номер порта на который принимать пакет
in | out # обозначает пакеты на вход или пакеты на выход
via IF # пакеты проходят через указанный интерфейс
keep-state # открывает постоянный канал между источником и получателем
limit {src-addr | src-port | dst-addr | dst-port} # фаервол разрешит прохождение только N числу пакетов. Эта опция несовместима с keep-state
четверг, 17 ноября 2011
в файле /usr/local/etc/amavisd.conf привести к следующему виду приведённые ниже строки.
понедельник, 07 ноября 2011
# groupmems -a username -g groupname
# groupmems -d username -g groupname (удаление)
# groupmems -d username -g groupname (удаление)
в main.cf
# sender_bcc_maps = hash:/usr/local/etc/postfix/sender_bcc
сюда адрес отправителя, адрес приёма копии
# joe /usr/local/etc/postfix/sender_bcc
# postmap /usr/local/etc/postfix/sender_bcc
# postfix reload
# sender_bcc_maps = hash:/usr/local/etc/postfix/sender_bcc
сюда адрес отправителя, адрес приёма копии
# joe /usr/local/etc/postfix/sender_bcc
# postmap /usr/local/etc/postfix/sender_bcc
# postfix reload
четверг, 27 октября 2011
# su postgres
$ createuser -P username
$ createuser -P username
вторник, 20 сентября 2011
Для успешного автозапуска PostgreSQL в ОС Gentoo нужно:
# su postgres
$ initdb -D /var/lib/postgresql/9.0/data
$ exit
# mv /var/lib/postgresql/9.0/data/*.conf /etc/postgresql-9.0/
# rc-update add postgredql-9.0
# reboot
RE: путь к базе должен быть именно таким, как в этом листинге.
# su postgres
$ initdb -D /var/lib/postgresql/9.0/data
$ exit
# mv /var/lib/postgresql/9.0/data/*.conf /etc/postgresql-9.0/
# rc-update add postgredql-9.0
# reboot
RE: путь к базе должен быть именно таким, как в этом листинге.
понедельник, 19 сентября 2011
Some "stage3" archives lack few items (like /dev/console and /dev/null) necessary for boot.
To fix your installation, you need to:
- mount your gentoo root device in read/write mode (for example to /mnt/gentoo)
- create missing pseudo-files (something like the following):
mknod /mnt/gentoo/dev/console c 5 1
mknod /mnt/gentoo/dev/null c 1 3
- unmount your gentoo root device or execute "sync" command
- reboot
To fix your installation, you need to:
- mount your gentoo root device in read/write mode (for example to /mnt/gentoo)
- create missing pseudo-files (something like the following):
mknod /mnt/gentoo/dev/console c 5 1
mknod /mnt/gentoo/dev/null c 1 3
- unmount your gentoo root device or execute "sync" command
- reboot
пятница, 16 сентября 2011
Основная инструкция по установке находится по адресу: en.gentoo-wiki.com/wiki/NVRAID_using_dmraid
Установка Gentoo осуществляется при помощи dmraid. Для включения dmraid в загрузку livecd gentoo:
boot: gentoo dodmraid
После загрузки проверяем:
# ls /dev/mapper
Если только файл config, значит dodmraid не был загружен.
Переходим к стандартным процедурам установки Gentoo: www.gentoo.org/doc/en/handbook/handbook-x86.xml...
При этом, конфигурирование grub, настройку и сборку ядра, а также создание файла /etc/fstab проводим с учётом параметров собственного raid контроллера и приведённой инструкции: en.gentoo-wiki.com/wiki/NVRAID_using_dmraid
Установка Gentoo осуществляется при помощи dmraid. Для включения dmraid в загрузку livecd gentoo:
boot: gentoo dodmraid
После загрузки проверяем:
# ls /dev/mapper
Если только файл config, значит dodmraid не был загружен.
Переходим к стандартным процедурам установки Gentoo: www.gentoo.org/doc/en/handbook/handbook-x86.xml...
При этом, конфигурирование grub, настройку и сборку ядра, а также создание файла /etc/fstab проводим с учётом параметров собственного raid контроллера и приведённой инструкции: en.gentoo-wiki.com/wiki/NVRAID_using_dmraid
четверг, 25 августа 2011
на FreeBSD
# После каждого нового клиента заново генерируем dh
Необходимые файлы для клиента:
ca.crt
dh1024.pem
clientname.crt
ta.key
clientname.key
Отзыв сертификатов:
Создастся файл crl.pem и возникнет ошибка:
error 23 at 0 depth lookup:certificate revoked
Добавляем директиву crl-verify /usr/local/share/doc/openvpn/easy-rsa/2.0/keys/server/crl.pem в файл server.conf и перезапускаем OpenVPN
# После каждого нового клиента заново генерируем dh
Необходимые файлы для клиента:
ca.crt
dh1024.pem
clientname.crt
ta.key
clientname.key
Отзыв сертификатов:
Создастся файл crl.pem и возникнет ошибка:
error 23 at 0 depth lookup:certificate revoked
Добавляем директиву crl-verify /usr/local/share/doc/openvpn/easy-rsa/2.0/keys/server/crl.pem в файл server.conf и перезапускаем OpenVPN
вторник, 16 августа 2011
Собрать ProFTPd с поддержкой ClamAV
# joe /etc/proftpd/proftpd.conf <<
# joe /etc/clamd.conf <<
Заменить localhost в /etc/hosts на наше имя узла.
# joe /etc/proftpd/proftpd.conf <<
# joe /etc/clamd.conf <<
Заменить localhost в /etc/hosts на наше имя узла.
пятница, 12 августа 2011
После загрузки bootcd:
# mount /dev/sda3 /mnt/gentoo
# mount /dev/sda1 /mnt/gentoo/boot
# mount -t proc none /mnt/gentoo/proc
# mount --rbind /dev/ /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"
# mount /dev/sda3 /mnt/gentoo
# mount /dev/sda1 /mnt/gentoo/boot
# mount -t proc none /mnt/gentoo/proc
# mount --rbind /dev/ /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"
VFS: Unable to mount root fs on unknown-block (0,0)
Вкл. поддежку block devices в ядре.
UFS: Cannot open root device /dev/sdaX
Вкл. поддержку scsi disk в ядре
No init found. Try passing init=option to kernel
В grub.conf задать правильно параметр root=/dev/sda3
grub: error
no such file
Загрузившить с livecd и войдя в chroot: выполнить команду: grep -v rootfs /proc/mounts > /etc/mtab
Вкл. поддежку block devices в ядре.
UFS: Cannot open root device /dev/sdaX
Вкл. поддержку scsi disk в ядре
No init found. Try passing init=option to kernel
В grub.conf задать правильно параметр root=/dev/sda3
grub: error
no such file
Загрузившить с livecd и войдя в chroot: выполнить команду: grep -v rootfs /proc/mounts > /etc/mtab
# joe /etc/env.d/02locale
# env-update
# source /etc/profile
# locale
# joe /etc/conf.d/keymaps
# joe /etc/conf.d/consolefont
# joe /etc/rc.conf
# joe /etc/make.conf
# emerge --sync
# emerge --update --deep --newuse world
# emerge gentoolkit
# revdep-rebuild --soname libncurses.so.5
# revdep-rebuild --soname libslang.so.1
# rc-update add consolefont boot
# rc-update add keymaps boot
# reboot
# env-update
# source /etc/profile
# locale
# joe /etc/conf.d/keymaps
# joe /etc/conf.d/consolefont
# joe /etc/rc.conf
# joe /etc/make.conf
# emerge --sync
# emerge --update --deep --newuse world
# emerge gentoolkit
# revdep-rebuild --soname libncurses.so.5
# revdep-rebuild --soname libslang.so.1
# rc-update add consolefont boot
# rc-update add keymaps boot
# reboot
понедельник, 04 июля 2011
This section describes the simplest possible procedure to build a custom kernel the "Debian way". It is assumed that user is somewhat familiar with kernel configuration and build process. If that's not the case, it is recommended to consult the kernel documentation and many excellent online resources dedicated to it.
The easiest way to build a custom kernel (the kernel with the configuration different from the one used in the official packages) from the Debian kernel source is to use the linux-source package and the make deb-pkg target. First, prepare the kernel tree:
# apt-get install linux-source-2.6.18
$ tar xjf /usr/src/linux-source-2.6.18.tar.bz2
$ cd linux-source-2.6.18
The kernel now needs to be configured, that is you have to set the kernel options and select the drivers which are going to be included, either as built-in, or as external modules. The kernel build infrastructure offers a number of targets, which invoke different configuration frontends. For example, one can use console-based menu configuration by invoking the command
$ make menuconfig
Instead of menuconfig one can use config (text-based line-by-line configuration frontend) or xconfig (graphical configuration frontend). It is also possible to reuse your old configuration file by placing it as a .config file in the top-level directory and running one of the configuration targets (if you want to adjust something) or make oldconfig (to keep the same configuration). Note that different frontends may require different additional libraries and utilities to be installed to function properly. For example, the menuconfig frontend requires the ncurses library, which at time of writing is provided by the libncurses5-dev package.
After the configuration process is finished, the new or updated kernel configuration will be stored in .config file in the top-level directory. The build is started using the commands
$ make clean
$ make KDEB_PKGVERSION=custom.1.0 deb-pkg
The custom.1.0 part in this command is the version identifier, which will get appended to the kernel package name. Feel free to adjust it to your liking. As a result of the build, a custom kernel package linux-image-2.6.18_custom.1.0_i386.deb (name will reflect the version of the kernel and the revision chosen in the command line above) will be created in the directory one level above the top of the tree. It may be installed using dpkg just as any other package:
# dpkg -i ../linux-image-2.6.18_custom.1.0_i386.deb
This command will unpack the kernel, generate the initrd if necessary (see Managing the initial ramfs (initramfs) archive, Chapter 7 for details), and configure the bootloader to make the newly installed kernel the default one. If this command completed without any problems, you can reboot using the
# shutdown -r now
command to boot the new kernel.
For much more information about bootloaders and their configuration please check their documentation, which can be accessed using the commands man lilo, man lilo.conf, man grub, and so on. You can also look for documentation in the /usr/share/doc/package directories, with package being the name of the package involved.
kernel-handbook.alioth.debian.org/index.html#co...
The easiest way to build a custom kernel (the kernel with the configuration different from the one used in the official packages) from the Debian kernel source is to use the linux-source package and the make deb-pkg target. First, prepare the kernel tree:
# apt-get install linux-source-2.6.18
$ tar xjf /usr/src/linux-source-2.6.18.tar.bz2
$ cd linux-source-2.6.18
The kernel now needs to be configured, that is you have to set the kernel options and select the drivers which are going to be included, either as built-in, or as external modules. The kernel build infrastructure offers a number of targets, which invoke different configuration frontends. For example, one can use console-based menu configuration by invoking the command
$ make menuconfig
Instead of menuconfig one can use config (text-based line-by-line configuration frontend) or xconfig (graphical configuration frontend). It is also possible to reuse your old configuration file by placing it as a .config file in the top-level directory and running one of the configuration targets (if you want to adjust something) or make oldconfig (to keep the same configuration). Note that different frontends may require different additional libraries and utilities to be installed to function properly. For example, the menuconfig frontend requires the ncurses library, which at time of writing is provided by the libncurses5-dev package.
After the configuration process is finished, the new or updated kernel configuration will be stored in .config file in the top-level directory. The build is started using the commands
$ make clean
$ make KDEB_PKGVERSION=custom.1.0 deb-pkg
The custom.1.0 part in this command is the version identifier, which will get appended to the kernel package name. Feel free to adjust it to your liking. As a result of the build, a custom kernel package linux-image-2.6.18_custom.1.0_i386.deb (name will reflect the version of the kernel and the revision chosen in the command line above) will be created in the directory one level above the top of the tree. It may be installed using dpkg just as any other package:
# dpkg -i ../linux-image-2.6.18_custom.1.0_i386.deb
This command will unpack the kernel, generate the initrd if necessary (see Managing the initial ramfs (initramfs) archive, Chapter 7 for details), and configure the bootloader to make the newly installed kernel the default one. If this command completed without any problems, you can reboot using the
# shutdown -r now
command to boot the new kernel.
For much more information about bootloaders and their configuration please check their documentation, which can be accessed using the commands man lilo, man lilo.conf, man grub, and so on. You can also look for documentation in the /usr/share/doc/package directories, with package being the name of the package involved.
kernel-handbook.alioth.debian.org/index.html#co...
Файл настройки в Debian'e находится в /etc/defaults/grub
Порядок загрузки меняет параметр (нумерация начинается с нуля):
GRUB_DEFAULT=№
Для учёта изменений ввести: update-grub
Порядок загрузки меняет параметр (нумерация начинается с нуля):
GRUB_DEFAULT=№
Для учёта изменений ввести: update-grub
пятница, 06 мая 2011
В файле master.cf
Интересно, что без использования клетки свою сеть прописывать не нужно. Кстати, не должно быть пробелов между этими записями 127.0.0.0/8,моя_подсеть/маска
Интересно, что без использования клетки свою сеть прописывать не нужно. Кстати, не должно быть пробелов между этими записями 127.0.0.0/8,моя_подсеть/маска
четверг, 05 мая 2011
среда, 04 мая 2011
В файл main.cf
Примерный состав файла virtual_alias_domains:
Правая строчка должна быть, в данном случае поставлена дата создания. После завершения редактирования, выполнить команду:
postmap hash:./virtual_alias_maps
Примерный состав файла virtual_alias_maps
Каждую новую учётную запись для виртуального домена нужно дублировать в файле virtual_alies_maps. После занесения информации необходимо выполнить команду:
postmap hash:./virtual_alias_maps
Примерный состав файла virtual_alias_domains:
Правая строчка должна быть, в данном случае поставлена дата создания. После завершения редактирования, выполнить команду:
postmap hash:./virtual_alias_maps
Примерный состав файла virtual_alias_maps
Каждую новую учётную запись для виртуального домена нужно дублировать в файле virtual_alies_maps. После занесения информации необходимо выполнить команду:
postmap hash:./virtual_alias_maps
По умолчанию размер составляет 50 Мб.
Для изменения этого параметра должна быть добавлена в конфигурационный файл main.cf директива:
mailbox_size_limit=размер в байтах
Для изменения этого параметра должна быть добавлена в конфигурационный файл main.cf директива:
mailbox_size_limit=размер в байтах