mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-05-13 19:58:08 +00:00
Merge pull request #480 from shaderecker/ansible-updates
Ansible updates
This commit is contained in:
commit
3b43c55c04
11 changed files with 27 additions and 46 deletions
|
@ -78,9 +78,9 @@ myENABLE=$myENABLE
|
||||||
myHOST=$myHOST
|
myHOST=$myHOST
|
||||||
myPORT=$myPORT
|
myPORT=$myPORT
|
||||||
myCHANNEL=$myCHANNEL
|
myCHANNEL=$myCHANNEL
|
||||||
|
myCERT=$myCERT
|
||||||
myIDENT=$myIDENT
|
myIDENT=$myIDENT
|
||||||
mySECRET=$mySECRET
|
mySECRET=$mySECRET
|
||||||
myCERT=$myCERT
|
|
||||||
myFORMAT=$myFORMAT
|
myFORMAT=$myFORMAT
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,20 +50,14 @@ For other OSes and Distros have a look at the official [Ansible Documentation](h
|
||||||
|
|
||||||
<a name="agent-forwarding"></a>
|
<a name="agent-forwarding"></a>
|
||||||
## Agent Forwarding
|
## Agent Forwarding
|
||||||
Agent Forwarding must be enabled in order to let Ansible do its work.
|
If you run the Ansible Playbook remotely on your Ansible Master Server, Agent Forwarding must be enabled in order to let Ansible connect to newly created machines.
|
||||||
- On Linux or macOS:
|
- On Linux or macOS:
|
||||||
- Create or edit `~/.ssh/config`
|
- Create or edit `~/.ssh/config`
|
||||||
- If you run the Ansible Playbook remotely on your Ansible Master Server:
|
|
||||||
```
|
```
|
||||||
Host ANSIBLE_MASTER_IP
|
Host ANSIBLE_MASTER_IP
|
||||||
ForwardAgent yes
|
ForwardAgent yes
|
||||||
```
|
```
|
||||||
- If you run the Ansible Playbook locally, enable it for all hosts, as this includes newly generated T-Pots:
|
- On Windows using Putty:
|
||||||
```
|
|
||||||
Host *
|
|
||||||
ForwardAgent yes
|
|
||||||
```
|
|
||||||
- On Windows using Putty for connecting to your Ansible Master Server:
|
|
||||||

|

|
||||||
|
|
||||||
<a name="preparation"></a>
|
<a name="preparation"></a>
|
||||||
|
|
|
@ -3,3 +3,4 @@ host_key_checking = false
|
||||||
|
|
||||||
[ssh_connection]
|
[ssh_connection]
|
||||||
scp_if_ssh = true
|
scp_if_ssh = true
|
||||||
|
ssh_args = -o ServerAliveInterval=60
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
- name: Check host prerequisites
|
- name: Check host prerequisites
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
become: yes
|
become: yes
|
||||||
become_user: root
|
|
||||||
become_method: sudo
|
|
||||||
roles:
|
roles:
|
||||||
- check
|
- check
|
||||||
|
|
||||||
|
@ -15,8 +13,6 @@
|
||||||
hosts: TPOT
|
hosts: TPOT
|
||||||
remote_user: linux
|
remote_user: linux
|
||||||
become: yes
|
become: yes
|
||||||
become_user: root
|
|
||||||
become_method: sudo
|
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- install
|
- install
|
||||||
|
|
|
@ -1,28 +1,17 @@
|
||||||
- name: Install pwgen
|
- name: Install dependencies
|
||||||
package:
|
package:
|
||||||
name: pwgen
|
name:
|
||||||
state: present
|
- pwgen
|
||||||
|
- python-setuptools
|
||||||
- name: Install setuptools
|
- python-pip
|
||||||
package:
|
|
||||||
name: python-setuptools
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Install pip
|
|
||||||
package:
|
|
||||||
name: python-pip
|
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install openstacksdk
|
- name: Install openstacksdk
|
||||||
pip:
|
pip:
|
||||||
name: openstacksdk
|
name: openstacksdk
|
||||||
|
|
||||||
- name: Set fact for agent forwarding
|
|
||||||
set_fact:
|
|
||||||
agent_forwarding: "{{ lookup('env','SSH_AUTH_SOCK') }}"
|
|
||||||
|
|
||||||
- name: Check if agent forwarding is enabled
|
- name: Check if agent forwarding is enabled
|
||||||
fail:
|
fail:
|
||||||
msg: Please enable agent forwarding to allow Ansible to connect to the remote host!
|
msg: Please enable agent forwarding to allow Ansible to connect to the remote host!
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
when: agent_forwarding == ""
|
when: lookup('env','SSH_AUTH_SOCK') == ""
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
- name: Patching tpot.yml with custom ews configuration file
|
- name: Patching tpot.yml with custom ews configuration file
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /opt/tpot/etc/tpot.yml
|
path: /opt/tpot/etc/tpot.yml
|
||||||
insertafter: '/opt/ewsposter/ews.ip'
|
insertafter: "/opt/ewsposter/ews.ip"
|
||||||
line: ' - /data/ews/conf/ews.cfg:/opt/ewsposter/ews.cfg'
|
line: " - /data/ews/conf/ews.cfg:/opt/ewsposter/ews.cfg"
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
- name: Copy hpfeeds configuration file
|
- name: Copy hpfeeds configuration file
|
||||||
template:
|
copy:
|
||||||
src: ../templates/hpfeeds.cfg
|
src: ../files/hpfeeds.cfg
|
||||||
dest: /data/ews/conf
|
dest: /data/ews/conf
|
||||||
owner: root
|
owner: tpot
|
||||||
group: root
|
group: tpot
|
||||||
mode: 0644
|
mode: 0770
|
||||||
|
register: config
|
||||||
|
|
||||||
- name: Applying hpfeeds settings
|
- name: Applying hpfeeds settings
|
||||||
command: /opt/tpot/bin/hpfeeds_optin.sh --conf=/data/ews/conf/hpfeeds.cfg
|
command: /opt/tpot/bin/hpfeeds_optin.sh --conf=/data/ews/conf/hpfeeds.cfg
|
||||||
|
when: config.changed == true
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
- name: Import OpenStack authentication variables
|
- name: Import OpenStack authentication variables
|
||||||
include_vars:
|
include_vars:
|
||||||
file: roles/deploy/vars/os_auth.yaml
|
file: roles/deploy/vars/os_auth.yaml
|
||||||
|
no_log: true
|
||||||
|
|
||||||
- name: Create security group
|
- name: Create security group
|
||||||
os_security_group:
|
os_security_group:
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
- name: Waiting for SSH connection
|
- name: Waiting for SSH connection
|
||||||
wait_for_connection:
|
wait_for_connection:
|
||||||
delay: 30
|
|
||||||
timeout: 300
|
|
||||||
|
|
||||||
- name: Gathering facts
|
- name: Gathering facts
|
||||||
setup:
|
setup:
|
||||||
|
@ -14,16 +12,15 @@
|
||||||
- name: Prepare to set user password
|
- name: Prepare to set user password
|
||||||
set_fact:
|
set_fact:
|
||||||
user_name: "{{ ansible_user }}"
|
user_name: "{{ ansible_user }}"
|
||||||
user_password: "{{ user_password }}"
|
|
||||||
user_salt: "s0mew1ck3dTpoT"
|
user_salt: "s0mew1ck3dTpoT"
|
||||||
|
no_log: true
|
||||||
|
|
||||||
- name: Changing password for user {{ user_name }} to {{ user_password }}
|
- name: Changing password for user {{ user_name }}
|
||||||
user:
|
user:
|
||||||
name: "{{ ansible_user }}"
|
name: "{{ ansible_user }}"
|
||||||
password: "{{ user_password | password_hash('sha512', user_salt) }}"
|
password: "{{ user_password | password_hash('sha512', user_salt) }}"
|
||||||
state: present
|
state: present
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
update_password: always
|
|
||||||
|
|
||||||
- name: Copy T-Pot configuration file
|
- name: Copy T-Pot configuration file
|
||||||
template:
|
template:
|
||||||
|
@ -33,7 +30,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Install T-Pot on instance - be patient, this might take 15 to 30 minutes depending on the connection speed. No further output is given.
|
- name: Install T-Pot on instance - be patient, this might take 15 to 30 minutes depending on the connection speed.
|
||||||
command: /root/tpot/iso/installer/install.sh --type=auto --conf=/root/tpot.conf
|
command: /root/tpot/iso/installer/install.sh --type=auto --conf=/root/tpot.conf
|
||||||
|
|
||||||
- name: Delete T-Pot configuration file
|
- name: Delete T-Pot configuration file
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
- name: Finally rebooting T-Pot in one minute
|
- name: Finally rebooting T-Pot
|
||||||
shell: /sbin/shutdown -r -t 1
|
command: shutdown -r now
|
||||||
become: true
|
async: 1
|
||||||
|
poll: 0
|
||||||
|
|
||||||
- name: Next login options
|
- name: Next login options
|
||||||
debug:
|
debug:
|
||||||
|
|
Loading…
Reference in a new issue