kali-autosetup/roles/cyberchef/tasks/main.yml

74 lines
1.6 KiB
YAML
Raw Normal View History

2022-07-29 00:01:23 +02:00
- name: Install required packages
apt:
pkg:
- npm
2022-07-30 19:24:36 +02:00
- node-grunt-cli
2022-07-29 00:01:23 +02:00
update_cache: yes
- name: Create cyberchef user
user:
name: cyberchef
2022-07-30 19:24:36 +02:00
group: cyberchef
2022-07-29 00:01:23 +02:00
system: yes
2022-07-30 19:24:36 +02:00
- name: Create cyberchef user's npm config dir
2022-07-29 00:01:23 +02:00
become_user: cyberchef
2022-07-30 19:24:36 +02:00
file:
path: /home/cyberchef/.npm-global
state: directory
- name: Set user's npm config path
become_user: cyberchef
command: npm config set prefix '~/.npm-global'
- name: Set user's path variable
copy:
path: /home/cyberchef/.profile
content: export PATH=~/.npm-global/bin:$PATH
2022-07-29 00:01:23 +02:00
- name: Clone CyberChef repo
2022-07-30 19:24:36 +02:00
become: yes
2022-07-29 00:01:23 +02:00
git:
repo: https://github.com/gchq/CyberChef.git
dest: "{{ cyberchef_root_dir }}"
clone: yes
update: yes
force: yes
2022-07-29 00:01:23 +02:00
2022-07-29 00:45:13 +02:00
- name: Patch Gruntfile.js
lineinfile:
path: "{{ cyberchef_root_dir }}Gruntfile.js"
regexp: "fixCryptoApiImports"
2022-07-30 19:24:36 +02:00
line: "fixCryptoApiImports: { options: { shell: '/bin/bash' },"
2022-07-29 00:45:13 +02:00
2022-07-29 00:01:23 +02:00
- name: Set permissions on repo
become: yes
file:
path: "{{ cyberchef_root_dir }}"
owner: cyberchef
recurse: yes
- name: Install CyberChef
become_user: cyberchef
2022-07-29 00:45:13 +02:00
command:
cmd: "npm install"
chdir: "{{ cyberchef_root_dir }}"
- name: Perform npm audit and fix
become_user: cyberchef
command:
cmd: "npm audit fix"
chdir: "{{ cyberchef_root_dir }}"
2022-07-29 00:01:23 +02:00
- name: Set systemd service
become: yes
template:
src: cyberchef.service.j2
dest: /etc/systemd/system/cyberchef.service
- name: Enable & start cyberchef
service:
name: cyberchef
state: restarted
enabled: yes
daemon_reload: yes