remove syslinux from Node image
[ovirt-node-image.git] / common-post.ks
blobdd46f75ddc3ba3669e3cef8b91299050fa7e1b7d
1 # -*-Shell-script-*-
2 echo "Starting Kickstart Post"
3 PATH=/sbin:/usr/sbin:/bin:/usr/bin
4 export PATH
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
14 tmpdir=$(mktemp -d)
16 for semodule in $SEMODULES; do
17     found=0
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"
21         rm $pp_file.bz2
22         found=1
23     elif [ -f $pp_file ]; then
24         mv $pp_file "$tmpdir"
25         found=1
26     fi
27     # Don't put "base.pp" on the list.
28     test $semodule = base \
29         && continue
30     test $found=1 \
31         && modules="$modules $semodule.pp"
32 done
34 if test -n "$modules"; then
35     (cd "$tmpdir" \
36         && test -f base.pp \
37         && semodule -v -b base.pp -i $modules \
38         && semodule -v -B )
40 rm -rf "$tmpdir"
42 echo "Running ovirt-install-host 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
48 pwconv
49 grpconv
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
56 EOF
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
62 *filter
63 :INPUT ACCEPT [0:0]
64 :FORWARD ACCEPT [0:0]
65 :OUTPUT ACCEPT [0:0]
66 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
67 -A INPUT -p icmp -j ACCEPT
68 -A INPUT -i lo -j ACCEPT
69 # libvirt
70 -A INPUT -p tcp --dport 16509 -j ACCEPT
71 # SSH
72 -A INPUT -p tcp --dport 22 -j ACCEPT
73 # guest consoles
74 -A INPUT -p tcp -m multiport --dports 5800:6000 -j ACCEPT
75 # migration
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
79 COMMIT
80 EOF