93 lines
3.2 KiB
YAML
93 lines
3.2 KiB
YAML
---
|
|
- name: Chisel Client - Server playbook
|
|
hosts: all
|
|
become: true
|
|
|
|
# #
|
|
# # @author Stéphane Gratias (2021).
|
|
#
|
|
|
|
|
|
roles:
|
|
- { role: justin_p.chisel, tags: chisel-server }
|
|
|
|
tasks:
|
|
# Need to install proxychains
|
|
- name: Change settings in chisel-server and proxychains conf files | Server
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ item.path }}"
|
|
regexp: "{{ item.regexp }}"
|
|
state: "{{ item.state }}"
|
|
line: "{{ item.line|default(omit) }}"
|
|
loop: "{{ chisel_proxychains_conf }}"
|
|
when: "{{ chisel_server|default(false) }} is true"
|
|
tags: chisel-server
|
|
|
|
- name: Reload service chisel-server | Server
|
|
ansible.builtin.service:
|
|
name: chisel-server
|
|
state: restarted
|
|
when: "{{ chisel_server|default(false) }} is true"
|
|
tags: chisel-server
|
|
|
|
|
|
- name: Lire le contenu du fichier
|
|
ansible.builtin.slurp:
|
|
src: "/var/log/chisel/{{ chisel_config_name }}_error.log"
|
|
register: contenu_fichier
|
|
tags: chisel-server-test
|
|
|
|
# - name: Debug log chisel-server and register it for fingerprint
|
|
# ansible.builtin.command:
|
|
# cmd: 'cat "/var/log/chisel/"{{ chisel_config_name }}_error.log" | grep Fingerprint'
|
|
# register: chisel_fingerprint
|
|
# tags: chisel-server
|
|
|
|
- name: test
|
|
debug:
|
|
msg: "{{ contenu_fichier | b64decode }}"
|
|
tags: chisel-server-test
|
|
|
|
# - name: Ensure gzip is installed | Client
|
|
# ansible.builtin.apt:
|
|
# name: gzip
|
|
# state: present
|
|
# when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
|
|
|
|
# - name: "Download chisel {{ chisel_version }}"
|
|
# ansible.builtin.get_url:
|
|
# url: "{{ chisel_download_url_linux_amd64 }}"
|
|
# dest: "{{ chisel_download_destination }}"
|
|
# checksum: "sha256:{{ chisel_linux_amd64_sha256 }}"
|
|
# mode: '0600'
|
|
# when: not chisel.stat.exists or chisel_version != chisel_installed_version
|
|
|
|
- name: Unarchive a file that needs to be downloaded (added in 2.0)
|
|
ansible.builtin.unarchive:
|
|
src: https://example.com/example.zip
|
|
dest: /usr/local/bin
|
|
remote_src: yes
|
|
tags: chisel-client
|
|
|
|
# - name: Change the working directory to somedir/ and run the command as db_owner if /path/to/database does not exist
|
|
# ansible.builtin.command: /usr/bin/make_database.sh db_user db_name
|
|
# become: yes
|
|
# become_user: db_owner
|
|
# args:
|
|
# chdir: somedir/
|
|
# creates: /path/to/database
|
|
|
|
# - name: "Unpack chisel to {{ chisel_install_destination }}" # noqa: no-changed-when
|
|
# ansible.builtin.shell: "gunzip -c {{ chisel_download_destination }} > {{ chisel_install_destination }}"
|
|
# register: gunzip_output
|
|
# when: not chisel.stat.exists or chisel_version != chisel_installed_version
|
|
|
|
|
|
# Done chisel Server
|
|
# TODO client (no role) remove-client remove-server
|
|
|
|
|
|
# TODO chisel in traefik
|
|
# port 8080 and 1080 (socks)
|
|
# docker run --rm -it jpillora/chisel client --auth "user:pass" --fingerprint dr5QNd5AIR9vFKATKQ/MYN441MF4av5Pipvg65camPo= 163.172.84.28:8080 R:163.172.84.28:socks
|
|
# /usr/local/bin/chisel server --host 163.172.84.28 --port 8080 --auth user:pass --reverse --socks5 -v |