-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-base
executable file
·76 lines (61 loc) · 1.25 KB
/
setup-base
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
#!/bin/sh
if [ ! -e /home/ami-setup/.git ]; then
echo "Must clone ami-setup to /home/ami-setup"
exit 1
fi
setenforce 0
chown -R root:root /home/ami-setup/overlay
cd /home/ami-setup/overlay || exit 1
find . -print | cpio -pdmuv /
ed /root/.bashrc <<EOF
g/alias/d
.
w
q
EOF
# Set up ssh access
ed /etc/ssh/sshd_config <<EOF
g/PasswordAuthentication/d
g/PermitRootLogin/d
a
PermitRootLogin yes
PasswordAuthentication yes
.
w
q
EOF
ed /etc/sysconfig/selinux <<EOF
g/SELINUX=/d
$
a
SELINUX=disabled
.
w
q
EOF
# Create dir for rsyslog
mkdir -p /home/local
# Install Nathan's rclocal scripts
yum -y localinstall /home/ami-setup/rpms/*.rpm
# Clean up any cloud-init stuff
rm -rf /var/lib/cloud/data
rm -rf /var/lib/cloud/instance
rm -rf /var/lib/cloud/instances/*
# Remove 'fedora' userid if it was set up
userdel -f fedora
rm -rf /home/fedora
# enable ntp
systemctl enable ntpdate.service
systemctl enable ntpd.service
cat >/etc/ntp/step-tickers <<EOF
0.fedora.pool.ntp.org
1.fedora.pool.ntp.org
2.fedora.pool.ntp.org
3.fedora.pool.ntp.org
EOF
rm -f /etc/sudoers.d/90-cloud-init-users
echo "######################"
echo "Manual Action Required"
echo "######################"
echo "Populate ~root/.awssecret and ~root/.s3cfg with AWS deployment keys mode 0600."
echo ""