Cyber Security: An Offensive Mindset [Week 1 - Sprint]
To do:
Links:
- https://www.netlify.com/blog/2016/09/21/a-step-by-step-guide-victor-hugo-on-netlify/#building-your-site
- https://www.youtube.com/watch?v=gSiAcyTWU3c
- https://gohugo.io/getting-started/quick-start/
- https://skilstak.io/changing-dns-on-namecheap-to-point-to-netlify/
Organise GitHub and Create First Repo:
- Initially I started by creating a repo in GitHub for my blog, this will be the cloud where my webpage's contents will be stored (blog).
- This will then point to Netlify, which will rebuild the webpage each time I make a change on the GitHub repo.
Create domain on Namecheap and link to Github
- With the GitHub Education Package there is a free domain name registration provided by Namecheap as shown below, this will allow us to host our own webpage (blog) for free for a year.
- Next step is that I had to choose an actual domain name for my webpage, as shown below:
- ankywinning.me
Research, download and setup Hugo
- Next I've looked through documentation and watched videos to understand how Hugo can be implemented to host my webpage.
- Hugo essentially provides a web server which builds and serves the site with high performance.
- To understand a basic Hugo setup I followed the instructions on the "Quick start" found at this link:
- As I'll be using MacOS as my operating system, I must download Homebrew (package manger for MacOS). Type the following in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install hugo
hugo version
- Next for the interesting part creating the actual new site, the below command will create a Hugo site in a folder named "ankywinning" as shown:
cd Projects
hugo new site ankywinning
- Next we can explore the site file by typing the below command, below is a screenshot of the contents of the new site folder called "ankywinning":
cd ankywinning
- Next we need to install necessary dependencies by entering the following commands for to install, initialise and start npm:
- Error 1: I had an issue when trying to run "npm start" command because of error to do with the "package.json" file. After some research I found that it was because "npm init" was necessary.
- Error 2: But after overcoming above issue I was faced with the issue of a missing script when attempting to run "npm start". Reason for this error is because I haven't changed DNS or linked Namecheap to Netlify.
brew install npm
npm init
npm start
- Errors:
- Error 1 & 2:
- Now that we're in the working site directory we need to initialise the local directory on our machine as a Git repository (repo), by following below command:
git init
- The next step in getting Hugo setup is to pick a theme then download it from Github, adding it to my sites theme directory (inside site folder).
git submodule add https://github.com/zwbetz-gh/cupper-hugo-theme.git themes/cupper-hugo-theme
- In regards to theme I have chosen to use something simple called "cupper-hugo-theme" which will look like this:
- Next we can run the commands below to:
- Add the theme to our "config.toml" file (note sometimes it may be a .yaml).
- Another command is to run the hugo webserver locally (-D = drafts enabled).
- Final command is to create content (blog posts).
echo 'theme = "cupper-hugo-theme"' >> config.toml
hugo server -D
hugo new posts/my-first-post.md
- Now we'll need to type the following in the terminal, to add the files in your new local repository. This stages them for the first commit (save to GitHub repo).
git add .
OR
git add -A
- Now we can actually commit the files that you've staged in your local repository, using command:
git commit -m 'First commit'
- Now go to GitHub at the top of your GitHub repository's "Quick Setup" page, click the clipboard icon to copy the remote repository URL.
- In terminal, add the URL for the remote repository where your local repository will be pushed.
git remote add origin https://github.com/ankywinning/ankywinning.git
- Next we need to verify your URL by typing command:
git remote -v
- Finally, we need to push the changes in your local repository to GitHub by following the below command:
git push origin master
Research Netlify and create an account
- First we will need to sign up to Netlify in order to utilise it to rebuild our static webpage each time we make changes to GitHub repo. I'll be signing up using GitHub as my repo is located there.
- Now that I'm signed up and logged in using my GitHub login, I was greeted by this Netlify home page. Within the "Site" tab press the "New site from Git" button to add GitHub repo that I wanted to link.
- This page was then displayed and I selected "GitHub" as that is the Git provider I will be using for this project.
- Next will be another authorisation section to allow Netlify access to my GitHub repositories, this screen below will be shown for my case I will select a specific repository not all of them and let it install.
- There are some configuration settings that will need to be inputted when required, as shown below. Make sure that you change build command and publish directory it's very important, then simply press the "Build site" button.
- Error: The build command and publish directory are actually wrong needs to be what is in image below.
- Error: These are the details that need to changed from the detailed inputted above.
- Now it's a waiting game to allow Netlify to deploy the site.
- Error: Site deploy failed multiple times when I attempted to deploy my site, but I have discovered it was a simple misconfiguration. I have to link Namecheap DNS to my to Netlify.
- To link Namecheap domain to our Netlify we need to log into name cheap and on the domain press "Manage", then follow the DNS settings provided on URL below.
- When in the settings for "ankywinning.me" domain I needed to change Nameservers from "Namecheap BasicDNS" to "Custom DNS", then input the following DNS settings.
- NOTE: The process of changing DNS settings can take anywhere between 24 and 48 hours.
- After attempting to build again with the new DNS settings, again it wasn't able to build the static site.
- Error: This is because the Hugo version on Netlify wasn't updated to the same version as I have locally on my machine. To get to the "Environmental variables", go to:
- Settings > Build and Deploy > then scroll to Environment
- Another addition is to go to "config.yaml" and change the base url as shown below to "/".
- It's LIVE! My webpage "ankywinning.me" is officially being hosted on the internet.
Start making changes to live website
- Now I'm going to start by adding an image to my webpage using commands, then drag the image that I'd like to make my webpages logo.
- NOTE: You will need to remove the previous logo.svg image and add yours in with the same file name with extension.
cd themes
cd static/images
Other Posts
CompTIA Security+ 601
BSides Canberra 2021
TryHackMe - Pre Security
Cyber Security: An Offensive Mindset [Week 1 - Sprint]
Cyber Security: An Offensive Mindset [Week 5 - Reflection]
Cyber Security: An Offensive Mindset [Week 4 - Reflection]
Cyber Security: An Offensive Mindset [Week 4 - Boiler CTF Write up]
Cyber Security: An Offensive Mindset [Week 4 - Sprint]
Cyber Security: An Offensive Mindset [Week 3 - Sprint]
Cyber Security: An Offensive Mindset [Week 2 - Reflection]
Cyber Security: An Offensive Mindset [Week 2 - Sprint]
Cyber Security: An Offensive Mindset [Week 1 - Reflection]
Cyber Security: An Offensive Mindset [Week 1 - Intro]
Cyber Security: An Offensive Mindset [Week 6 - Reflection]
GIAC Certified Incident Handler (GCIH)
BSides Canberra 2023
Crickey Con 2022
CSEC Con 2022
SecTalks Meet Up Event [UTS]
SecTalks Meet Up Event [PwC]
SecTalks Meet Up Event [TikTok]
SecTalks Meet Up Event [Google]
Blue Team Level 1 (BTL1)
Cyber Security: An Offensive Mindset [Week 6 - Portfolio]