Giter Club home page Giter Club logo

sa-vpn-softether's Introduction

sa-vpn-softether

Build Status

Example of use: check box-example

Possible configuration:

softether_option_securenat: true
softether_option_bridge: false

softether_location: /opt
softether_home: "{{softether_location}}/vpnserver"
softether_lang: en
softether_fqdn: "{{ansible_host}}"


# ============== IPSEC ===================
softether_option_ipsec: true
softether_ipsec_l2tp: yes
softether_ipsec_l2tpraw: yes
softether_ipsec_etherip: no
softether_ipsec_presharedkey: "zzz"
# /============== IPSEC ===================


# ============== OPENVPN ===================
softether_option_openvpn: true
softether_openvpn_port: 1194
softether_openvpn_config: "{{softether_home}}/generated/openvpn_config.zip"
# /============== OPENVPN ===================



# ============== Bridge ===================
softether_bridge_device: soft
softether_bridge_tap: no
# ============== /Bridge ===================


# ============== Users ===================
softether_vpn_users:
  - {
      name: "test",
      password: "test"
    }
# ============== /Users ===================

softether_sysctl_conf_lines:
  - {
      name: 'net.ipv4.ip_forward',
      value: '1'
    }

Simple:

vars:
     - my_softether_vpn_users:
        - {
            name: "my_user",
            password: "my_password"
          }

     - my_softether_ipsec_presharedkey: "[1KH;+r-X#cvhpv7Y6=#;[{u"

roles:

     - {
         role: "sa-vpn-softether",
         softether_vpn_users: "{{my_softether_vpn_users}}",
         softether_ipsec_presharedkey: "{{my_softether_ipsec_presharedkey}}"
       }

Advanced:

vars:
     - my_softether_vpn_users:
        - {
            name: "my_user",
            password: "my_password"
          }

     - my_softether_ipsec_presharedkey: "[1KH;+r-X#cvhpv7Y6=#;[{u"

roles:
     - {
         role: "sa-vpn-softether",

         softether_vpn_users: "{{my_softether_vpn_users}}",
         softether_ipsec_presharedkey: "{{my_softether_ipsec_presharedkey}}"


         softether_option_securenat: true,
         softether_option_bridge: false,
         softether_fqdn: "{{ansible_host}}",


         # ============== IPSEC ===================
         softether_option_ipsec: true,
         softether_ipsec_l2tp: yes,
         softether_ipsec_l2tpraw: yes,
         softether_ipsec_etherip: no,
         # /============== IPSEC ===================


         # ============== OPENVPN ===================
         softether_option_openvpn: true,
         softether_openvpn_port: 1194,
         softether_openvpn_config: "{{softether_home}}/generated/openvpn_config.zip",
         # /============== OPENVPN ===================



         # ============== Bridge ===================
         softether_bridge_device: soft,
         softether_bridge_tap: no
         # ============== /Bridge ===================

       }

If you ever needed to setup vpnserver on your own on later stage:

  softether_init_script: scenarios/dummy

Usage with ansible galaxy workflow

If you installed the sa-vpn-softether role using the command

ansible-galaxy install softasap.sa-vpn-softether

the role will be available in the folder library/softasap.sa-vpn-softether Please adjust the path accordingly.

     - {
         role: "softasap.sa-vpn-softether"
       }

Connecting to OpenVPN from client box

If you executed last step of play, you have now cer file for ipsec + zip with openvpn configuration.

Once unpacked, ensure you have GUI ready for openvpn. If menu "Import saved vpn configuration" missing, proceed with

sudo apt install network-manager-openvpn network-manager-openvpn-gnome network-manager-pptp network-manager-vpnc

After logout/login or reboot you will have menu option "Import saved vpn configuration".

Import file named yourhostname_l3.ovpn

use your user@vpn , for example test@vpn followed by password, like test ; If you have only one hub created, than you can use only username.

To troubleshoot you might use interactive session native ovpn client, like

sudo openvpn --config my.ovpn

Connecting to OpenVPN full story

  1. About Files

When you open the ZIP archive, the following files with the structured-directory will be expanded. Extract there files including sub-directory structure toward any destination directory, and use parts according to your necessary.

< The Configuration File for L3 (IP Routing) > openvpn_remote_access_l3.ovpn

< The Configuration File for L2 (Ethernet Bridging) > openvpn_site_to_site_bridge_l2.ovpn

The extension ".ovpn" means a configuration file. You can specify the configuration file into OpenVPN to initiate a VPN connection.

  1. How Different between L3 and L2?

