What is
VPN?
Virtual private network provide secure communication over
unsecured network (internet).
It secures communication by using:
1.
Authentication
2.
Confidentiality
3.
Data Integrity
4.
Anti-replay
Types of VPN:
1.
Remote Access VPN:
It allow user to
connect to a private network and access its services and resources remotely.
The connection between the user and the private network happens through the
Internet and the connection is secure and private. It is supported by SSL and
IPSEC.
2.
Site to Site VPN:
It allow to
established secure connection between two sites over unsecured medium. IPSEC is
commonly used for S2S VPN.
Types
of VPN protocol:
PPTP
L2TP
IPSEC
SSL
MPLS VPN
What is
Authentication, Confidentiality & Integrity?
Authentication - Verifies that the packet received is actually
from the claimed sender. It verifies the authenticity of sender. Pre-shared
Key, Digital Certificate is some methods that can be used for authentication.
Integrity - It make sure that packet do not get temper or modify
in transit. Hashing Algorithm includes MD5, SHA.
Confidentiality - it provide encryption so that data is not
disclosed to unauthorized parties, only authorized party can decrypt it.
Encryption algorithms include DES (Data Encryption Standard), 3DES
(Triple-DES), AES (Advanced Encryption Standard).
What is
Symmetric and Asymmetric Encryption?
In symmetric encryption, a single key is used both to encrypt
and decrypt traffic. It is also referred as shared key or shared secret
encryption. Symmetric encryption algorithms include DES, 3DES, AES.
In Asymmetric encryption two keys are used to encrypt and
decrypt traffic, one for encryption and one for decryption. The most common
asymmetric encryption algorithm is RSA.
What is
IPSEC?
IPSEC is suite of protocol that provide Authentication,
Confidentiality, Data integrity and anti replay. IPSEC has two modes:
Transport
mode
Tunnel
mode
IPSEC support ESP and AH protocol.
What is
IKE/ISAKMP?
ISAKMP defines the procedures for authenticating a communicating
peer, creation and management of Security Associations, key generation
techniques and threat mitigation (e.g. denial of service and replay attacks).
ISAKMP use UDP port 500 and 4500 for communication.
IKE has
two phases:
Phase-I: it is
use to authenticate the peer, generate the shared secret key and build phase-1
tunnel.
It also protects the negotiation of phase 2 communication. At
the end of phase 1, a bidirectional SA (phase 1 SA) is established for IKE
communication.
There
are two modes in IKE phase 1:-
Main
mode - Total Six messages are exchanged in main mode for
establishing phase 1 SA.
Aggressive
mode - It is faster than the main mode as only three messages are
exchanged in this mode to establish phase 1 SA. It is faster but less secure
since identity revel in very first packet.
Phase-II: it is
where actual data get encrypt and decrypt.
Phase-II negotiate it all parameter under phase I tunnel. At the
end of phase II unidirectional SA formed for inbound and outbound
communications.
Phase-II has one mode which is quick mode.
Quick
mode - In this mode three messages are exchanged to establish the
phase 2 IPSec SA.
At what
layer IPsec works?
Layer 3 of the OSI model.
Explain
phase-I and Phase-II message exchange?
Phase I
Main Mode:
IKE Phase 1 operating in main mode works with both parties exchanging
a total of 6 packets.
1. The
first packet is sent from the initiator of the IPSec tunnel to its remote
endpoint, this packet contains the ISAKMP policy
2. The
second packet is sent from the remote endpoint back to the initiator, this
packet will be the exact same information matching the ISAKMP policy sent
by the initiator.
3. The
third packet is sent from the initiator to the remote endpoint, this packet
contains the Key Exchange payload and the Nonce payload, the purpose of this
packet is generate the information for the DH secret key
4. This
fourth packet as you would expect comes from the remote endpoint back to
initiator and contains the remote endpoints Key Exchange and Nonce payload.
5. The
fifth packet is from the initiator back to the remote endpoint with identity and
hash payloads, the identity payload has the device’s IP Address in, and the
hash payload is a combination of keys (including a PSK, if PSK authentication
is used)
6. The
sixth packet from the remote endpoint to the initiator contains the
corresponding hash payloads to verify the exchange.
Phase 2
- Quick Mode
All messages in Quick mode are encrypted.
- Perfect Forward Secrecy PFS, if PFS is configured on both endpoints the will generate a new DH key for phase 2/quick mode.
1. Contained
in this first packet from the initiator to the remote device are some of the
hashes/keys negotiated from phase 1, along with some IPSec parameters IE:
Encapsulation (ESP or AH), HMAC, DH-group, and the mode (tunnel or transport)
2. The
second packet contains the remote endpoint’s response with matching IPSec
parameters.
3. The
last packet is sent to the remote device to verify the other device is still
there and is an active peer.
What is
Diffie-Hellman?
DH is a public-key cryptography protocol which allows two
parties to establish a shared secret over an insecure communications channel.
Diffie-Hellman is used within IKE to establish session keys and is a component
of Oakley.
How
Diffie-Hellman works?
Each side have a private key which is never passed and a
Diffie-Hellman Key (Public Key used for encryption). When both side wants to do
a key exchange they send their Public Key to each other. for example Side A get
the Public Key of Side B, then using the RSA it creates a shared key which can
only be opened on Side B with Side B's Private Key So, even if somebody
intercepts the shared key he will not be able to do reverse engineering to see
it as only the private key of Side B will be able to open it.
What is
the difference between Transport and Tunnel mode?
Tunnel
mode - Protects data in network-to-network or site-to-site scenarios.
It encapsulates and protects the entire IP packet and add new IP header.
Transport
mode - Protects data in host-to-host communications. In transport mode,
IPSec protects the payload of the original IP datagram by excluding the IP
header.
IPSec protocols AH and ESP can operate in either transport mode
or tunnel mode.
Explain
IPsec Protocol?
Encapsulating
Security Payload (ESP) - It is an IP-based protocol which uses port
50 for communication between IPsec peers. ESP is used to protect the
confidentiality, integrity and authenticity of the data and offers anti-replay
protection.
Drawback - ESP does not provide protection to the outer IP
Header
Authentication
Header (AH) - It is also an IP-based protocol that uses port 51 for
communication between IPsec peers. AH is used to protect the integrity and
authenticity of the data and offers anti-replay protection.
Unlike ESP, AH provides protection to the IP header also.
Drawback - AH does not provide confidentiality protection and it
can not be use when VPN is behind the NAT device since it provide
authentication for whole header(including IP).
What is
anti-replay protection?
Both ESP and AH protocols provide an anti-reply protection based
on sequence numbers. The sender increments the sequence number after each transmission
and the receiver checks the sequence number and reject the packet if it is out
of sequence.
Why
can't an ESP packet pass through a PAT device?
It is precisely because ESP is a protocol without ports that
prevents it from passing through PAT devices. Because there is no port to
change in the ESP packet, the binding database can't assign a unique port to
the packet at the time it changes its RFC 1918 address to the publically
routable address. If the packet can't be assigned a unique port then the
database binding won't complete and there is no way to tell which inside host
sourced this packet. As a result there is no way for the return traffic
to be untranslated successfully.
How
does NAT-T work with ISAKMP/IPSec?
NAT Traversal performs two tasks:
1.
Detects if both ends support NAT-T
2.
Detects NAT devices along the transmission path (NAT-Discovery)
Step one occurs in ISAKMP Main Mode messages one and two.
If both devices support NAT-T, then NAT-Discovery is performed in ISKAMP Main
Mode messages (packets) three and four. The NAT-D payload sent is a hash
of the original IP address and port. Devices exchange two NAT-D packets, one
with source IP and port, and another with destination IP and port. The
receiving device recalculates the hash and compares it with the hash it
received; if they don't match a NAT device exists.
If
a NAT device has been determined to exist, NAT-T will change the ISAKMP
transport with ISAKMP Main Mode messages five and six, at which point all
ISAKMP packets change from UDP port 500 to UDP port 4500.
NAT-T encapsulates the Quick Mode (IPsec Phase 2) exchange
inside UDP 4500 as well. After Quick Mode completes data that gets
encrypted on the IPsec Security Association is encapsulated inside UDP port
4500 as well, thus providing a port to be used in the PAT device for
translation.
When a packet with source and destination port of 4500 is sent
through a PAT device (from inside to outside), the PAT device will change the
source port from 4500 to a random high port, while keeping the destination port
of 4500. When a different NAT-T session passes through the PAT device, it will
change the source port from 4500 to a different random high port, and so on.
This way each local host has a unique database entry in the PAT devices mapping
its RFC1918 ip address/port4500 to the public ip address/high-port.
What is
the difference between NAT-T and IPSec-over UDP?
When NAT-T is enabled, it encapsulates the ESP packet with UDP
only when it encounters a NAT device. Otherwise, no UDP encapsulation is done.
But, IPSec Over UDP, always encapsulates the packet with UDP.
NAT-T always use the standard port, UDP-4500. It is not
configurable. IPSec over UDP normally uses UDP-10000 but this could be any
other port based on the configuration on the VPN server.
What is
GRE?
Generic Routing Encapsulation Protocol is a tunneling protocol
developed by Cisco designed to encapsulate IP unicast, multicast and broadcast
packets. It uses IP protocol number 47.
Which protocol
and ports are need to
allowed when IPEC VPN traffic passing through firewall which is placed between
VPN peer?
Protocol: ESP,AH
Port: UDP 500/4500
Differences
between IKEv1and IKEv2?
1.
IKEV1 need to exchange 9 packets to build IPSEC SA whereas IKEv2
required only 4 packets exchange.
2.
There is no mode(main mode, aggressive mode) in IKEv2
3.
In built NAT-T,dead peer detection in IKEV2.
4.
DOS protection IN IKEv2
5.
EAP auth supported in IKEv2
6.
In IKEv2 Informational messages have to be acknowledged. This
should address some synchronization issues we saw with IKEv1
7.
Asymmetric authentication supported in ikev2 . E.G. we can authenticate our self with
pre-shared-key and authenticate peer with certificates.
What is
SA?
SA is an agreement or a contract between two IPSec peers or
endpoints. The SA contains all the information required for the two peers to
exchange data securely.
What is
route based VPN and policy based VPN?
A route based VPN creates a virtual IPSec interface (tunnel
interface), and whatever traffic hits that interface is encrypted and decrypted
according to the phase 1 and phase 2 IPSec settings.
In policy based VPN the tunnel is specified within the policy
itself with an action of "IPSec".
A route based VPN only works in route mode, where policy based
VPN works in both route and transparent mode.
What is
split tunneling and full tunneling?
Split tunneling encrypts only traffic which is allowed through
VPN and rest of traffic will send unencrypted.
Full tunnel encrypts all traffic, in that case you will not able
to access your local resources.
What is
RRI?
Reverse route injection (RRI) is the ability for static routes
to be automatically inserted into the routing process for those networks and
hosts that are protected by a remote tunnel endpoint.
Each route is created on the basis of the remote proxy network
and mask, with the next hop to this network being the remote tunnel endpoint
What is
SSL VPN?
It provides remote access connectivity from internet enabled device through a standard web browser. It does not require any special client software at a remote site.
It provides remote access connectivity from internet enabled device through a standard web browser. It does not require any special client software at a remote site.
It uses TCP port 443 and work between application layer and transport
layer.
Types of
SSL VPN:
1.Clientless mode –
Clientless mode provides secure access to web resources and
web-based applications. It does not provide access to TCP connections such as
SSH or Telnet.
2. Thin client mode –
Thin client mode provides remote access to TCP-based services
such as Telnet, SSH, SMTP etc. applications. Thin client is delivered via a
Java applet that is dynamically downloaded from the SSL VPN appliance upon
session establishment.
3.
Thick client mode –
It works at Layer 3 and is also known as tunnel mode or full
tunneling client. It is like IPSEC remote access where we can access allowed
network ranges.
Explain
SSL Handshake?
1.Client initiates by sending a CLIENT HELLO message which contains SSL version that the client supports, in what order the client prefer the versions, Ciphersuits (Cryptographic Algorithms) supported by the client, Random Number.
2.Server will send back a SERVER HELLO message Which contains Version Number (Server selects SSL version that is supported by both the server and the client), Cipher Suits (selected by server the best cipher suite version that is supported by both of them), Session ID, Random Data.
3.Server also sends PKI certificate for authenticating himself signed and verified by Certificate Authority along with the public key for encryption.
4.Server will than send Server Hello Done indicating that the server has finished sending its hello message, and is waiting for a response from the client.
5.Client will sends its certificate if the server has also requested for client authentication in server hello message.
6.Client will sends Client Key Exchange message after calculating the premaster secret with the help of the random values of both the server and the client. This message is sent by encrypting it with the server's public key which was shared through the hello message.
Server will decrypt the premaster secret with its private key. Now both client and server will perform series of steps to generate session keys (symmetric) which will be used for encryption and decryption of data exchanges during SSL session and also to verify its integrity.
7. Client will send CHANGE CIPHER SUITE message informing the server that future messages will be encrypted using session key.
8. Client will send CLIENT FINISH (DONE) message indicating that client is done.
9. Server will also send CHANGE CIPHER SUITE message.
10.Server will also send SERVER FINISH (DONE) message
1.Client initiates by sending a CLIENT HELLO message which contains SSL version that the client supports, in what order the client prefer the versions, Ciphersuits (Cryptographic Algorithms) supported by the client, Random Number.
2.Server will send back a SERVER HELLO message Which contains Version Number (Server selects SSL version that is supported by both the server and the client), Cipher Suits (selected by server the best cipher suite version that is supported by both of them), Session ID, Random Data.
3.Server also sends PKI certificate for authenticating himself signed and verified by Certificate Authority along with the public key for encryption.
4.Server will than send Server Hello Done indicating that the server has finished sending its hello message, and is waiting for a response from the client.
5.Client will sends its certificate if the server has also requested for client authentication in server hello message.
6.Client will sends Client Key Exchange message after calculating the premaster secret with the help of the random values of both the server and the client. This message is sent by encrypting it with the server's public key which was shared through the hello message.
Server will decrypt the premaster secret with its private key. Now both client and server will perform series of steps to generate session keys (symmetric) which will be used for encryption and decryption of data exchanges during SSL session and also to verify its integrity.
7. Client will send CHANGE CIPHER SUITE message informing the server that future messages will be encrypted using session key.
8. Client will send CLIENT FINISH (DONE) message indicating that client is done.
9. Server will also send CHANGE CIPHER SUITE message.
10.Server will also send SERVER FINISH (DONE) message








