~openstack-charm-testers/+junk/keystone-ssl

« back to all changes in this revision

Viewing changes to tools/hardening/run-apache-tests

  • Committer: Liam Young
  • Date: 2016-04-01 09:40:45 UTC
  • mfrom: (181.2.21 hardening)
  • Revision ID: liam.young@canonical.com-20160401094045-crwrk4vhaikm02t9
[hopem, r=gnuoy] Add hardening bundle and tools

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash -eu
 
2
UNIT_TO_TEST=$1
 
3
TESTER_UNIT=${2:-hardening-apache-tests/0}
 
4
TARGET_IP=`juju-deployer -f ${UNIT_TO_TEST%/*}`
 
5
juju scp $TESTER_UNIT:/home/ubuntu/.ssh/id_rsa.pub /tmp/id_rsa.pub
 
6
juju scp /tmp/id_rsa.pub $UNIT_TO_TEST:/tmp/
 
7
juju run --unit $UNIT_TO_TEST "\
 
8
    useradd -m -s /bin/bash -d /home/hiotest hiotest; \
 
9
    install -m 700 -o hiotest -d /home/hiotest/.ssh; \
 
10
    install -m 640 -o hiotest /tmp/id_rsa.pub /home/hiotest/.ssh/authorized_keys; \
 
11
    echo 'hiotest ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/90-hiotest-user; \
 
12
    sudo chmod 440 /etc/sudoers.d/90-hiotest-user;"
 
13
 
 
14
# Running apache test
 
15
juju action do hardening-apache-tests/0 run-test test-name=serverspec:default target-ip=$TARGET_IP