-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from strongdm/turner-updates
Updating with templates and updating AMI's
- Loading branch information
Showing
7 changed files
with
63 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash -xe | ||
|
||
# add sdm public key | ||
echo "${SSH_PUB_KEY}" | tee -a /etc/ssh/sdm_ca.pub | ||
echo "TrustedUserCAKeys /etc/ssh/sdm_ca.pub" | tee -a /etc/ssh/sshd_config | ||
systemctl restart sshd | ||
|
||
# setup apache | ||
yum update -y | ||
amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2 | ||
yum install -y httpd mariadb-server | ||
systemctl start httpd | ||
systemctl enable httpd | ||
usermod -a -G apache ec2-user | ||
chown -R ec2-user:apache /var/www | ||
chmod 2775 /var/www | ||
find /var/www -type d -exec chmod 2775 {} \; | ||
find /var/www -type f -exec chmod 0664 {} \; | ||
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
onboarding/mysql/templates/mysql_install/mysql_install.tftpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
echo "${SSH_PUB_KEY}" | tee -a /etc/ssh/sdm_ca.pub | ||
echo "TrustedUserCAKeys /etc/ssh/sdm_ca.pub" | tee -a /etc/ssh/sshd_config | ||
systemctl restart ssh | ||
|
||
# setup mysql | ||
apt update && apt install -y mysql-server | ||
mysql_secure_installation <<EOF | ||
n | ||
${MYSQL_PW} | ||
${MYSQL_PW} | ||
y | ||
n | ||
y | ||
y | ||
EOF | ||
mysql --user=root \ | ||
--password=${MYSQL_PW} \ | ||
--execute="CREATE DATABASE ${MYSQL_DB};\ | ||
CREATE TABLE ${MYSQL_DB}.${MYSQL_TABLE} (message VARCHAR(20));\ | ||
INSERT INTO ${MYSQL_DB}.${MYSQL_TABLE} VALUES ('Hello');\ | ||
CREATE USER '${MYSQL_ADMIN}'@'%' IDENTIFIED WITH mysql_native_password BY '${MYSQL_PW}';\ | ||
GRANT ALL PRIVILEGES ON *.* TO '${MYSQL_ADMIN}'@'%';\ | ||
CREATE USER '${MYSQL_RO}'@'%' IDENTIFIED WITH mysql_native_password BY '${MYSQL_PW}';\ | ||
GRANT SELECT ON ${MYSQL_DB}.* TO '${MYSQL_RO}'@'%';\ | ||
FLUSH PRIVILEGES;" | ||
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf | ||
systemctl restart mysql && sysemctl enable mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
onboarding/sdm_gateway/templates/relay_install/relay_install.tftpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash -xe | ||
curl -J -O -L https://app.strongdm.com/releases/cli/linux && unzip sdmcli* && rm -f sdmcli* | ||
sudo ./sdm install --relay --token="${SDM_TOKEN}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters