AzureCourse Document 2
AzureCourse Document 2
AzureCourse Document 2
Rohit K Singh
INTRODUCTION
1. DevSecOps Vs DevOps
2. Continuous Integration
3. Continuous Deployment & Delivery
4. Security Integration
5. Tools
Rohit K Singh
DEVSECOPS VS DEVOPS
Rohit K Singh
Security
CONTINUOUS INTEGRATION
Rohit K Singh
Work-flow • Build o Merging the codes with remote repos
o Compiling source code
• Test
o Running UNIT / Automated test cases
• Release o Publishing build artifacts
• Deploy
Continuous Integration
Rohit K Singh
CONTINUOUS DEPLOYMENT &
DELIVERY
Rohit K Singh
Continuous Delivery: Upper
Lower Pre -Approval Pre -Approval
Continuous delivery is an automated release process, we can deploy our application at any
time by clicking a button
With continuous delivery, you can decide to release daily, weekly, fortnightly, or whatever
suits your business requirements
With continuous delivery, codes get deployed in lower environments without manual
intervention but for upper environments deployment manual approval is the must
Rohit K Singh
Continuous Deployment:
Lower Upper
Pre-
Develop Commit IDE Plugins
Hooks
Mutation
TEST Unit Test
Test
SAST
Container
Dependen
BUILD ARTIFACTS
cy-checks
Image-
Scan
Complianc Functionalit
Deploy DAST
y-checks
e Checks
Rohit K Singh
Rohit K Singh
SECTION-2
1. Virtual Machine creation
2. Software Installation
3. Use-Case
4. Maven Basic
5. Basic Jenkins build/deploy pipelines creation
Rohit K Singh
Hardware
Requirement
Software Installation:
Docker
Java 11, Maven
Jenkins
Docker
Kubernetes components (kubectl,
Operating system: Ubuntu:18.04 kubeadm, kubelet)
HDD: 128 GB CNI – Weave Net
CPU: 2 vCPU
Memory: 4 GB
Static IP
Network Policy: Allow All
Rohit K Singh
USE-CASE
Rohit K Singh
http://localhost:8080/increment/99 Port -- 8080
100
http://localhost:5000/plusone/99
100
/compare
Rohit K Singh
/
Port -- 5000
MAVEN
Rohit K Singh
MAVEN
• Maven, a Yiddish word meaning accumulator of knowledge, was built as an attempt to simplify
the build processes
• Maven is a powerful project management tool that is based on POM (project object model)
• It is used for project build, dependency, and documentation
Helps Us with:
o Builds
o Documentation
o Reporting
o SCMs
o Releases
o Distribution
New features migration Provides project Information
Rohit K Singh
SECTION-3
1. Adding Security to the pipelines
• GIT Hooks – Talisman
• UNIT Test Integration
• Code Coverage - Jacoco
• Mutation – PIT
Rohit K Singh
Objectives:
File System
Essential User & Group
&
Commands Management
Permissions
Features of BASH:
ls Documents
o Bash Auto-Completion alias dt=date
o Alias history Rohit K Singh
o Command History
Basic Commands:
Commands & Arguments:
Rohit K Singh
Basic Commands:
Commands Types:
External Commands:
Internal and Build-In Commands: • mv
• echo • date
• cd • Uptime
• pwd etc • cp etc
• An absolute path is a complete path from start of actual file system from / directory
• Relative path is defined as the path related to the present working directly(pwd)
Rohit K Singh
Basic Commands:
$pwd {present working directory}
Pager:
$ls (List Content) $more
o $Ls –a (All files, including hidden) $less
o $Ls –l (Long List)
o $Ls –lt (Long list in order it created) Command line Help:
o $Ls –ltr (In reverse order) $whatis date
$Man date
$mkdir (make a new directory) Date –help
$cd (Change directory)
mv (Move file or directory)
cp (copy file)
cp –r (copy directory)
rm (remove file) Rohit K Singh
rmdir (remove directory)
$touch (Create file)
$cat (Open file read-only)
Filesystem Hierarchy: / (Root Partition)
Rohit K Singh
File Types:
Rohit K Singh
File Permissions:
r w x
- rwx rwx r-x 4 2 1
Owner Group Others
u g o
Rohit K Singh
File Permissions:
Rohit K Singh
File Permissions:
Rohit K Singh
User & Group Management:
User Information:
cat /etc/passwd
Group Information:
cat /etc/group
Rohit K Singh
User & Group Management:
Account Types: Commands:
- Service Accounts
• nginx
User & Group Management:
Password Information:
cat /etc/shadow
SUDO:
Syntax: User <space> OnHost = (RunAs-User:Group) <space> Commands
visudo /etc/sudoers
Example: root ALL = (ALL:ALL) ALL
Rohit K Singh
User & Group Management:
Rohit K Singh
User & Group Management:
-c Custom Comments
-d custom home directory
-e Expiry date
-g specific GID
-G Create user with multiple secondary group
-s specific login shells
-u specific UID
Rohit K Singh
File Permissions:
Rohit K Singh
Package Managers:
Package management is a method of installing, updating, removing, and keeping track of software
updates from specific repositories (repos) in the Linux system
Rohit K Singh
Package Managers:
YUM OR APT:
• YUM (Yellow Dog Updater, Modified) or DPKG is an open-source Linux package management application
that uses the RPM or DEB package manager
• YUM’s and DPKG benefits over RPM or DEB are automatic updates, easy package management Rohit K Singh
and dependency management
Linux Editor:
VI & VIM Editor: Edit file “vi file-name.txt”
Read-Only “vi –R file-name.txt”
Sr No Command Description
1 k Moves the cursor up one line
2 j Moves the cursor down one line
3 h Moves the cursor to the left one character position
4 L Moves the cursor to the right one character position
5 i Inserts text before the current cursor location
6 I Inserts text at the beginning of the current line
7 a Inserts text after the current cursor location
8 A Inserts text at the end of the current line
9 o Creates a new line for text entry below the cursor location
10 O Creates a new line for text entry above the cursor location
Rohit K Singh
Rohit K Singh
Objectives:
Key Vault /
Storage App Services / Rohit K Singh
Account Kubernetes
Services
Cloud Concepts:
Software as a Service (SaaS)
SaaS platforms involve software that is available via third-party over the Internet
SaaS Examples - Google Workspace, Salesforce
PaaS focuses primarily on hardware and software tools available over the internet
PaaS Examples - AWS Elastic Beanstalk, Heroku
IaaS works primarily with cloud-based and pay-as-you-go services such as storage,
IaaS networking and virtualization
Examples – AWS, Azure
On-Premises
On-premises software is installed and runs on computers on the premises of the person
On- or organization using the software, rather than at a remote facility such as a server farm oRr ochlio
t KuSd
in.gh
Prem Examples – Local Data Center
Shared Responsibility Model:
Rohit K Singh
Virtual Network:
NSG’s can contain multiple inbound and outbound security rules that enable you to filter traffic to and from
resources by source and destination IP address, port, and protocol
NSG can be attached to subnets, network cards or ASGs
Various NSG properties:
Name
Priority
Source & Destination
Protocol
Direction
Port Range
Action
Filter traffic
NSG operate at layer 4 and allows us to
filter the incoming and outgoing traffic
from a virtual network
Association
NSGs can be associated to subnets and
network interfaces. You can associate
multiple subnets and network interfaces
to a single NSG
Evaluation
Rules applied at subnet and network
interface level is evaluated separately.
Traffic requires “allow” rule at both levels
to be admitted
Rule set
NSG comprises a set of priority-based Rohit K Singh
rules that can be used to allow or deny
inbound or outbound traffic
NSG/ASG flow:
443
VM Sizes:
Rohit K Singh
Azure VM-Sizes
Azure Bastion:
Azure Bastion is a service you deploy that lets you connect to a virtual machine using your browser and the
Azure portal, or via the native SSH or RDP client already installed on your local computer
Rohit K Singh
Azure Availability and Resiliency:
Azure
Azure Site
Storage Rohit K Singh
Recovery
Redundancy
What are Virtual Machine scale sets:
Rohit K Singh
Supports up to 1000 VMs
with your own custom
images up to 600 VMs
Azure Load Balancer
Portal
Custom
Image
Microsoft Azure’s storage solution for object storage, file storage, message queue and a NoSQL store
for meeting modern application requirements
Azure Files
Azure Containers
Used to provision highly available file
deal for storing unstructured data such as
shares in cloud that can be mounted to
text or binary data
cloud and on-premises machines
Synchronously replicates data to three disks within a data center in the primary region.
LRS Offers a moderate level of availability at a lower cost
RA-
Same as GRS, but allows data to be read from both Azure regions Rohit K Singh
GRS
AZURE ENDPOINTS
ROHIT K SINGH
Azure Private Link (Private Endpoint):
Private Endpoints allow you to access Azure PaaS services over a Private IP address within the VNet.
It gets a new private IP on your VNet. When you send traffic to PaaS resource, it will always ensure
traffic stays within your VNet
Service Endpoint provides secure and direct connectivity to Azure PaaS services over an optimized
route over the Azure backbone network. Traffic still left your VNet and hit the public endpoint of
the PaaS service
Private endpoint
Rohit K Singh
SonarQube is an open-source platform developed by SonarSource for continuous
inspection of code quality to perform automatic reviews with static analysis of code.
Why?
What?
• Simply having visibility into code is not enough and in order to address the issues flagged by code
analysis, we need to make use of different data insights that we get from SonarQube
How?
Quality Gates
• Best way to ensure that standards are met and regulated in projects
• Can be defined as a set of threshold measures set on your project
Rohit K Singh
TALISMAN
Rohit K Singh
Pre-commit / Pre-push hooks:
• Sensitive information such as the access keys, access tokens, SSH keys etc. are often erroneously
leaked due to accidental git commits
• Pre-commit hooks can be installed on developer’s workstations to avoid them
• Work on pure Regex-based approach for filtering sensitive data
• If developers want they can bypass this step
Rohit K Singh
AWS Keys - Case Study
Talisman:
• Talisman installs a hook to your repository to ensure that potential secrets or sensitive information
do not leave the developer's workstation
• It validates the outgoing change for things that look suspicious like potential SSH keys,
authorization tokens, private keys, etc.
Global Installation:
Talisman will thus be present, not only in your existing git repositories, but also in any new repository
that you ‘init’ or ‘clone’
Pre-hooks:
Post-hooks:
Rohit K Singh
Single Project Installation Talisman works on pattern matching:
Encoded Values
Talisman will be present only in a single git repository File Content
File Size
Pre-push hooks: Entropy
Credit Card Number
File Name
Rohit K Singh
HELM
Rohit K Singh
• Helm charts are packages (like rpms) It contains pre-configured
Kubernetes resources such as
• ConfigMaps
• Deployments
• Services
• Helm is the package manager for Kubernetes (like yum) that allows easily
package, configure, and deploy applications onto Kubernetes clusters
Architecture:
Helm installs charts into Kubernetes, creating a new release for each installation. And to find new
charts, you can search Helm chart repositories.
• Repository is the place where charts can be collected and shared.
• Chart is a Helm package. It contains all of the resource definitions necessary to run an application on
Kubernetes Cluster
• Release is an instance of a chart running in a Kubernetes cluster
Installation:
• export VERIFY_CHECKSUM=false
• curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
• helm version Rohit K Singh
ISTIO
Rohit K Singh
Istio is an open framework for connecting, securing, managing and monitoring microservices
What makes Istio so unique is that all these functionalities come with NO CHANGE OF
CODE required.
Rohit K Singh
Architecture:
Rohit K Singh
MONITORING
Rohit K Singh
Kubernetes has the potential to simplify the process of deploying your application in containers and
across clouds, but in doing so, it leaves you blind as to,
• what is actually happening,
• what resources are being utilized
Rohit K Singh