git and linux SSH script setup - jacob-dinapoli/tech-journal GitHub Wiki

Part 1. GIT

Install git on docker01

$ sudo apt install git-all

The clone

type the following commands:

$ pwd
$ hostname
$ git clone https://github.com/jacob-dinapoli/tech-journal

Create a directory structure

If you haven't done so already, create a directory structure within your local repository that is organized to capture your configuration information.

Within tech-journal create a directory and subdirectory

$ mkdir SYS265
$ cd SYS265/
$ mkdir docker01
$ cd docker01/
$ vi 50-cloud-init.yaml
$ vi cloud.cfg
$ vi docker-compose.yml
$ vi docker.txt
$ vi hosts

Add, commit and push.

$ git add .
$ git commit -m "..."
$ git push

Git clone

Once pushed, you can always recover files deleted locally by doing a git checkout. Delete the README.md file from the local repo.

$ cat README.md
$ rm README.md
$ git checkout
$ cat README.md

Clone your repo on wks01

Find and execute git-bash and then clone your repo

$ cd Desktop/
$ git clone https://github.com/jacob-dinapoli/tech-journal

Modify your repo

Create a wks01 directory with a README.md file with some arbitrary content.

$ cd tech-journal/SYS265/wks01/
$ hostname
$ echo hostname >> README.md
$ cat README.md

Part 2: Hardening SSH

Clone your tech journal to web01. You will need to install git.

Let's organize our local repository a bit and then push the changes up to github. We are going to create a few directories and a shell script called secure-ssh.sh

$ pwd
$ mkdir -p linux/{public-keys,centos7}
$ cd linux/
$ ls
$ nano centos7/secure-ssh.sh
$ chmod +x centos7/secure-ssh.sh
$ cat centos7/secure-ssh.sh

Push changes to github

$ git add .
$ git commit -m "linux"
$ git push

RSA keypair

Create an RSA Keypair on web01, no passphrase is required. Copy the PUBLIC key to the local repo, see the last two lines.