This blog explores data science and networking, combining theoretical concepts with practical implementations. Topics include routing protocols, network operations, and data-driven problem solving, presented with clarity and reproducibility in mind.
Protecting access and securing users in modern web applications
When building a web application, some parts of your site must be protected.
Whether it’s an e-commerce platform, a social network, or a blog,
users often need to log in to access specific features.
Django handles this through two critical concepts:
authentication and authorization.
Authentication vs Authorization
๐ Authentication — Who are you?
Authentication is the process of verifying a user’s identity.
When a user logs in with a username and password,
Django checks whether those credentials are valid.
Think of authentication as proving who you are.
๐ Authorization — What are you allowed to do?
Authorization happens after authentication.
Once Django knows who the user is,
it checks whether they have permission to access a resource or perform an action.
Think of authorization as checking what doors you’re allowed to open.
Sessions are critical in web applications to maintain user state across multiple requests.
Without sessions, every request would be stateless, making authentication and personalization impossible.
Django provides three powerful session storage mechanisms:
File-based storage
Database storage
Cache storage
1. File-Based Sessions
๐ How It Works
Django stores session data as files on disk. Each session = one file.
Django’s session framework provides flexible and powerful ways to manage user data.
Choosing the right backend depends on your scalability, performance, and reliability needs.
Start simple, and evolve your session strategy as your application grows.
Active/Active Failover and Asymmetric Routing in Cisco ASA Post-9.7
Active/Active Failover and Asymmetric Routing in Cisco ASA Post-9.7
Modern enterprise networks demand high availability, performance, and scalability.
One architecture increasingly used to achieve these goals is the Active/Active firewall design.
However, Active/Active designs introduce challenges — the most important being asymmetric routing.
This guide explains:
What asymmetric routing is
Why it causes issues in stateful firewalls
How Cisco ASA historically handled the problem
Major improvements introduced after ASA version 9.7
Asymmetric routing occurs when traffic between two hosts travels along different paths for the forward and return directions.
Example:
Client → Firewall A → Server
Server → Firewall B → Client
In a traditional network this may not be a problem.
However, for stateful firewalls like Cisco ASA, this becomes critical because the firewall must maintain a session table.
๐ก Key Concept
Stateful firewalls track every connection. If return traffic reaches a firewall that did not see the original packet, the firewall will drop the packet.
Why Asymmetric Routing Causes Problems
In an Active/Active firewall environment:
Multiple firewalls process traffic simultaneously
Traffic can enter through one firewall and exit through another
Session state may not exist on the receiving firewall
When the return packet arrives on the wrong firewall:
%ASA-6-302013: Built inbound TCP connection
%ASA-4-106023: Deny tcp src outside...
The firewall drops the packet because it does not recognize the session.
Traditional Solution: ASR Groups (Asynchronous Routing Groups)
Older Cisco ASA deployments solved this issue using ASR Groups.
ASR Groups allowed multiple ASA units to share session state information.
Expand to see how ASR groups work
When a firewall receives a packet without a matching session:
The firewall checks ASR state synchronization
If the session exists on another unit
The packet is redirected to the correct firewall
The Layer 2 header is rewritten
Example Configuration
Example configuration for enabling ASR groups.
Configuration Code
failover
failover lan unit primary
failover lan interface FO GigabitEthernet0/3
failover link STATE GigabitEthernet0/4
failover group 1
primary
Major ASA Enhancements After Version 9.7
Cisco introduced multiple improvements starting with ASA version 9.7.
These enhancements significantly improved asymmetric routing handling and simplified firewall operations.
Enhanced session management
Context-aware routing
Better BGP integration
Simplified configuration
Dynamic load balancing
1. Enhanced Session Management
Modern ASA versions use improved session synchronization between firewalls.
Instead of relying only on ASR groups:
Sessions replicate faster
Synchronization occurs across contexts
Packet drops are reduced
CLI Verification Example
show conn
show failover
show asp table session
๐ก Key Takeaway
Enhanced session replication ensures return packets are recognized even when traffic paths change.
2. Context-Aware Routing
Context-aware routing allows the firewall to make routing decisions using more than just routing tables.
ASA now evaluates:
Application state
User identity
Security context
Session state
CLI Monitoring Example
show route
show conn detail
show service-policy
3. Improved BGP Handling
Enterprises often connect to multiple ISPs using BGP.
Earlier ASA versions struggled when return traffic arrived through a different ISP.
Post-9.7 ASA introduces:
Improved BGP route handling
Better path awareness
Stable failover behavior
Example BGP Verification
show bgp summary
show bgp neighbors
show route bgp
4. Simplified Configuration and Management
Cisco redesigned several configuration workflows after ASA 9.7.
Key improvements include:
Simplified NAT configuration
Improved ACL management
Better monitoring tools
Reduced dependency on ASR groups
Useful Monitoring Commands
show failover state
show conn count
show asp drop
5. Dynamic Load Balancing
Dynamic load balancing distributes traffic intelligently across firewalls.
Benefits include:
Higher throughput
Better firewall utilization
Reduced packet drops
Improved redundancy
๐ก Key Takeaway
Dynamic traffic distribution helps maintain symmetric traffic flows and improves overall firewall efficiency.
Conclusion
Active/Active firewall architectures provide excellent scalability and high availability but introduce routing complexities.
Cisco ASA improvements after version 9.7 significantly improve the handling of asymmetric routing through:
Advanced session management
Context-aware routing
Enhanced BGP handling
Simplified configuration workflows
Dynamic load balancing
By leveraging these modern capabilities, network administrators can deploy resilient and scalable firewall architectures while minimizing connectivity disruptions.
HTTP Statelessness and Session Management Complete Guide
HTTP Statelessness and Session Management Complete Guide
Modern web applications depend heavily on communication between clients and servers. Whether you are browsing an e-commerce website, logging into a social media platform, streaming videos, or using an online banking system, all these interactions rely on HTTP communication.
At the center of web communication lies the Hypertext Transfer Protocol (HTTP), which acts as the foundation for data transfer across the internet.
However, HTTP has one important limitation:
$$
HTTP \ is \ Stateless
$$
This means the server does not automatically remember previous requests from users.
$$
Response_n \ independent \ of \ Response_{n-1}
$$
Session Model
$$
Response_n = f(Request_n, SessionData)
$$
Network Latency
$$
Latency = ResponseTime - RequestTime
$$
Scalability Formula
$$
Performance \propto \frac{1}{ServerLoad}
$$
12. Security Considerations
Major Security Risks
Session hijacking
Cross-site scripting
CSRF attacks
Cookie theft
Security Best Practices
Practice
Purpose
HTTPS
Encrypt traffic
Secure Cookies
Protect sessions
JWT Tokens
Authentication
Expiration Policies
Limit session abuse
Authentication Formula
$$
ValidToken \Rightarrow AccessGranted
$$
13. Real World Applications
E-Commerce
Shopping carts
User logins
Payment sessions
Social Media
Persistent authentication
Realtime messaging
Notifications
Banking
Secure sessions
Transaction management
Authentication systems
IoT Systems
Device communication
Realtime monitoring
MQTT protocols
14. Conclusion
HTTP is the foundation of communication on the modern web, but its stateless nature creates challenges for applications that require continuity and personalization.
To overcome this limitation, developers use:
Cookies
Sessions
URL rewriting
Hidden form fields
REST APIs
WebSockets
Cloud services like Firebase
Understanding these technologies is essential for building scalable, secure, and user-friendly applications.