Use L3 (IP Routing) if you want to install OpenVPN on the normal computer (for example, a lap top PC), and make it connect to PacketiX VPN Server or SoftEther VPN Server for the purpose of establishing a "Remote-Access VPN Connection" . In this case, the IP address will be assigned on the virtual network adapter of OpenVPN automatically when the OpenVPN will connect to the Virtual HUB on the VPN Server successfully and request an IP address and other network parameters (e.g. DNS server address).

In other hand, if you want to build a "Site-to-Site VPN Connection" , use L2 (Ethernet Bridging) for OpenVPN on the computer which is set up on the remote place for bridging. No IP-specific treatment will be done. All Ethernet packets (MAC frames) will exchanged transparently between two or more sites. Any computers or network equipments (e.g. routers) will be able to communicate to other sites mutually.

VPN Server will treat a virtual VPN session from L3-mode OpenVPN as a "VPN Client" session. VPN Server will treat a virtual VPN session from L2-mode OpenVPN as a "VPN Bridge" session.

  1. How to Specify the Username and Password?

The prompt of username and password will be shown when you try to use this configuration. You have to enter the same username and password which has already been defined on the Virtual HUB of VPN Server.

Please note that you have to create an user on the Virtual HUB in advance.

If there are two or more Virtual HUBs on the VPN Server, you have to specify the username as:

"Username@Virtual-HUB-Name"

or:

"Virtual-HUB-Name\Username"

to choose which Virtual HUB to be connected. You can also choose which Virtual HUB should be elected as a "Default HUB" when the specification of the name of Virtual HUB will be omitted.

Please be advised that you can make OpenVPN to enter the username and password automatically without showing a prompt. How to do it is described on the OpenVPN manual.

    1. About Protocol and Port Number Both TCP and UDP are available to connect to the VPN Server by OpenVPN.

If you use TCP, the port number is same as any of the "TCP Listener Port" on the VPN Server which is originally defined in order to accept inbound TCP-based VPN Client session.

If you use UDP, the port number must be one of UDP ports which are defined on the VPN Server configuration in advance. Do not confuse between TCP and UDP since they are not concerned mutually.

You can also specify the proxy-server address if the connection should be relayed by the proxy-server. Specify it on the configuration file.

Copyright and license

Code is dual licensed under the [BSD 3 clause] (https://opensource.org/licenses/BSD-3-Clause) and the [MIT License] (http://opensource.org/licenses/MIT). Choose the one that suits you best.

Reach us:

Subscribe for roles updates at [FB] (https://www.facebook.com/SoftAsap/)

Join gitter discussion channel at Gitter

Discover other roles at http://www.softasap.com/roles/registry_generated.html

visit our blog at http://www.softasap.com/blog/archive.html

sa-vpn-softether's People

Contributors

roumano avatar voronenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sa-vpn-softether's Issues

Set a administrator password

Hi,

I have modify the templates/scenarios/create_hub to eventually set a administrator password :

{% if softether_master_password is defined %}
ServerPasswordSet {{softether_master_password}}
{% endif %}

It's working well on the first deployment

But it's failed on next deployment on task "Proceed with setup"
as it's type ./vpncmd localhost /server /IN:{{softether_init_script}}
and it's should be :
./vpncmd localhost /server /IN:{{softether_init_script}} /PASSWORD:{{softether_master_password|default("")}}
( with the |default("") it's also working when it's not set a password

my temporary workarround is to stop the service before deploy
but it's not a fix ...

We can replace then " - name: SoftEther | Proceed with setup"
with

shell: ./vpncmd localhost /server /IN:{{softether_init_script}} /PASSWORD:{{softether_master_password|default("")}}

but it's will failed on the first deployment as it's not yet a password set

So i'm not sure how we can handle it ...
a idea ?

PATH environment for binary of softether

One option missing for this role is to update PATH environment with {{softether_home}}

personally i have added this small task to do this

- name: "add {{softether_home}} to path"
  lineinfile:
    dest: /etc/profile.d/softether.sh
    state: present
    create: yes
    regexp: '^export PATH'
    line: 'export PATH=$PATH:{{softether_home}}'

Server is reconfigured every time ansible runs

Every time I run Ansible the VPN server gets reconfigured, and that means new certificate.
New certificate means that all clients need to be reconfigured as well. Is there a way to stop this behaviour? And preferably, reconfigure the server if there were deviations in configuration, but not generate a new certificate?

the roles is Ubuntu only

due to use of apt module & specifiic command for ubuntu, this roles only work on ubuntu/debian machine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.