⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 openvpn.8

📁 OpenVPN -- A Secure tunneling daemon
💻 8
📖 第 1 页 / 共 5 页
字号:
for an attacker with access to a signed string to find another stringwhich would sign to the same signature or generate a valid signaturefor his own string.OpenVPN's usage of HMAC is to first encrypt a packet, then HMAC the resulting ciphertext.In static-key encryption mode, the HMAC keyis included in the key file generated by.B --genkey.In TLS mode, the HMAC key is dynamically generated and sharedbetween peers via the TLS control channel.  If OpenVPN receives a packet witha bad HMAC it will drop the packet.HMAC usually adds 16 or 20 bytes per packet.Set.B alg=noneto disable authentication.For more information on HMAC see.I http://www.cs.ucsd.edu/users/mihir/papers/hmac.html.TP.B --cipher algEncrypt packets with cipher algorithm.B alg.The default is.B BF-CBC,an abbreviation for Blowfish in Cipher Block Chaining mode.Blowfish has the advantages of being fast, very secure, and allowing key sizesof up to 448 bits.  Blowfish is designed to be used in situations wherekeys are changed infrequently.For more information on blowfish, see.I http://www.counterpane.com/blowfish.htmlTo see other ciphers that are available withOpenVPN, use the.B --show-ciphersoption.OpenVPN supports the CBC, CFB, and OFB cipher modes.Set.B alg=noneto disable encryption..TP.B --keysize nSize of cipher key in bits (optional).If unspecified, defaults to cipher-specific default.  The.B --show-ciphersoption (see below) shows all available OpenSSL ciphers,their default key sizes, and whether the key size canbe changed.  Use care in changing a cipher's defaultkey size.  Many ciphers have not been extensivelycryptanalyzed with non-standard key lengths, and alarger key may offer no real guarantee of greatersecurity, or may even reduce security..TP.B --no-replayDisable OpenVPN's protection against replay attacks.Don't use this option unless you are prepared to makea tradeoff of greater efficiency in exchange for lesssecurity.OpenVPN provides datagram replay protection by default.Replay protection is accomplishedby tagging each outgoing datagram with an identifierthat is guaranteed to be unique for the key being used.The peer that receives the datagram will check forthe uniqueness of the identifier.  If the identifierwas already received in a previous datagram, OpenVPNwill drop the packet.  Replay protection is importantto defeat attacks such as a SYN flood attack, wherethe attacker listens in the wire, intercepts a TCPSYN packet (identifying it by the context in whichit occurs in relation to other packets), then floodsthe receiving peer with copies of this packet.OpenVPN's replay protection is implemented in slightlydifferent ways, depending on the key management modeyou have selected.In Static Key modeor when using an CFB or OFB mode cipher, OpenVPN uses a64 bit unique identifier that combines a time stamp withan incrementing sequence number.When using TLS mode for key exchange and a CBC ciphermode, OpenVPN uses only a 32 bit sequence number withouta time stamp, since OpenVPN can guarantee the uniquenessof this value for each key.  As in IPSec, if the sequence number isclose to wrapping back to zero, OpenVPN will triggera new key exchange.To check for replays, OpenVPN usesthe.I sliding windowalgorithm usedby IPSec..TP.B --replay-persist filePersist replay-protection state across sessions using.B fileto save and reload the state.This option will strengthen protection against replay attacks,especially when you are using OpenVPN in a dynamic context (suchas with.B --inetd)when OpenVPN sessions are frequently started and stopped. This option will keep a disk copy of the current replay protectionstate (i.e. the most recent packet timestamp and sequence numberreceived from the remote peer), so that if an OpenVPN sessionis stopped and restarted, it will reject any replays of packetswhich were already received by the prior session.This option only makes sense when replay protection is enabled(the default) and you are using either.B --secret(shared-secret key mode) or TLS mode with.B --tls-auth..TP.B --no-ivDisable OpenVPN's use of IV (cipher initialization vector).Don't use this option unless you are prepared to makea tradeoff of greater efficiency in exchange for lesssecurity.OpenVPN uses an IV by default, and requires it for CFB andOFB cipher modes (which are totally insecure without it).Using an IV is important for security when multiplemessages are being encrypted/decrypted with the same key.IV is implemented differently depending on the cipher mode used.In CBC mode, OpenVPN will start with a random IV and carry forwardthe residuals across datagrams in a manner similarto that used by IPSec (see RFC 2405 for more information). In CFB/OFB mode, OpenVPN uses a unique sequence number and time stampas the IV.  In fact, in CFB/OFB mode, OpenVPN uses a datagramspace-saving optimization that uses the unique identifier fordatagram replay protection as the IV..TP.B --test-cryptoDo a self-test of OpenVPN's crypto options by encrypting anddecrypting test packets using the data channel encryption optionsspecified above.  This option does not require a peer to function,and therefore can be specified without.B --devor.B --remote.The typical usage of.B --test-cryptowould be something like this:.B openvpn --test-crypto --secret keyor.B openvpn --test-crypto --secret key --verb 9This option is very useful to test OpenVPN after it has been ported toa new platform, or to isolate problems in the compiler, OpenSSLcrypto library, or OpenVPN's crypto code.  Since it is a self-test mode,problems with encryption and authentication can be debugged independentlyof network and tunnel issues..SS TLS Mode Options:TLS mode is the most powerful mode of OpenVPN in both security and flexibility.TLS mode works by establishing control anddata channels which are multiplexed over a single UDP port.  OpenVPN initiatesa TLS session over the control channel and uses it to exchange cipherand HMAC keys to protect the data channel.  TLS mode uses a robust reliabilitylayer over the UDP connection for all control channel communication, whilethe data channel, over which encrypted tunnel data passes, is forwarded withoutany mediation.  The result is the best of both worlds: a fast data channelthat forwards over UDP with only the overhead of encrypt,decrypt, and HMAC functions,and a control channel that provides all of the security features of TLS,including certificate-based authentication and perfect forward security.To use TLS mode, each peer that runs OpenVPN should have its own localcertificate/key pair (.B --certand.B --key), signed by the root certificate which is specifiedin.B --ca.When two OpenVPN peers connect, each presents its local certificate to theother.  Each peer will then check that its partner peer presented acertificate which was signed by the master root certificate as specified in.B --ca.If that check on both peers succeeds, then the TLS negotiation will succeed, both OpenVPNpeers will exchange temporary session keys, and the tunnel will beginpassing data.The OpenVPN distribution contains a set of scripts for managing RSA certificates & keys,located in the.I easy-rsasubdirectory.The easy-rsa package is also rendered in web form here:.I http://openvpn.sourceforge.net/easyrsa.html.TP.B --tls-serverEnable TLS and assume server role during TLS handshake.  Note thatOpenVPN is designed as a peer-to-peer application.  The designationof client or server is only for the purpose of negotiating the TLScontrol channel..TP.B --tls-clientEnable TLS and assume client role during TLS handshake..TP.B --ca fileCertificate authority (CA) file in .pem format, also referred to as the.I rootcertificate.  This file can have multiplecertificates in .pem format, concatenated together.  You can construct your owncertificate authority certificate and private key by using a command such as:.B openssl req -nodes -new -x509 -keyout tmp-ca.key -out tmp-ca.crtThen edit your openssl.cnf file and edit the.B certificatevariable to point to your new root certificate.B tmp-ca.crt.For testing purposes only, the OpenVPN distribution includes a sampleCA certificate (tmp-ca.crt).Of course you should never usethe test certificates and test keys distributed with OpenVPN in aproduction environment, since by virtue of the fact thatthey are distributed with OpenVPN, they are totally insecure..TP.B --dh fileFile containing Diffie Hellman parametersin .pem format (required for.B --tls-serveronly). Use.B openssl dhparam -out dh1024.pem 1024to generate your own, or use the existing dh1024.pem fileincluded with the OpenVPN distribution.  Diffie Hellman parametersmay be considered public..TP.B --cert fileLocal peer's signed certificate in .pem format -- must be signedby a certificate authority whose certificate is in.B --ca file.Each peer in an OpenVPN link running in TLS mode should have its owncertificate and private key file.  In addition, each certificate shouldhave been signed by the key of a certificateauthority whose public key resides in the.B --cacertificate authority file.You can easily make your own certificate authority (see above) or pay moneyto use a commercial service such as thawte.com (in which case you will behelping to finance the world's second space tourist :).To generate a certificate,you can use a command such as:.B openssl req -nodes -new -keyout mycert.key -out mycert.csrIf your certificate authority private key lives on another machine, copythe certificate signing request (mycert.csr) to this other machine (this canbe done over an insecure channel such as email).  Now sign the certificatewith a command such as:.B openssl ca -out mycert.crt -in mycert.csrNow copy the certificate (mycert.crt)back to the peer which initially generated the .csr file (thiscan be over a public medium).Note that the.B openssl cacommand reads the location of the certificate authority key from itsconfiguration file such as.B /usr/share/ssl/openssl.cnf-- note alsothat for certificate authority functions, you must set up the files.B index.txt(may be empty) and.B serial(initialize to.B 01)..TP.B --key fileLocal peer's private key in .pem format.  Use the private key which was generatedwhen you built your peer's certificate (see.B -cert fileabove)..TP.B --tls-cipher lA list l of allowable TLS ciphers separated by.B |(optional).  If you require a high level of security,you may want to set this parameter manually, to prevent aversion rollback attack where a man-in-the-middle attacker triesto force two peers to negotiate to the lowest levelof security they both support.Use.B --show-tlsto see a list of supported TLS ciphers..TP.B --tls-timeout nPacket retransmit timeout on TLS control channelif no acknowledgment from remote within.B nseconds (default=2).  When OpenVPN sends a controlpacket to its peer, it will expect to receive anacknowledgement within.B nseconds or it will retransmit the packet, subjectto a TCP-like exponential backoff algorithm.  This parameteronly applies to control channel packets.  Data channelpackets (which carry encrypted tunnel data) are neveracknowledged, sequenced, or retransmitted by OpenVPN becausethe higher level network protocols running on top of the tunnelsuch as TCP expect this role to be left to them..TP.B --reneg-bytes nRenegotiate data channel key after.B nbytes sent or received (disabled by default).OpenVPN allows the lifetime of a keyto expressed as a number of bytes encrypted/decrypted, a number of packets, ora number of seconds.  A key renegotiation will be forcedif any of these three criteria are met by either peer..TP.B --reneg-pkts nRenegotiate data channel key after.B npackets sent and received (disabled by default)..TP.B --reneg-sec nRenegotiate data channel key after.B nseconds (default=3600)..TP.B --hand-window nHandshake Window -- the TLS-based key exchange must finalize within.B nsecondsof handshake initiation by any peer (default = 60 seconds).If the handshake failswe will attempt to reset our connection with our peer and try again.Even in the event of handshake failure we will still useour expiring key for up to.B --tran-windowseconds to maintain continuity of transmission of tunneldata..TP.B --tran-window nTransition window -- our old key can live this many secondsafter new a key renegotiation begins (default = 3600 seconds).This is a powerful feature that contributes to the robustnessof the OpenVPN key negotiation protocol.  Even during periodsof extremely poor network connectivity between peers, withsignificant dropped packets, OpenVPNwill never let the failure of a key exchange handshake interfere withthe continuing transmission of tunnel data..TP.B --single-sessionAfter initially connecting to a remote peer, disallow any new connections.Using thisoption means that a remote peer cannot connect, disconnect, and thenreconnect.If the daemon is reset by a signal or.B --ping-restart,it will allow one new connection..B --single-sessioncan be used with.B --ping-exitor.B --inactiveto create a single dynamic session that will exit when finished..TP.B --tls-auth fAdd an additional layer of authentication on top of the TLScontrol channel to protect against DoS attacks..B f(required) is a shared-secret passphrase file..B --tls-authis recommended when you are running OpenVPN in a mode whereit is listening for packets from any IP address such as when.B --remoteis not specified, or.B --remoteis specified with.B --float.The rationale forthis feature is as follows.  TLS requires a multi-packet exchangebefore it is able to authenticate a peer.  During this timebefore authentication, OpenVPN is allocating resources (memoryand CPU) to this potential peer.  The potential peer is alsoexposing many parts of OpenVPN and the OpenSSL library to the packetsit is sending.  Most successful network attacks today seekto either exploit bugs in programs (such as buffer overflow attacks) orforce a program to consume so many resources that it becomes unusable.Of course the first line of defense is always to produce clean,well-audited code.  OpenVPN has been written with buffer overflowattack prevention as a top priority.But as history has shown, many of the most widely usednetwork applications have, from time to time,fallen to buffer overflow attacks.So as a second line of defense, OpenVPN offersthis special layer of authentication on top of the TLS control channel so that

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -