Skip to content

Commit fe233f3

Browse files
committed
feat: Add reset 2FA workflow
1 parent acfdadd commit fe233f3

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/reset-2fa.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Reset 2FA
2+
run-name: Reset 2FA from user ${{ inputs.user }} in ${{ inputs.environment }}
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
user:
7+
description: User to remove 2FA from
8+
type: string
9+
required: true
10+
environment:
11+
type: choice
12+
description: Infrastructure to provision
13+
default:
14+
required: true
15+
options:
16+
- ""
17+
18+
jobs:
19+
reset:
20+
environment: ${{ inputs.environment }}
21+
runs-on: ubuntu-24.04
22+
outputs:
23+
outcome: ${{ steps.deploy.outcome }}
24+
timeout-minutes: 60
25+
steps:
26+
- name: Clone country config resource package
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 1
30+
path: './${{ github.event.repository.name }}'
31+
# FIXME: Reset should work on all servers
32+
- name: Remove 2FA
33+
run: "sudo rm /home/${{ inputs.user }}/.google_authenticator"
34+
- name: checkout repository
35+
uses: actions/checkout@v5
36+
- name: Run Ansible Playbook
37+
uses: dawidd6/action-ansible-playbook@v4
38+
env:
39+
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT: 10
40+
ANSIBLE_SSH_TIMEOUT: 10
41+
ANSIBLE_SSH_RETRIES: 5
42+
with:
43+
requirements: galaxy-requirements.yml
44+
playbook: reset-2fa.yml
45+
directory: ./infrastructure/server-setup
46+
# Add --verbose to get more output
47+
options: |-
48+
--inventory inventory/${{ inputs.environment }}.yml
49+
${{ inputs.tags != 'all' && format('--tags={0}', inputs.tags) || '' }}
50+
--extra-vars user=${{ inputs.user }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
#
5+
# OpenCRVS is also distributed under the terms of the Civil Registration
6+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
7+
#
8+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
9+
---
10+
11+
- hosts: all
12+
become: yes
13+
gather_facts: yes
14+
ignore_unreachable: false
15+
become_method: sudo
16+
tasks:
17+
- name: Remove /home/${{ inputs.user }}/.google_authenticator
18+
shell: rm -f /home/${{ inputs.user }}/.google_authenticator

0 commit comments

Comments
 (0)