Lab 03 Git & SSH Script - FlameSpyro/Tech-Journal GitHub Wiki

Summary

Overall most of this lab is pretty simple when it comes to the configuration of GitHub and git and enforcing from docker. I think it was really fun to set up this kind of connection. However, where I fall flat is the scripting part due to my little understanding of it, this will be explained later.

Part 1 GIT

  1. Ensure you are in your user directory cd /home/username
  2. ensure git is also installed
  3. Enter the following git clone https://github.com/**github user**/Tech-Journal
  4. You will be prompted to enter your GitHub credentials
  5. A connection between docker-machine and GitHub has been made
  6. Within tech journal, make a directory called SYS265 and a directory inside that called docker01
  7. Move the following into the docker01 directory through copying
  • 00-installer-config.yaml
  • cloud.cfg
  • docker-compose.yml
  • hosts
  • You can copy in ubuntu using cp <source> <destination>
  1. Add, commit and push to your github through:
  • git add <file>
  • git status
  • git config user.email **email**
  • git config user.name **username**
  • git commit -m "message needed in order to push"
  • git push
  1. Recover lost files by using git checkout <file>
  2. Download git on mgmt01
  3. Enter git clone command from step 3. Will be prompted to log in through a github login page
  4. Create an mgmt01 directory within SYS265
  5. Create file through echo <hostname> >> README.md
  6. docker01 is now out of sync and needs to be fixed through git pull

Part 2: Hardening SSH

  1. Clone GitHub to web01 using clone command from part 1
  2. Within SYS265 of github create a directory like this mkdir -p linux/{public-keys,centos7}
  3. Enter vi centos7/secure-ssh.sh to enter the following: #secure-ssh.sh #author <username> #creates new ssh user using $1 parameter #adds a public key from the local repo or curled from the remote repo #removes roots ability to ssh in echo "ALL CODE GOES HERE"
  4. chmod +x centos7/secure-ssh.sh
  5. Push changes to github
  6. Lets do a RSA keypair by starting with ssh-keygen -t rsa -C "sys265"
  7. Hit enter when prompted o enter a file where to save the key
  8. Enter nothing for the passphrase aswell
  9. public key has been saved to a file called "id_rsa.pub"
  10. Push this key to guthub but ensure the private key isnt included or else the sun will explode
  11. Finish here when scripting problem is resolved

The big issue

STATUS: UNSOLVED As of the time of writing this, the scripting is running into some errors due to my inability to write scripts. I will be reaching out to the professor to have this resolved and understood. When fixed, the guide will be wrapped up.

Conclusion

This lab is fairly simple if you know where your directories are. I find the concept of updating github from a command prompt to be both fun and interesting. My struggle/weakness in this lab comes to the cripting part. I am not good at scripting to come up with scripts on my own and need to practice more through external sources.

⚠️ **GitHub.com Fallback** ⚠️