Line 7: |
Line 7: |
| mailto:daniel@firewall-services.com | | mailto:daniel@firewall-services.com |
| | | |
− | === Version === | + | ===Version=== |
| | | |
| {{#smeversion: smeserver-openvpn-s2s }} | | {{#smeversion: smeserver-openvpn-s2s }} |
| | | |
− | === Description === | + | ===Description=== |
| | | |
| smeserver-openvpn-s2s lets you inter-connect several SME servers, and their local networks with secure VPN. It uses OpenVPN as backend, using either the simple shared secret method, or the stronger, but more complex TLS mechanism. It's well integrated in SME, providing a panel to configure most settings. | | smeserver-openvpn-s2s lets you inter-connect several SME servers, and their local networks with secure VPN. It uses OpenVPN as backend, using either the simple shared secret method, or the stronger, but more complex TLS mechanism. It's well integrated in SME, providing a panel to configure most settings. |
| | | |
− | === Installation === | + | ===Installation=== |
| | | |
| install the rpms sme8.x and sme9.x | | install the rpms sme8.x and sme9.x |
| | | |
− | * for sme8 | + | *for sme8 |
| + | |
| yum --enablerepo=smecontribs install smeserver-openvpn-s2s | | yum --enablerepo=smecontribs install smeserver-openvpn-s2s |
| expand-template /etc/rc.d/init.d/masq | | expand-template /etc/rc.d/init.d/masq |
Line 26: |
Line 27: |
| This contrib has been tested on SME 7.5.1 and SME 8b6, 8b7 and 8.0 Final | | This contrib has been tested on SME 7.5.1 and SME 8b6, 8b7 and 8.0 Final |
| | | |
− | * for sme9 | + | *for sme9 |
| + | |
| yum --enablerepo=smecontribs install smeserver-openvpn-s2s | | yum --enablerepo=smecontribs install smeserver-openvpn-s2s |
| expand-template /etc/rc.d/init.d/masq | | expand-template /etc/rc.d/init.d/masq |
| /etc/init.d/masq restart | | /etc/init.d/masq restart |
− | * for sme10 | + | |
| + | *for sme10 |
| + | |
| yum --enablerepo=smecontribs,epel install smeserver-openvpn-s2s | | yum --enablerepo=smecontribs,epel install smeserver-openvpn-s2s |
| | | |
− | === Configuration === | + | ===Configuration=== |
| | | |
| This contrib lets you create as many servers and clients daemon as you want. A server can only be used by one client (it's not a one server for multiple clients solution), so if you want to connect several SME to one central server, you'll need to create several server daemon, binding on different ports. | | This contrib lets you create as many servers and clients daemon as you want. A server can only be used by one client (it's not a one server for multiple clients solution), so if you want to connect several SME to one central server, you'll need to create several server daemon, binding on different ports. |
Line 39: |
Line 43: |
| | | |
| Lets take a simple example. We manage two SME servers | | Lets take a simple example. We manage two SME servers |
− | * SME1
| |
− | ** Local network: 192.168.9.0/24 (192.168.9.1 being the address of the internal interface of SME1)
| |
− | ** Public DNS domain name: sme1.domain.tld (resolves to the public IP of SME1)
| |
| | | |
− | * SME2 | + | *SME1 |
− | ** Local network: 192.168.11.0/24 (192.168.11.1 being the address of the internal interface of SME2) | + | **Local network: 192.168.9.0/24 (192.168.9.1 being the address of the internal interface of SME1) |
− | ** Public DNS domain name: sme2.domain.tld (resolves to the public IP of SME2) | + | **Public DNS domain name: sme1.domain.tld (resolves to the public IP of SME1) |
| + | |
| + | *SME2 |
| + | **Local network: 192.168.11.0/24 (192.168.11.1 being the address of the internal interface of SME2) |
| + | **Public DNS domain name: sme2.domain.tld (resolves to the public IP of SME2) |
| | | |
| [[File:Ovpn_s2s_rzo_avant_vpn.png|768px|thumb|center|Before the VPN inter-connection]] | | [[File:Ovpn_s2s_rzo_avant_vpn.png|768px|thumb|center|Before the VPN inter-connection]] |
Line 77: |
Line 82: |
| | | |
| Here are the explanation of some settings: | | Here are the explanation of some settings: |
− | * '''Daemon ID''': just a unique identifier for this connection. | + | |
− | * '''Description''': a human readable description (eg link between SME1 and SME2) | + | *'''Daemon ID''': just a unique identifier for this connection. |
− | * '''Status''': you can disable a VPN connection if you want, but most of the time you'll want it enabled | + | *'''Description''': a human readable description (eg link between SME1 and SME2) |
− | * '''Authentication mechanism''': How both ends will authenticate. The easier solution is the Shared Key. You can also use TLS if you want, but it's usually for power users (you need to manage a PKI, you can use [[PHPki]] for this if you want) | + | *'''Status''': you can disable a VPN connection if you want, but most of the time you'll want it enabled |
− | * '''Remote Host''' (available on client only): IP or FQDN of the remote peer | + | *'''Authentication mechanism''': How both ends will authenticate. The easier solution is the Shared Key. You can also use TLS if you want, but it's usually for power users (you need to manage a PKI, you can use [[PHPki]] for this if you want) |
− | * '''Remote Port''' (available on client only): port used by the remote server | + | *'''HMAC''': THis is part of the security of the data channel with the Cipher. Default is the insecure SHA1, we suggest you use SHA256 as a minimum. This setting should match on both the server and the client. You can get a list of available HMAC using this command: |
− | * '''Local Port''' (available on server only): port on which the OpenVPN server will bind, waiting for connection of the client. Remote Port on the client and Local Port on the server should be the same | + | |
− | * '''Local Virtual IP''': the IP used internally by OpenVPN. You should choose a IP outside of any local networks | + | openvpn --show-digests | egrep 'digest size' | awk {'print $1'} |
− | * '''Remote Virtual IP''': the IP used internally by OpenVPN on the other side. Those two virtual IP should be reversed between the client and the server | + | |
| + | *'''Cipher''': The cipher used. The default is to use the insecure BlowFish algorithm, we suggest you use AES-128-CBC as a minimum. This setting should match on both the server and the client. You can get a list of available ciphers using this command: |
| + | |
| + | openvpn --show-ciphers | egrep '^[A-Z]{2}' | awk {'print $1'} |
| + | |
| + | *'''Remote Host''' (available on client only): IP or FQDN of the remote peer |
| + | *'''Remote Port''' (available on client only): port used by the remote server |
| + | *'''Local Port''' (available on server only): port on which the OpenVPN server will bind, waiting for connection of the client. Remote Port on the client and Local Port on the server should be the same |
| + | *'''Local Virtual IP''': the IP used internally by OpenVPN. You should choose a IP outside of any local networks |
| + | *'''Remote Virtual IP''': the IP used internally by OpenVPN on the other side. Those two virtual IP should be reversed between the client and the server |
| {{Note box|You don't really need to remember the virtual IP, as once the connection is established, you'll use the internal IP to access the remote server through the VPN. You just need to choose two IP address which won't clash with any other local networks, then, just forget about it}} | | {{Note box|You don't really need to remember the virtual IP, as once the connection is established, you'll use the internal IP to access the remote server through the VPN. You just need to choose two IP address which won't clash with any other local networks, then, just forget about it}} |
− | * '''Remote Networks''': Enter in this field the networks reachable through the other end point. For example, on SME1, you'll enter the local networks of SME2: 192.168.11.0/255.255.255.0, on SME2, you'll enter the local network of SME1: 192.168.9.0/255.255.255.0 | + | |
| + | * '''SnatOutbound''': can be enabled or disabled (default is enabled). When enabled, connections initiated by the server itself will be SNATed so they will appear to come from the internal IP. If disabled, connections from the server itself will have the virtual IP as source. (This is only available since 0.1-19). |
| + | |
| + | *'''Remote Networks''': Enter in this field the networks reachable through the other end point. For example, on SME1, you'll enter the local networks of SME2: 192.168.11.0/255.255.255.0, on SME2, you'll enter the local network of SME1: 192.168.9.0/255.255.255.0 |
| {{Note box|If your server is in serveronly mode, you'll have to add the same routes in the device which acts as the default gatway of your local network, using the IP of your SME Server as the gateway}} | | {{Note box|If your server is in serveronly mode, you'll have to add the same routes in the device which acts as the default gatway of your local network, using the IP of your SME Server as the gateway}} |
| | | |
Line 96: |
Line 113: |
| We are now able to ping hosts on the other side using their private IP. | | We are now able to ping hosts on the other side using their private IP. |
| | | |
− | === Additional options === | + | ===Additional options=== |
| | | |
| Some advanced settings are not available on the panel, but only with db commands: | | Some advanced settings are not available on the panel, but only with db commands: |
− | * '''LogLevel''': if you want to increase the verbosity of a daemon (either client or server), you set the LogLevel property. Valid LogLevel values are numbers between 0 (no output except fatal errors) to 11 (really verbose) | + | |
− | * '''Protocol''': can be tcp or udp. The default is to use udp. You shouldn't change this setting unless you have good reason to do so. This setting should match on both the server and the client. | + | *'''LogLevel''': if you want to increase the verbosity of a daemon (either client or server), you set the LogLevel property. Valid LogLevel values are numbers between 0 (no output except fatal errors) to 11 (really verbose) |
− | * '''Cipher''': The cipher used. The default is to use the BlowFish algorithm. This setting should match on both the server and the client. You can get a list of available ciphers using this command:
| + | *'''Protocol''': can be tcp or udp. The default is to use udp. You shouldn't change this setting unless you have good reason to do so. This setting should match on both the server and the client. |
− | openvpn --show-ciphers | egrep '^[A-Z]{2}' | awk {'print $1'} | + | |
− | * '''Compression''': can be enabled or disabled. Toggle the internal compression used by OpenVPN. The default is enabled. This setting should match on both the server and the client | + | |
− | * '''AllowInbound''': can be yes or no (default to yes). If set to no, inbound connections from this VPN will be dropped. This is usefull if you wan't a one-way VPN only (eg 192.168.9.0/24 can reach 192.168.11.0/24, but not the other way). Obviously, this setting only makes sens if you enable it on either the server or the client, but not both. | + | |
− | * '''SnatOutbound''': can be enabled or disabled (default is enabled). When enabled, connections initiated by the server itself will be SNATed so they will appear to come from the internal IP. If disabled, connections from the server itself will have the virtual IP as source. (This is only available since 0.1-19).
| + | *'''Compression''': can be enabled or disabled. Toggle the internal compression used by OpenVPN. The default is enabled. This setting should match on both the server and the client |
| + | *'''AllowInbound''': can be yes or no (default to yes). If set to no, inbound connections from this VPN will be dropped. This is usefull if you wan't a one-way VPN only (eg 192.168.9.0/24 can reach 192.168.11.0/24, but not the other way). Obviously, this setting only makes sens if you enable it on either the server or the client, but not both. |
| | | |
| If you use TLS as authentication mechanism, you can set some other properties: | | If you use TLS as authentication mechanism, you can set some other properties: |
− | * '''RemoteCommonName''': The connection will be accepted only if the remote endpoint has a valid certificate, with this common name | + | |
− | * '''CheckCertificateUsage''': can be enabled or disabled (default is disabled). If enabled, a server daemon will only accept the connection if the remote endpoint present a client certificate, and a client daemon will only accept the connection if the remote endpoint present a server certificate. | + | *'''RemoteCommonName''': The connection will be accepted only if the remote endpoint has a valid certificate, with this common name |
| + | *'''CheckCertificateUsage''': can be enabled or disabled (default is disabled). If enabled, a server daemon will only accept the connection if the remote endpoint present a client certificate, and a client daemon will only accept the connection if the remote endpoint present a server certificate. |
| + | *'''tlsVmin''': This is the minimum TLS version accepted, unless you need to communicate with a very old server, you should not be using lower than 1.2 as it is insecure. Default is 1.2. |
| + | *'''tlsCipherSuites13''': This is the list of accepted ciphers for TLS v1.3 in order of presentation. Default is TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 |
| + | *'''tlsCipher12''': This is the list of accepted ciphers for TLS v1.2 in order of presentation. Default is TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256:TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256:TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 |
| | | |
| example: | | example: |
Line 123: |
Line 145: |
| signal-event openvpn-s2s-update | | signal-event openvpn-s2s-update |
| | | |
− | === Troubleshoot === | + | ===Troubleshoot=== |
| If you have problems, you can check the logs of the OpenVPN processes in /var/log/openvpn-s2s/<Daemon ID>.log | | If you have problems, you can check the logs of the OpenVPN processes in /var/log/openvpn-s2s/<Daemon ID>.log |
| | | |
− | === Backup and Restore === | + | ===Backup and Restore=== |
| You should backup the directories /etc/openvpn/s2s/priv and /etc/openvpn/s2s/pub because keys and certificates used by this contrib are stored there. | | You should backup the directories /etc/openvpn/s2s/priv and /etc/openvpn/s2s/pub because keys and certificates used by this contrib are stored there. |
| | | |
− | === Uninstall === | + | ===Uninstall=== |
| If you want to remove the contrib, just run: | | If you want to remove the contrib, just run: |
| yum remove smeserver-openvpn-s2s | | yum remove smeserver-openvpn-s2s |
Line 135: |
Line 157: |
| You can then remove the directory /etc/openvpn/s2s if you really want to remove everything (including the private keys and certificates) | | You can then remove the directory /etc/openvpn/s2s if you really want to remove everything (including the private keys and certificates) |
| | | |
− | === Source === | + | ===Source=== |
| The source for this contrib can be found in the smeserver [http://smeserver.cvs.sourceforge.net/smeserver/smeserver-openvpn-s2s/ CVS] on sourceforge. | | The source for this contrib can be found in the smeserver [http://smeserver.cvs.sourceforge.net/smeserver/smeserver-openvpn-s2s/ CVS] on sourceforge. |
− | === Workarounds and known issues === | + | ===Workarounds and known issues=== |
| if you migrate from SME8 to SME9 and are not able to connect after correctly migrating your certificates, this might be related to not secure enough algorithm. CentOS 6.9 release notes state that "Support for insecure cryptographic protocols and algorithms has been dropped. This affects usage of MD5, SHA0, RC4 and DH parameters shorter than 1024 bits." Of course real solution would be to migrate all your certs to better algorithm. | | if you migrate from SME8 to SME9 and are not able to connect after correctly migrating your certificates, this might be related to not secure enough algorithm. CentOS 6.9 release notes state that "Support for insecure cryptographic protocols and algorithms has been dropped. This affects usage of MD5, SHA0, RC4 and DH parameters shorter than 1024 bits." Of course real solution would be to migrate all your certs to better algorithm. |
| | | |
Line 154: |
Line 176: |
| Only released version in smecontrib are listed here. | | Only released version in smecontrib are listed here. |
| | | |
− | {{ #smechangelog: smeserver-openvpn-s2s}} | + | {{#smechangelog: smeserver-openvpn-s2s}} |
| | | |
| ==Other articles in this category== | | ==Other articles in this category== |