[ad_1]
On this weblog submit, you’ll discover ways to document SSH periods on a Pink Hat Enterprise Linux (RHEL) VSI in a non-public VPC community utilizing in-built packages. The VPC non-public community is provisioned via Terraform and the RHEL packages are put in utilizing Ansible automation. Moreover, you’ll discover ways to arrange a extremely out there bastion host.
What’s session recording and why is it required?
A bastion host and a leap server are each safety mechanisms utilized in community and server environments to manage and improve safety when connecting to distant programs. They serve comparable functions however have some variations of their implementation and use circumstances. The bastion host is positioned in entrance of the non-public community to take SSH requests from public visitors and cross the request to the downstream machine. Bastion host and leap servers are weak to intrusion as a result of they’re uncovered to public visitors.
Session recording helps an administrator of a system to audit consumer SSH periods and ensure they adjust to regulatory necessities. Within the occasion of a safety breach, the administrator will wish to audit and analyze the consumer periods. That is important for a security-sensitive system.
What’s a non-public VPC community?
A virtual private cloud is totally non-public if there is no such thing as a public ingress or outgress community visitors. In easy technical phrases, it’s non-public if there aren’t any public gateways on the subnets (non-public subnets) and no floating IPs on the Digital Server Cases (VSIs).
How do I hook up with the non-public VPC community?
Consumer-to-site VPN for VPC is without doubt one of the two VPN choices out there on IBM Cloud, and it permits customers to hook up with IBM Cloud assets via safe, encrypted connections.
The client-to-site VPN is very out there, with two VPN servers which might be created in two totally different availability zones in the identical area. The bastions are extremely out there as nicely.
Stipulations
Provision the non-public VPC community utilizing Terraform
- Upon getting the IBM Cloud Secrets Manager secret with the certificates, launch your terminal and set the next Terraform variables:
export TF_VAR_ibmcloud_api_key=<IBM_CLOUD_API_KEY>
export TF_VAR_secrets_manager_certificate_crn=<SECRET_CRN>
git clone https://github.com/VidyasagarMSC/private-vpc-network
cd terraform
- Run the Terraform instructions to provision the VPC assets (e.g., subnets, bastion hosts (VSIs), VPN, and many others.):
terraform init
terraform plan
terraform apply
Hook up with client-to-site VPN
- As soon as the VPC assets are efficiently provisioned, you should obtain the VPN consumer profile by navigating to VPN servers page on IBM Cloud.
- Click on the Consumer-to-site servers tab after which on the title of the VPN:
- Obtain the profile from the Purchasers tab.
- The VPN provisioned via Terraform makes use of certificates. Observe the instructions here to hook up with the OpenVPN Consumer.
- It is best to see the profitable connection in your OpenVPN Consumer:
Confirm the SSH connection
- On a terminal, add the SSH non-public key to the SSH agent with the next command:
ssh-add <LOCATION_OF_PRIVATE_SSH_KEY>
- Instance:
ssh-add ~/.ssh/<NAME_OF_THE_PRIVATE_KEY>
- Run the next command to SSH into the RHEL VSI via a bastion host. You can be utilizing the non-public IP deal with of the bastion in Zone 1:
ssh -J root@10.10.0.13 root@10.10.128.13
- Keep in mind, you need to be linked to the client-to-site VPN to entry the RHEL VSI via the bastion host.
- After SSH, It is best to see directions to allow SSH session recording utilizing the TLOG package deal on RHEL.
Deploy session recording utilizing Ansible
To deploy the session recording answer, you should have the next packages put in on the RHEL VSI:
tlog
SSSD
cockpit-session-recording
The packages can be put in via Ansible automation on all of the VSIs—each bastion hosts and RHEL VSI.
- Transfer to the Ansible folder:
cd ansible
- Create
hosts.ini
from the template file:
cp hosts_template.ini hosts.ini
- Run the Ansible playbook to put in the packages from an IBM Cloud non-public mirror/repository:
ansible-playbook main_playbook.yml -i hosts.ini --flush-cache
You’ll be able to see in Determine 1 that after you SSH into the RHEL machine, you will note a be aware saying: ATTENTION! Your session is being recorded!
Verify the session recordings, logs and stories
Should you intently observe the messages post-SSH, you will note a URL to the online console that may be accessed utilizing the machine title or non-public IP over port 9090. To permit visitors on port 9090, within the Terraform code, change the worth of allow_port_9090
variable to true
and run terraform apply
. The most recent terraform apply
will add ACL and safety group guidelines to permit visitors on port 9090.
- Now, open a browser and navigate to
http://10.10.128.13:9090
. To entry utilizing the VSI title, you should arrange a non-public DNS (out of scope for this text). You want a root password to entry the online console:
- Navigate to Session Recording on the left-hand aspect to see the listing of session recordings. Together with session recordings, you possibly can test the logs, diagnostic stories, and many others.:
Advisable studying
Conclusion
This text coated why session recording is required in bastion hosts for auditing and compliance and the way session recording may be arrange with the built-in RHEL packages utilizing Ansible Automation.
Whereas designing a secured digital non-public cloud community, you discovered the very best practices in architecting a VPC non-public community. We additionally coated the necessity to construct extremely out there VPN servers and bastion hosts. With the provisioning of cloud infrastructure utilizing Terraform and Ansible for session recording, you bought hands-on expertise.
Learn more about IBM Cloud VPC
You probably have any queries, be happy to succeed in out to me on Twitter or on LinkedIn.
[ad_2]
Source link