-
Notifications
You must be signed in to change notification settings - Fork 69
/
batata.cfg
306 lines (274 loc) · 7.36 KB
/
batata.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#
# From: Miguel Filho <[email protected]>
#
# kickstart Xen dom0 32 bit
bootloader --location=mbr
zerombr
cmdline
firewall --disabled
firstboot --disable
keyboard br-abnt2
lang en_US
reboot
url --url=http://mirrors.ic.unicamp.br/centos/5/os/i386
network --bootproto=static --device=eth0 --gateway=xxx --ip=xxx --nameserver=xxx --netmask=255.255.255.192 --onboot=on --hostname="xxxx"
rootpw xuxuxu
selinux --disabled
skipx
timezone --isUtc America/Sao_Paulo
install
clearpart --all
part /boot --asprimary --fstype="ext3" --size=100
# change here!
part pv.01 --size=1 --grow --ondisk=hde
part pv.02 --size=1 --grow --ondisk=hdg
volgroup volumes pv.01 pv.02
logvol / --fstype="ext3" --vgname=volumes --size=10240 --name=root --fsoptions="noatime,nodiratime"
logvol /var --fstype="ext3" --vgname=volumes --size=6114 --name=var --fsoptions="noatime,nodiratime"
logvol /tmp --fstype="ext3" --vgname=volumes --size=2048 --name=tmp --fsoptions="noatime,nodiratime"
logvol swap --fstype swap --vgname=volumes --size=1024 --name=swap
%packages --nobase
-sysklogd
-selinux-policy-targeted
-selinux-policy
-gtk2
-ecryptfs-utils
-trousers
-avahi
xorg-x11-xauth
iptables
audit
autofs
nfs-utils
ntsysv
rsyslog
vixie-cron
crontabs
vim-enhanced
psacct
postfix
screen
man
nc
ntp
amanda-client
sudo
rsync
tcpdump
nmap
iptraf
lynx
wget
curl
strace
dstat
tcsh
quota
bind-utils
tmpwatch
krb5-workstation
pam_krb5
openldap-clients
nss_ldap
cyrus-sasl-gssapi
xen
kernel-xen
%post
chvt 3
(
echo "[+] Ajustando repositorios"
sed -i "/^#*mirrorlist=/d" /etc/yum.repos.d/CentOS-Base.repo
sed -i "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/mirrors.ic.unicamp.br/" /etc/yum.repos.d/CentOS-Base.repo
sed -i "s/enabled=1/enabled=0/" /etc/yum/pluginconf.d/fastestmirror.conf
echo "[+] Atualizando pacotes"
yum clean all
yum -y update
yum clean packages
echo "[+] Configurando autenticacao"
authconfig --enableldap --enableldapauth
--ldapserver="ldap://ldap1.xxx ldap://ldap2.xxx" \
--ldapbasedn="dc=xx,dc=xx,dc=br" --enablekrb5 --krb5realm=XX.XXXX.XX \
--krb5kdc="kerberos1.xxx kerberos2.xxx" \
--krb5adminserver=kerberos1.xxx --enableldaptls --update
echo "TLS_REQCERT never" >> /etc/openldap/ldap.conf
/usr/sbin/ntpdate -u xxx.xxx
echo "[+] Inserindo chaves do Kerberos"
echo -n "[-] Username: "
read username
echo -n "[-] Senha: "
modes=$(stty -g)
stty -echo
read password
stty $oldmodes
/usr/kerberos/sbin/kadmin -w $password -p $username -q 'addprinc -randkey
nfs/xxx'
/usr/kerberos/sbin/kadmin -w $password -p $username -q 'addprinc -randkey
ssh/xxx'
/usr/kerberos/sbin/kadmin -w $password -p $username -q 'addprinc -randkey
host/xxx'
/usr/kerberos/sbin/kadmin -w $password -p $username -q 'ktadd -e
des-cbc-crc:normal nfs/xxx'
/usr/kerberos/sbin/kadmin -w $password -p $username -q 'ktadd ssh/xxx'
/usr/kerberos/sbin/kadmin -w $password -p $username -q 'ktadd host/xxx'
echo "[+] Configurando autofs no LDAP"
cat > /etc/sysconfig/autofs <<EOF
SEARCH_BASE="ou=AutoMount,dc=ic,dc=unicamp,dc=br"
MAP_OBJECT_CLASS="automountMap"
ENTRY_OBJECT_CLASS="automount"
MAP_ATTRIBUTE="ou"
ENTRY_ATTRIBUTE="cn"
VALUE_ATTRIBUTE="automountInformation"
LOGGING="verbose"
EOF
cat > /etc/autofs_ldap_auth.conf <<EOF
<?xml version="1.0" ?>
<autofs_ldap_sasl_conf
usetls="yes"
tlsrequired="yes"
authrequired="yes"
authtype="ANONYMOUS"
/>
EOF
echo "[+] Configurando NFSv4"
sed -i "s/^#SECURE_NFS=\"yes\"/SECURE_NFS=\"yes\"/" /etc/sysconfig/nfs
sed -i "s/^#RPCGSSDARGS=\"-vvv\"/RPCGSSDARGS=\"-vvv\"/" /etc/sysconfig/nfs
echo "[+] Configurando amanda"
cat > /var/lib/amanda/.amandahosts <<EOF
amandahost amanda
amandahost.localdomain amanda
xxx amanda
EOF
cat > /etc/xinetd.d/amanda <<EOF
service amanda
{
socket_type = dgram
protocol = udp
wait = yes
user = amanda
group = disk
server = /usr/lib/amanda/amandad
disable = no
server_args = -auth=bsd amdump
}
EOF
echo "[+] Logrotate"
cat > /etc/logrotate.conf <<EOF
weekly
rotate 12
create
compress
include /etc/logrotate.d
/var/log/wtmp {
monthly
minsize 1M
create 0664 root utmp
rotate 12
}
EOF
cat > /etc/logrotate.d/psacct <<EOF
/var/account/pacct {
compress
delaycompress
notifempty
daily
rotate 366
create 0600 root root
postrotate
if [ -f /var/lock/subsys/psacct ]; then
/usr/sbin/accton /var/account/pacct
fi
endscript
}
EOF
echo "[+] Sudo"
cat > /etc/sudoers <<EOF
Defaults requiretty
Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
_XKB_CHARSET XAUTHORITY"
%admsis ALL=(ALL) ALL
EOF
echo "[+] Ajustando SSH"
cat > /etc/ssh/sshd_config <<EOF
Port 694
SyslogFacility AUTHPRIV
LogLevel VERBOSE
LoginGraceTime 15s
AllowGroups admins root
PermitRootLogin without-password
MaxStartups 2
ChallengeResponseAuthentication no
AllowTcpForwarding no
X11Forwarding no
Ciphers aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc
MACs hmac-sha1
GSSAPIAuthentication yes
UsePAM yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
Subsystem sftp /usr/libexec/openssh/sftp-server
EOF
mkdir /root/.ssh
cat > /root/.ssh/authorized_keys <<EOF
from="xxx" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzmhMmtYXOPaCGCvjau5nPnMbDANg0785lgT5bLhHQ7+jGIf9E3qfQYrHmtaEI3ghhEf1DTcGTTUmXV0xifo8pQRjs0f715IvZO2bYGTTsi6dkcVOxM1rujdejHzRj+d2tqZcfNGhl/asa1JeO1ulfhvNFWHETRaytiATlhslYsMuKDuIsR00exUdonIdSTYo9oeTCKhFaOHx2OV8Db+EMfnxhimbN4bJdGyD5LcNqeK4+1tpVa7/C/CsRvF+fFiVc+3cSOYVf0OHSnqZesFZ2GBRPA9pZ3HVh9rGfQpEwXAmx4VUDq+if+awYOE00GmD106asXGQmRIhVknJlamPHw== miguel@quake
EOF
echo "[+] Ajustando hosts.allow"
cat > /etc/hosts.allow <<EOF
sshd: @admsis
EOF
echo "[+] Ajustando hosts.deny"
cat > /etc/hosts.deny <<EOF
ALL: ALL
EOF
echo "[+] Ajustando GRUB"
sed -i "s/\(kernel.*\/xen.gz.*\)/\1 dom0_mem=256m/" /boot/grub/menu.lst
echo "[+] Criando bridge br0"
cat > /etc/sysconfig/network-scripts/ifcfg-br0 <<EOF
DEVICE=br0
BOOTPROTO=static
NO_ALIASROUTING=yes
IPADDR=143.xxx.xxx
NETMASK=255.255.255.192
ONBOOT=yes
TYPE=Bridge
EOF
echo "[+] Criando eth0"
MAC=$(egrep HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0)
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
DEVICE=eth0
BOOTPROTO=none
$MAC
ONBOOT=yes
BRIDGE=br0
TYPE=Ethernet
EOF
echo "[+] Configurando xend"
sed -i 's/^(network-script network-bridge)$/#(network-script network-bridge)/' /etc/xen/xend-config.sxp
echo "[+] Desligando servicos"
chkconfig gpm off
chkconfig iscsi off
chkconfig iscsid off
chkconfig haldaemon off
chkconfig libvirtd off
chkconfig kudzu off
chkconfig messagebus off
chkconfig gpm off
chkconfig avahi-daemon off
chkconfig rawdevices off
chkconfig iptables off
chkconfig ip6tables off
chkconfig saslauthd off
chkconfig mcstrans off
chkconfig restorecond off
chkconfig nfslock on
chkconfig psacct on
chkconfig rsyslog on
chkconfig rpcgssd on
echo "[+] Amen!"
) 2>&1 | tee /root/ks-post.log
chvt 1