Open*** 實戰4:Open*** 配置文件詳解

說明:此Open***的配置文件詳解,是在原有的配置文件的基礎上進行相關翻譯與說明(大多是自己的理解),若有不正確的地方歡迎大家指出與交流。


#################################################  
# Sample Open*** 2.0 config file for            #    
# multi-client server.                          #    
#                                               #    
# This file is for the server side              #    
# of a many-clients <-> one-server              #    
# Open*** configuration.                        #    
#                                               #    
# Open*** also supports                         #    
# single-machine <-> single-machine             #    
# configurations (See the Examples page         #    
# on the web site for more info).               #    
#                                               #    
# This config should work on Windows            #    
# or Linux/BSD systems.  Remember on            #    
# Windows to quote pathnames and use            #    
# double backslashes, e.g.:                     #    
# "C:\\Program Files\\Open***\\config\\foo.key" #    
#                                               #    
# Comments are preceded with '#' or ';'         #    
#################################################

注,#號和;號開頭的都是註釋。


# Which local IP address should Open***  
# listen on? (optional)    
#設置監聽 IP,默認是監聽所有 IP


;local a.b.c.d

# Which TCP/UDP port should Open*** listen on?  
# If you want to run multiple Open*** instances    
# on the same machine, use a different port    
# number for each one.  You will need to    
# open up this port on your firewall.  


#Open*** 服務器監聽端口
port 1194

# TCP or UDP server?  


#設置用TCP還是UDP協議?
;proto tcp    
proto udp

# "dev tun" will create a routed IP tunnel,  
# "dev tap" will create an ethernet tunnel.    
# Use "dev tap0" if you are ethernet bridging    
# and have precreated a tap0 virtual interface    
# and bridged it with your ethernet interface.    
# If you want to control access policies    
# over the ***, you must create firewall    
# rules for the the TUN/TAP interface.    
# On non-Windows systems, you can give    
# an explicit unit number, such as tun0.    
# On Windows, use "dev-node" for this.    
# On most systems, the *** will not function    
# unless you partially or fully disable    
# the firewall for the TUN/TAP interface.  

 
# 設置創建 tun 的路由 IP 通道,還是創建 tap 的以太網通道    
# 路由 IP 通道一般容易控制,所以推薦使用它;但如果如 IPX 等必須      
# 使用第二層才能通過的通訊,則可以用 tap 方式,tap 也      
# 就是以太網橋接

;dev tap    
dev tun

# Windows needs the TAP-Win32 adapter name  
# from the Network Connections panel if you    
# have more than one.  On XP SP2 or higher,    
# you may need to selectively disable the    
# Windows firewall for the TAP adapter.    
# Non-Windows systems usually don't need this.  

 
# 在Windows上如果你更多的網絡接口,你需要在網絡連接控制面板上增加    
# TAP-Win32適配器接口名      
# 在XP SP2或更高系統上,你需要使windows防火牆對該接口不執行過濾規則      
# 非Windows系統通常不需要設置這個(注,這個是直譯的,嘿嘿

;dev-node MyTap

# SSL/TLS root certificate (ca), certificate  
# (cert), and private key (key).  Each client    
# and the server must have their own cert and    
# key file.  The server and all clients will    
# use the same ca file.    
#    
# See the "easy-rsa" directory for a series    
# of scripts for generating RSA certificates    
# and private keys.  Remember to use    
# a unique Common Name for the server    
# and each of the client certificates.    
#    
# Any X509 key management system can be used.    
# Open*** can also use a PKCS #12 formatted key file    
# (see "pkcs12" directive in man page).    


# 這裏是重點,必須指定 SSL/TLS root certificate (ca),    
# certificate(cert), and private key (key)      
# ca 文件是服務端和客戶端都必須使用的,但不需要 ca.key      
# 服務端和客戶端指定各自的.crt 和.key      
# 請注意路徑,可以使用以配置文件開始爲根的相對路徑,      
# 也可以使用絕對路徑      
# 請小心存放.key 密鑰文件

ca ca.crt    
cert server.crt    
key server.key  # This file should be kept secret

# Diffie hellman parameters.  
# Generate your own with:    
#   openssl dhparam -out dh1024.pem 1024    
# Substitute 2048 for 1024 if you are using    
# 2048 bit keys.    


# 指定 Diffie hellman parameters(密鑰交換算法協議).
dh dh1024.pem

# Configure server mode and supply a *** subnet  
# for Open*** to draw client addresses from.    
# The server will take 10.8.0.1 for itself,    
# the rest will be made available to clients.    
# Each client will be able to reach the server    
# on 10.8.0.1. Comment this line out if you are    
# ethernet bridging. See the man page for more info.  

 
# 配置 *** 使用的網段,Open*** 會自動提供基於該網段的 DHCP    
# 服務,但不能和任何一方的局域網段重複,保證唯一      
# server 端 ip 默認會設爲10.8.0.1的地址。      
server 10.8.0.0 255.255.255.0

# Maintain a record of client <-> virtual IP address  
# associations in this file.  If Open*** goes down or    
# is restarted, reconnecting clients can be assigned    
# the same virtual IP address from the pool that was    
# previously assigned.    


# 維持一個客戶端和 virtual IP 的對應表,以方便客戶端重新    
# 連接可以獲得同樣的 IP

ifconfig-pool-persist ipp.txt

# Configure server mode for ethernet bridging.  
# You must first use your OS's bridging capability    
# to bridge the TAP interface with the ethernet    
# NIC interface.  Then you must manually set the    
# IP/netmask on the bridge interface, here we    
# assume 10.8.0.4/255.255.255.0.  Finally we    
# must set aside an IP range in this subnet    
# (start=10.8.0.50 end=10.8.0.100) to allocate    
# to connecting clients.  Leave this line commented    
# out unless you are ethernet bridging.    


# 配置爲以太網橋模式,但需要使用系統的橋接功能    
# 一般不需要使用
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100

# Push routes to the client to allow it  
# to reach other private subnets behind    
# the server.  Remember that these    
# private subnets will also need    
# to know to route the Open*** client    
# address pool (10.8.0.0/255.255.255.0)    
# back to the Open*** server.    


# 爲客戶端創建對應的路由,以另其通達公司網內部服務器    
# 但記住,公司網內部服務器也需要有可用路由返回到客戶端(很多博友都會在這裏出問題

;push "route 192.168.10.0 255.255.255.0"    
;push "route 192.168.20.0 255.255.255.0"

# To assign specific IP addresses to specific  
# clients or if a connecting client has a private    
# subnet behind it that should also have *** access,    
# use the subdirectory "ccd" for client-specific    
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client  
# having the certificate common name "Thelonious"    
# also has a small subnet behind his connecting    
# machine, such as 192.168.40.128/255.255.255.248.    
# First, uncomment out these lines:    
;client-config-dir ccd    
;route 192.168.40.128 255.255.255.248    
# Then create a file ccd/Thelonious with this line:    
#   iroute 192.168.40.128 255.255.255.248    
# This will allow Thelonious' private subnet to    
# access the ***.  This example will only work    
# if you are routing, not bridging, i.e. you are    
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give  
# Thelonious a fixed *** IP address of 10.9.0.1.    
# First uncomment out these lines:    


# 爲特定的客戶端指定 IP 或指定路由,該路由通常是客戶端後面的    
# 內網網段,而不是服務端連接的網段      
# ccd 是/etc/open*** 下的目錄,其中建有希望限制的客戶端 Common      
# Name 爲文件名的文件,並通過下面的命令寫入固定 IP 地址      
# 例如 Common Name 爲 client1,則在/etc/open***/ccd/client1 寫有:

# ifconfig-push 10.9.0.1 10.9.0.2
;client-config-dir ccd    
;route 10.9.0.0 255.255.255.252    
# Then add this line to ccd/Thelonious:    
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different  
# firewall access policies for different groups    
# of clients.  There are two methods:    
# (1) Run multiple Open*** daemons, one for each    
#     group, and firewall the TUN/TAP interface    
#     for each group/daemon appropriately.    
# (2) (Advanced) Create a script to dynamically    
#     modify the firewall in response to access    
#     from different clients.  See man    
#     page for more info on learn-address script.  


# 支持對不同客戶端組執行不同的防火牆策略    
# 這裏有兩種方法      
# (1) 運行多個Open***守護進程, 每個對應不同的組      
# 並且防火牆對不同的組和進程執行不同的策略      
# (2) (高級)創建1個動態腳本使防火牆對接入的不同客戶端執行不同的策略

;learn-address ./script

# If enabled, this directive will configure  
# all clients to redirect their default    
# network gateway through the ***, causing    
# all IP traffic such as web browsing and    
# and DNS lookups to go through the ***    
# (The Open*** server machine may need to NAT    
# the TUN/TAP interface to the internet in    
# order for this to work properly).    
# CAVEAT: May break client's network config if    
# client's local DHCP server packets get routed    
# through the tunnel.  Solution: make sure    
# client's local DHCP server is reachable via    
# a more specific route than the default route    
# of 0.0.0.0/0.0.0.0.    


# 若客戶端希望所有的流量都通過 *** 傳輸,則可以使用該語句    
# 其會自動改變客戶端的網關爲 *** 服務器,推薦關閉      
# 一旦設置,請小心服務端的 DHCP 設置問題

;push "redirect-gateway"

# Certain Windows-specific network settings  
# can be pushed to clients, such as DNS    
# or WINS server addresses.  CAVEAT:    
# http://open***.net/faq.html#dhcpcaveats


