What is mTLS?
Mutual TLS is a method for mutual authentication ensuring that both client and server are who they claim to be.
Why would you need mTLS compared to other authentication solutions?
mTLS is useful for applications or devices that do not follow a login process. It also serves as an additional layer of security for an organization’s network or applications where a Zero Trust approach - which does not trust any user, device, or request by default - is necessary.
How does mTLS work?
mTLS works with the following:
What is TLS?
An encryption protocol in wide use on the Internet, formerly called SSL, that authenticates the server in a client server connection and encrypts communications between client and server.
How does TLS (SSL) work?
A TSL certificate is issued to a server by a certificate authority. The certificate contains a public key, a statement of who issued the cert, and expiration date.
TLS works via the process of a handshake:
1. Client connects to server
2. Server presents TLS cert
3. Client verifies cert with cert authority
4. Client and server exchange information over a connected encrypted by the public key, which only the server can decrypt with its private key.
What does mTLS prevent?
On-path attacks, spoofing attacks, credential stuffing, brute force attacks, Phishing attacks, malicious API requests
What is an on-path attack?
On-path attacks, also known as man-in-the-middle attacks, are a type of cybersecurity threat that occurs when an attacker positions themselves between two devices and intercepts or modifies the communication between them
What does SSH stand for?
Secure shell protocol
How does SSH authentication work?
Using a public private key pair and a handshake process when the following steps:
What is an ssh agent?
A helper program that keeps track of users’ identities and their passphrases.
What is the ssh-keygen command
It is a command used to generate a public private key pair.
What is open SSH?
An open source implementation of the SSH protocol.
What are the different algorithms used to encrypt an SSH key?
id_rsa (the default RSA algorithm), id_dsa, or id_ecdsa.
What are some popular use cases of SSH
Example:
ssh user@server-ip
Using tools built on SSH:
• SCP (Secure Copy Protocol)
• SFTP (SSH File Transfer Protocol)
Example:
scp file user@server:/path/
SSH can forward traffic securely through an encrypted channel.
Local port forwarding (reach internal services on a remote machine)
ssh -L 8080:localhost:80 user@server
Remote port forwarding (expose a local service to a remote machine)
ssh -R 9000:localhost:3000 user@server
Use cases:
• Access private DBs safely
• Bypass firewalls
• Securely route traffic
Why use SSH over another protocol?
Use SSH when you want passwordless authentication backed by asymmetric keys stored on your device. It’s ideal on trusted machines because your private key never leaves the laptop, and pushing code becomes frictionless. SSH avoids long-lived tokens or repeated credential entry, while still using a secure, encrypted channel like HTTPS.
Difference between Authentication (AuthN) and Authorization (AuthZ)
DEFINITION: AuthN verifies identity (Who are you?). AuthZ verifies permissions (What can you do?).
STRATEGY: Handle AuthN first (logging in), then AuthZ (checking if that user is an admin).
IMPLEMENTATION:
- AuthN: User POSTs credentials to /login. Server validates hash, returns a JWT.
- AuthZ: User requests GET /admin. Middleware decodes JWT, checks roles: [‘admin’]. If missing, returns 403 Forbidden.
Three common ‘factors’ of authentication
DEFINITION: 1. Knowledge (Password), 2. Possession (Phone/Token), 3. Inherence (Biometrics).
STRATEGY: Require 2 factors from DIFFERENT categories for MFA.
IMPLEMENTATION:
1. User enters password (Knowledge). Server stores partial session.
2. Server sends SMS code (Possession).
3. User submits code. Server upgrades session to authenticated.
Hashing vs. Encryption for passwords
DEFINITION: Hashing is one-way (irreversible). Encryption is two-way (reversible). Passwords must be hashed.
STRATEGY: Even if DB is stolen, attackers cannot reverse hashes to login.
IMPLEMENTATION:
- Signup: hash = bcrypt.hash(password, 10). Store hash.
- Login: bcrypt.compare(input, stored_hash). Re-hashes input and checks for match.
What is ‘Salting’?
DEFINITION: Adding a random string to a password before hashing.
STRATEGY: Prevents Rainbow Table attacks (pre-computed hash lists).
IMPLEMENTATION:
Libraries like bcrypt handle this auto-magically. They generate a random salt, prepend it to the password, hash it, and store the salt inside the final string.
Which hashing algorithms are safe/unsafe?
DEFINITION: Safe: bcrypt, Argon2, scrypt (Slow). Unsafe: MD5, SHA-1 (Fast).
STRATEGY: Use slow algorithms (~500ms) to make brute-forcing expensive.
IMPLEMENTATION:
Configure ‘Work Factor’ (e.g., Argon2 iterations=3, memory=64MB) to force the CPU to work hard for every single login attempt.
Difference between Authentication (AuthN) and Authorization (AuthZ)
DEFINITION: AuthN verifies identity (Who are you?). AuthZ verifies permissions (What can you do?).
STRATEGY: Handle AuthN first (logging in), then AuthZ (checking if that user is an admin).
IMPLEMENTATION:
- AuthN: User POSTs credentials to /login. Server validates hash, returns a JWT.
- AuthZ: User requests GET /admin. Middleware decodes JWT, checks roles: [‘admin’]. If missing, returns 403 Forbidden.
Three common ‘factors’ of authentication
DEFINITION: 1. Knowledge (Password), 2. Possession (Phone/Token), 3. Inherence (Biometrics).
STRATEGY: Require 2 factors from DIFFERENT categories for MFA.
IMPLEMENTATION:
1. User enters password (Knowledge). Server stores partial session.
2. Server sends SMS code (Possession).
3. User submits code. Server upgrades session to authenticated.
Hashing vs. Encryption for passwords
DEFINITION: Hashing is one-way (irreversible). Encryption is two-way (reversible). Passwords must be hashed.
STRATEGY: Even if DB is stolen, attackers cannot reverse hashes to login.
IMPLEMENTATION:
- Signup: hash = bcrypt.hash(password, 10). Store hash.
- Login: bcrypt.compare(input, stored_hash). Re-hashes input and checks for match.
What is ‘Salting’?
DEFINITION: Adding a random string to a password before hashing.
STRATEGY: Prevents Rainbow Table attacks (pre-computed hash lists).
IMPLEMENTATION:
Libraries like bcrypt handle this auto-magically. They generate a random salt, prepend it to the password, hash it, and store the salt inside the final string.