Skip to content

luigimolinaro/ssh-bastion-host

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Grant/Revoke SSH Access

This is a Ansible Playbook to automate the process of granting / revoking SSH access to a group of servers instances to a new user

Pre-requisites

  • You must have Ansible 2.3 installed.

Server & Installation Path

Ansible playbook is installed on Retelit Network under server retelit12.retelit.it (10.200.7.147) under /root/ssh-access-manager

Run Playbook

  • Add hosts in inventory/{hcs,retelit-server}/hosts file. See the given hosts file to add hosts.
  • Add public key in roles/public-keys/. e.g if we grant access for john doe user, copy and rename public key into that path like roles/public-keys/luigi_molinaro/luigi_molinaro.id_rsa.pub
  • Run command ansible-playbook -i inventory -e "access={grant|revoke} ssh_user={SSH_USER} user={USER}" --tag={del_user|add_user}

Example

Add user to HCS infastructure

 #GRANT
 ansible-playbook -i inventory -e "access=grant ssh_user=luigi_molinaro user=fsp" hcs.yml

REVOKE

 ansible-playbook -i inventory -e "access=revoke ssh_user=luigi_molinaro user=fsp" hcs.yml

Add user to HCS and add user to the Bastion Host

GRANT AND ADD USER

ansible-playbook -i inventory -e "access=grant ssh_user=luigi_molinaro user=fsp hcs.yml" --tag=add_user

REVOKE AND DELETE USER

ansible-playbook -i inventory -e "access=revoke ssh_user=luigi_molinaro user=fsp hcs.yml" --tag=del_user

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages