Use python paramiko to create a bastion host

Source: Internet
Author: User

Use python paramiko to create a bastion host
Bastion host-readme: (the database is mysql) 1. If the database does not exist, create a database, authorize the database user, create a table structure, and initialize some data. 2. If the database exists, go to Step 3. log on to the bastion host for verification. 4. If the bastion host user exists and the verification is successful, all the host groups of the bastion host user will be listed, and the number of hosts that can be used in the user's host group. 5. Select a host group to view the list of available hosts and users. 6. Select a user to enter a host or execute commands in batches. 7. If a bastion host user chooses to use a user to enter a single host, the user loads the local know_hosts file using paramiko for key verification and uses ssh to log on to the client host session to create a channel instance. Interact with the host, execute commands, and write data to the database in five or five records at the same time. 8. If you are a bastion host user, select to execute commands in batches. To create a multi-process pool, use paramiko to load the local know_hosts file, perform key verification, and connect to the client host using ssh. Execute the command, lock it, print the command result, and release the lock. Wait until all the processes in the process pool are executed, and prompt the user that all the processes have been executed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.