$ cat /etc/apt/apt.conf.d/99proxy
Acquire::http
{
Proxy "http://10.10.10.1:3128/";
Proxy::ppa.launchpad.net "DIRECT";
}
Все репозитории, кроме тех, для которых прописано "DIRECT" - будут идти через прокси.
$ cat /etc/apt/apt.conf.d/99proxy
Acquire::http
{
Proxy "http://10.10.10.1:3128/";
Proxy::ppa.launchpad.net "DIRECT";
}
# /usr/lib64/nagios/plugins/check_mount.pl -m /someshare
/someshare is mounted!
# /usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_mount
/someshare is not mounted!
[root@new ~]# ps auxZ | grep nrpe|grep -v grep
unconfined_u:system_r:nrpe_t:s0 nrpe 23079 0.0 0.0 40944 1312 ? Ss Jan11 0:05 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
[root@old ~]# ps auxZ | grep nrpe|grep -v grep
system_u:system_r:nrpe_t:s0 nrpe 1618 0.0 0.0 40888 1116 ? Ss 2012 0:23 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
type=AVC msg=audit(1357998818.538:612779): avc: denied { read open } for pid=1779 comm="check_mount.pl" name="bash" dev=dm-0 ino=913934 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:shell_exec_t:s0 tclass=file
type=AVC msg=audit(1357999043.623:612812): avc: denied { execute } for pid=2450 comm="check_mount.pl" name="bash" dev=dm-0 ino=913934 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:shell_exec_t:s0 tclass=file
type=AVC msg=audit(1357999147.645:612833): avc: denied { execute_no_trans } for pid=2571 comm="check_mount.pl" path="/bin/bash" dev=dm-0 ino=913934 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:shell_exec_t:s0 tclass=file
type=AVC msg=audit(1357999256.580:612863): avc: denied { getattr } for pid=3124 comm="sh" path="/bin/bash" dev=dm-0 ino=913934 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:shell_exec_t:s0 tclass=file
type=AVC msg=audit(1357999256.581:612864): avc: denied { execute } for pid=3125 comm="sh" name="mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999256.581:612865): avc: denied { getattr } for pid=3125 comm="sh" path="/bin/mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999256.581:612866): avc: denied { getattr } for pid=3125 comm="sh" path="/bin/mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999376.586:612887): avc: denied { read open } for pid=3252 comm="sh" name="mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999376.586:612888): avc: denied { read } for pid=3252 comm="sh" name="mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999376.586:612889): avc: denied { read } for pid=3252 comm="sh" name="mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999481.484:612914): avc: denied { execute_no_trans } for pid=3626 comm="sh" path="/bin/mount" dev=dm-0 ino=913990 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file
type=AVC msg=audit(1357999594.918:612928): avc: denied { setattr } for pid=4172 comm="mount" name="mtab" dev=dm-0 ino=655655 scontext=unconfined_u:system_r:nagios_services_plugin_t:s0 tcontext=unconfined_u:object_r:etc_runtime_t:s0 tclass=file
cat nrpe|audit2allow -M nrpe(Кстати теперь audit2allow в пакете policycoreutils-python.)
semodule -i nrpe.pp
# cat ~/nrpe.teОшибки пропали и nrpe заработал.
module nrpe 1.0;
require {
type shell_exec_t;
type etc_runtime_t;
type mount_exec_t;
type nagios_services_plugin_t;
class file { execute setattr read execute_no_trans getattr open };
}
#============= nagios_services_plugin_t ==============
allow nagios_services_plugin_t etc_runtime_t:file setattr;
#!!!! This avc is allowed in the current policy
allow nagios_services_plugin_t mount_exec_t:file { read execute open getattr execute_no_trans };
#!!!! This avc is allowed in the current policy
allow nagios_services_plugin_t shell_exec_t:file { read execute open getattr execute_no_trans };
wget http://ftp.scientificlinux.org/linux/scientific/6x/SRPMS/vendor/selinux-policy-3.7.19-155.el6_3.14.src.rpm
wget http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/selinux-policy-3.7.19-93.el6_1.2.src.rpm
rpm2cpio selinux-policy-3.7.19-93.el6_1.2.src.rpm | cpio -idmv
tar xvf serefpolicy-3.7.19.tgz
mv serefpolicy-3.7.19 serefpolicy-3.7.19_old
rm serefpolicy-3.7.19.tgz
rpm2cpio selinux-policy-3.7.19-155.el6_3.14.src.rpm | cpio -idmv
tar xvf serefpolicy-3.7.19.tgz
vimdiff serefpolicy-3.7.19/policy/modules/services/nagios.te serefpolicy-3.7.19_old/policy/modules/services/nagios.te
# semanage fcontext -l|grep nagios
# rpm -q --whatprovides /usr/lib64/nagios/plugins/check_mount.pl
file /usr/lib64/nagios/plugins/check_mount.pl is not owned by any package
semanage fcontext -a -s system_u -t nagios_unconfined_plugin_exec_t -f -- '/etc/nagios/plugins/check_mount.pl'
restorecon -v check_mount.pl
/usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_mount
semodule -r nrpe
# /usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_mount
/someshare is mounted!
# qemu-img info vm-100-disk-1.qcow2
# qemu-img resize vm-100-disk-1.qcow2 +50G
# qm start 100
# fdisk -l /dev/vdaРазница между началом extended и первым logical - всего 2 сектора, при стандартных для fdisk - 2048. Ну и конец 1й партиции 499711, а начало второй - сразу 501758.
Disk /dev/vda: 182.5 GB, 182536110080 bytes
16 heads, 63 sectors/track, 353686 cylinders, total 356515840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000df459
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 499711 248832 83 Linux
/dev/vda2 501758 251656191 125577217 5 Extended
/dev/vda5 501760 251656191 125577216 8e Linux LVM
Device Boot Start End Blocks Id SystemНу а дальше как обычно:
/dev/vda1 * 2048 499711 248832 83 Linux
/dev/vda2 499712 356515839 178008064 5 Extended
/dev/vda5 501760 356515839 178007040 8e Linux LVM
Совсем недавно, почему-то вспомнил про серию "Петька и Василий Иванович". К своему удивлению, обнаружил, что первую и вторую част...