vpn intro by dongshuzhao

33
A VPN System with User Authentication and Bandwidth Control 董淑照 Dong Shuzhao Harbin Institute of Technology at Weihai [email protected] Oct. 9, 2010 OpenSalon Conference 2

Upload: fantasy-zheng

Post on 21-Jan-2015

1.872 views

Category:

Documents


0 download

DESCRIPTION

@dongshuzhao同学的vpn系统介绍

TRANSCRIPT

Page 1: Vpn intro by dongshuzhao

A VPN Systemwith User Authenticationand Bandwidth Control

董淑照Dong Shuzhao

Harbin Institute of Technology at [email protected]

Oct. 9, 2010

OpenSalonConference 2

Page 2: Vpn intro by dongshuzhao

Introduction to VPN

Page 3: Vpn intro by dongshuzhao

What is VPN?

Page 4: Vpn intro by dongshuzhao

What is VPN?

A virtual private network (VPN) is a computer network that uses a public telecommunication infrastructure such as the Internet to provide remote offices or individual users with secure access to their organization's network.

Page 5: Vpn intro by dongshuzhao

What is VPN?

An IP tunnel between hosts or routers to extend the reach of a subnet. The tunnel may be encrypted. Tunnel creation may need authentication process. Traffic may be subject to accounting, logging and

firewalling.

Page 6: Vpn intro by dongshuzhao

Use of VPN

Remote intranet access For companies, schools

Data encryption Public networks, Wi-fi

Access control within intranet Network authentication

Page 7: Vpn intro by dongshuzhao

VPN Solutions

PPTP Point-to-Point Tunneling Protocol Security vulnerabilities

L2TP Layer 2 Tunneling Protocol Improvement of PPTP

SSL VPN OpenVPN Totally application layer protocol

Page 8: Vpn intro by dongshuzhao

Principles of GFW

Page 9: Vpn intro by dongshuzhao

Principles of GFW

IP Block DNS Tampering DNS Pollution Content Filtering ...

Page 10: Vpn intro by dongshuzhao

IP Block

twitter.com 128.242.240.20

Page 11: Vpn intro by dongshuzhao

IP Block

Weakness Change of IP address Dynamic IP

Solution Change a secure DNS server Modify 'hosts' file

Page 12: Vpn intro by dongshuzhao

DNS Tampering

Page 13: Vpn intro by dongshuzhao

DNS Tampering

Weakness Only control of DNS servers in Chinese mainland

Solution Change to a foreign DNS server

Page 14: Vpn intro by dongshuzhao

DNS Pollution

Page 15: Vpn intro by dongshuzhao

DNS Pollution

Page 16: Vpn intro by dongshuzhao

DNS Pollution

Weakness ?

Solution ?

Page 17: Vpn intro by dongshuzhao

Content Filtering

Page 18: Vpn intro by dongshuzhao

Content Filtering

Weakness ?

Solution ?

Page 19: Vpn intro by dongshuzhao

VPN & GFW

Page 20: Vpn intro by dongshuzhao

VPN & GFW

Page 21: Vpn intro by dongshuzhao

VPN with Routing Table

Page 22: Vpn intro by dongshuzhao

VPN with Routing Table

chnroutes http://code.google.com/p/chnroutes/

Distinguishing lines Chinese (mainland) IPs: original route Foreign Ips: via VPN

Page 23: Vpn intro by dongshuzhao

Implementation of VPN System

Page 24: Vpn intro by dongshuzhao

System Overview

Page 25: Vpn intro by dongshuzhao

Distributed Structure

Page 26: Vpn intro by dongshuzhao

Database Schema

Page 27: Vpn intro by dongshuzhao

User Authentication

saslauthd pam-mysql /etc/pam.d/openvpn DB Fields: username, password, active

OpenVPN PAM plugin

PPTP VPN pppd-sql http://freshmeat.net/projects/pppd-sql

Page 28: Vpn intro by dongshuzhao

Logging

Script hook connect.sh

Create a new record with begin time, ip, port, etc. disconnect.sh

Fill back previous record with end time, bandwidth usage, etc.

Page 29: Vpn intro by dongshuzhao

Bandwidth Control

disconnect.sh Check log and set active to 0 if bandwidth limit

exceeded Lock expired users

cron /etc/cron.hourly/openvpn Unlock users whose bandwidth roll back Lock expired users

Page 30: Vpn intro by dongshuzhao

VPN Control Panel

PHP jQuery

flexigrid

Page 31: Vpn intro by dongshuzhao

Mailing System

DNS MX Record Sendmail (or Exim, Qmail...)

Sending in Shell login alerts, bandwidth alerts, expiration alerts

Sending in PHP password alerts, invitations, password reset mail() function in PHP

Page 32: Vpn intro by dongshuzhao

Further Improvements

P2P Prevention Kernel modules

Real-time User Management Killing an online user Disconnect immediately after bandwidth run out

Billing System Paypal Interface Alipay Interface

Page 33: Vpn intro by dongshuzhao

THE END