2 echo "Starting Kickstart Post"
3 PATH=/sbin:/usr/sbin:/bin:/usr/bin
6 # Import SELinux Modules
7 echo "Enabling selinux modules"
8 SEMODULES="base automount avahi consolekit cyrus dhcp dnsmasq guest hal ipsec \
9 iscsi kerberos kerneloops ldap lockdev logadm mozilla ntp ovirt-node-selinux \
10 polkit portmap qemu rpcbind sasl snmp stunnel sysstat tcpd unprivuser \
11 unconfined usbmodules userhelper virt"
13 lokkit -v --selinuxtype=minimum
16 for semodule in $SEMODULES; do
18 pp_file=/usr/share/selinux/minimum/$semodule.pp
19 if [ -f $pp_file.bz2 ]; then
20 bzip2 -dc $pp_file.bz2 > "$tmpdir/$semodule.pp"
23 elif [ -f $pp_file ]; then
27 # Don't put "base.pp" on the list.
28 test $semodule = base \
31 && modules="$modules $semodule.pp"
34 if test -n "$modules"; then
37 && semodule -v -b base.pp -i $modules \
42 echo "Running ovirt-install-node-stateless"
43 ovirt-install-node-stateless
45 echo "Creating shadow files"
46 # because we aren't installing authconfig, we aren't setting up shadow
47 # and gshadow properly. Do it by hand here
51 echo "Forcing C locale"
52 # force logins (via ssh, etc) to use C locale, since we remove locales
53 cat >> /etc/profile << \EOF
54 # oVirt: force our locale to C since we don't have locale stuff'
55 export LC_ALL=C LANG=C
58 echo "Configuring IPTables"
59 # here, we need to punch the appropriate holes in the firewall
60 cat > /etc/sysconfig/iptables << \EOF
61 # oVirt automatically generated firewall configuration
66 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
67 -A INPUT -p icmp -j ACCEPT
68 -A INPUT -i lo -j ACCEPT
70 -A INPUT -p tcp --dport 16509 -j ACCEPT
72 -A INPUT -p tcp --dport 22 -j ACCEPT
74 -A INPUT -p tcp -m multiport --dports 5800:6000 -j ACCEPT
76 -A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT
77 -A INPUT -j REJECT --reject-with icmp-host-prohibited
78 -A FORWARD -m physdev ! --physdev-is-bridged -j REJECT --reject-with icmp-host-prohibited
82 # remove errors from /sbin/dhclient-script
83 DHSCRIPT=/sbin/dhclient-script
84 sed -i 's/mv /cp -p /g' $DHSCRIPT
85 sed -i '/rm -f.*${interface}/d' $DHSCRIPT
86 sed -i '/rm -f \/etc\/localtime/d' $DHSCRIPT
87 sed -i '/rm -f \/etc\/ntp.conf/d' $DHSCRIPT
88 sed -i '/rm -f \/etc\/yp.conf/d' $DHSCRIPT
90 if rpm -q --qf '%{release}' ovirt-node | grep -q "^0\." ; then
91 echo "Building in developer mode, leaving root account unlocked"
93 echo "Building in production mode, locking root account"
97 # directories required in the image with the correct perms
98 # config persistance currently handles only regular files
102 # fix iSCSI/LVM startup issue
103 sed -i 's/node\.session\.initial_login_retry_max.*/node.session.initial_login_retry_max = 60/' /etc/iscsi/iscsid.conf