-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-install.yaml
70 lines (53 loc) · 1.86 KB
/
post-install.yaml
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
heat_template_version: 2014-10-16
description: >
Example extra config for post-deployment
parameters:
servers:
type: json
resources:
ExtraDeployments:
type: OS::Heat::StructuredDeployments
properties:
servers: {get_param: servers}
config: {get_resource: ExtraConfig}
# Do this on CREATE/UPDATE (which is actually the default)
actions: ['CREATE', 'UPDATE']
ExtraConfig:
type: OS::Heat::SoftwareConfig
properties:
group: script
config: |
#!/bin/bash
set -x
# Install some packages
yum install tcpdump wget strace screen ftp mlocate -y
# Update the locate database
updatedb
# Permit root login over SSH
sed -i 's/.*ssh-rsa/ssh-rsa/' /root/.ssh/authorized_keys
sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
sed -i 's/ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config
systemctl restart sshd
# Update the root password to something we know
echo redhat | sudo passwd root --stdin
# Configure a system identifier httpd virtual host
yum install httpd -y
mkdir -p /var/www/ident/
cat << FOE > /etc/httpd/conf.d/ident.conf
Listen 8088
NameVirtualHost *:8088
<VirtualHost *:8088>
DocumentRoot /var/www/ident/
</VirtualHost>
FOE
restorecon /etc/httpd/conf.d/ident.conf
cat << FOE > /var/www/ident/index.html
Hello from $(hostname) :-)
FOE
restorecon -R /var/www/ident/
chown -R apache:apache /var/www/ident/
iptables -A INPUT -p tcp -m tcp --dport 8088 -j ACCEPT
semanage port -a -t http_port_t -p tcp 8088
systemctl start httpd
systemctl reload httpd
systemctl enable httpd