# 用Open***的DHCP功能爲客戶端提供指定的DNS、WINS等
;push "dhcp-option DNS 10.8.0.1"    
;push "dhcp-option WINS 10.8.0.1"

# Uncomment this directive to allow different  
# clients to be able to "see" each other.    
# By default, clients will only see the server.    
# To force clients to only see the server, you    
# will also need to appropriately firewall the    
# server's TUN/TAP interface.    


# 下面這句使客戶端能相互訪問    
# 否則,默認設置下客戶端間不能相互訪問      
;client-to-client

# Uncomment this directive if multiple clients  
# might connect with the same certificate/key    
# files or common names.  This is recommended    
# only for testing purposes.  For production use,    
# each client should have its own certificate/key    
# pair.    
#    
# IF YOU HAVE NOT GENERATED INDIVIDUAL    
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,    
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",    
# UNCOMMENT THIS LINE OUT.    


# 如果您希望有相同 Common Name 的客戶端都可以登陸    
# 也可以註釋下面的語句,推薦每個客戶端都使用不用的 Common Name      
# 常用於測試

;duplicate-cn

# The keepalive directive causes ping-like  
# messages to be sent back and forth over    
# the link so that each side knows when    
# the other side has gone down.    
# Ping every 10 seconds, assume that remote    
# peer is down if no ping received during    
# a 120 second time period.    


# 設置服務端檢測的間隔和超時時間 每 10 秒 ping 一次,    
# 如果 120 秒沒有迴應則認爲對方已經 down

keepalive 10 120

# For extra security beyond that provided  
# by SSL/TLS, create an "HMAC firewall"    
# to help block DoS attacks and UDP port flooding.    
#    
# Generate with:    
#   open*** --genkey --secret ta.key    
#    
# The server and each client must have    
# a copy of this key.    
# The second parameter should be '0'    
# on the server and '1' on the clients.    


# 爲防止遭到DDoS***    
# 生成ta.key文件,並cp到服務器端和每個客戶端      
# 該文件用以下命令生成      
# open*** --genkey --secret ta.key      
# 服務器端0,客戶端1      
# 該文件要嚴格保護

;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.  
# This config item must be copied to    
# the client config file as well.    


# 選擇一種加密算法,Server端和Client端必須一樣
;cipher BF-CBC        # Blowfish (default)    
;cipher AES-128-CBC   # AES    
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the *** link.  
# If you enable it here, you must also    
# enable it in the client config file.    


# 允許數據壓縮    
# 客戶端配置文件也需要有這項

comp-lzo

# The maximum number of concurrently connected  
# clients we want to allow.    


# 最大客戶端併發連接數量
;max-clients 100

# It's a good idea to reduce the Open***  
# daemon's privileges after initialization.    
#    
# You can uncomment this out on    
# non-Windows systems.    


# 定義運行open***的用戶
;user nobody    
;group nobody

# The persist options will try to avoid  
# accessing certain resources on restart    
# that may no longer be accessible because    
# of the privilege downgrade.    


#通過keepalive檢測超時後,重新啓動***,不重新讀取keys,保留第一次使用的keys
persist-key    


#通過keepalive檢測超時後,重新啓動***,一直保持tun或者tap設備是linkup的,    
#否則網絡連接會先linkdown然後linkup

persist-tun

# Output a short status file showing  
# current connections, truncated    
# and rewritten every minute.    


#定期把open***的一些狀態信息寫到文件中,以便自己寫程序計費或者進行其他操作
status open***-status.log

# By default, log messages will go to the syslog (or  
# on Windows, if running as a service, they will go to    
# the "\Program Files\Open***\log" directory).    
# Use log or log-append to override this default.    
# "log" will truncate the log file on Open*** startup,    
# while "log-append" will append to it.  Use one    
# or the other (but not both).    


#記錄日誌,每次重新啓動open***後刪除原有的log信息
;log         open***.log    


#記錄日誌,每次重新啓動open***後追加原有的log信息
;log-append  open***.log

# Set the appropriate level of log  
# file verbosity.    
#    
# 0 is silent, except for fatal errors    
# 4 is reasonable for general usage    
# 5 and 6 can help to debug connection problems    
# 9 is extremely verbose    


#設置日誌要記錄的級別。    
#0 只記錄錯誤信息。      
#4 能記錄普通的信息。      
#5 和 6 在連接出現問題時能幫助調試      
#9 是極端的,所有信息都會顯示,甚至連包頭等信息都顯示(像tcpdump)

verb 3

# Silence repeating messages.  At most 20  
# sequential messages of the same message    
# category will be output to the log.    


#相同信息的數量,如果連續出現 20 條相同的信息,將不記錄到日誌中。
;mute 20


好了,到這裏我們配置文件說明就到這裏了,嘿嘿!最後,希望大家有所收穫^_^……


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章