kali-autosetup/roles/cyberchef/tasks/main.yml
2022-07-30 19:39:46 +02:00

79 lines
No EOL
1.6 KiB
YAML

- name: Install required packages
apt:
pkg:
- npm
- node-grunt-cli
update_cache: yes
- name: Create cyberchef user-group
group:
name: cyberchef
state: present
- name: Create cyberchef user
user:
name: cyberchef
group: cyberchef
system: yes
- name: Create cyberchef user's npm config dir
become_user: cyberchef
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
- name: Clone CyberChef repo
become: yes
git:
repo: https://github.com/gchq/CyberChef.git
dest: "{{ cyberchef_root_dir }}"
clone: yes
update: yes
force: yes
- name: Patch Gruntfile.js
lineinfile:
path: "{{ cyberchef_root_dir }}Gruntfile.js"
regexp: "fixCryptoApiImports"
line: "fixCryptoApiImports: { options: { shell: '/bin/bash' },"
- name: Set permissions on repo
become: yes
file:
path: "{{ cyberchef_root_dir }}"
owner: cyberchef
recurse: yes
- name: Install CyberChef
become_user: cyberchef
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 }}"
- 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