예제 #1
0
def test_is_setup_with_rsa(keys_directory, call_action):
    """is_setup should work with RSA configuration."""
    with patch('plinth.actions.superuser_run', call_action):
        (keys_directory / 'pki').mkdir()
        dh_params_file = keys_directory / 'pki' / 'dh.pem'
        dh_params_file.write_text('some content')
        assert openvpn.is_setup()
        os.remove(dh_params_file)
예제 #2
0
def test_is_setup_with_ecc(keys_directory, call_action):
    """is_setup should work with RSA configuration."""
    with patch('plinth.actions.superuser_run', call_action):
        (keys_directory / 'pki' / 'ecparams').mkdir(parents=True)
        ec_params_file = keys_directory / 'pki' / 'ecparams' / 'somecurve.pem'
        ec_params_file.write_text('some content')
        assert openvpn.is_setup()
        os.remove(ec_params_file)
예제 #3
0
파일: views.py 프로젝트: JoKeyser/Plinth
def setup(_):
    """Start the setup process."""
    if not openvpn.is_setup():
        actions.superuser_run('openvpn', ['setup'], run_in_background=True)

    openvpn.app.enable()

    return redirect('openvpn:index')
예제 #4
0
파일: views.py 프로젝트: JoKeyser/Plinth
 def get_context_data(self, *args, **kwargs):
     """Add additional context data for template."""
     context = super().get_context_data(*args, **kwargs)
     context['status'] = {
         'is_setup': openvpn.is_setup(),
     }
     context['using_ecc'] = openvpn.is_using_ecc()
     return context
예제 #5
0
def get_status():
    """Get the current settings from OpenVPN server."""

    return {
        'is_setup': openvpn.is_setup(),
        'setup_running': bool(setup_process),
        'enabled': openvpn.service.is_enabled(),
        'is_running': openvpn.service.is_running()
    }
예제 #6
0
def get_status():
    """Get the current settings from OpenVPN server."""

    return {
        'is_setup': openvpn.is_setup(),
        'setup_running': bool(setup_process),
        'enabled': openvpn.service.is_enabled(),
        'is_running': openvpn.service.is_running()
    }
예제 #7
0
파일: views.py 프로젝트: bhuvi8/Plinth
def setup(request):
    """Start the setup process."""
    openvpn.service.notify_enabled(None, True)

    global setup_process
    if not openvpn.is_setup() and not setup_process:
        setup_process = actions.superuser_run('openvpn', ['setup'], async=True)

    return redirect('openvpn:index')
예제 #8
0
def setup(request):
    """Start the setup process."""
    openvpn.service.notify_enabled(None, True)

    global setup_process
    if not openvpn.is_setup() and not setup_process:
        setup_process = actions.superuser_run('openvpn', ['setup'], async=True)

    return redirect('openvpn:index')
예제 #9
0
파일: views.py 프로젝트: bhuvi8/Plinth
def get_status():
    """Get the current settings from OpenVPN server."""
    status = {'is_setup': openvpn.is_setup(),
              'setup_running': False,
              'enabled': openvpn.is_enabled(),
              'is_running': openvpn.is_running()}

    status['setup_running'] = bool(setup_process)

    return status
예제 #10
0
def setup(request):
    """Start the setup process."""
    global setup_process
    if not openvpn.is_setup() and not setup_process:
        setup_process = actions.superuser_run('openvpn', ['setup'],
                                              run_in_background=True)

    openvpn.app.enable()

    return redirect('openvpn:index')
예제 #11
0
 def get_context_data(self, *args, **kwargs):
     """Add additional context data for template."""
     context = super().get_context_data(*args, **kwargs)
     context['status'] = {
         'is_setup': openvpn.is_setup(),
         'setup_running': bool(openvpn.setup_process),
     }
     context['refresh_page_sec'] = 3 if context['status'][
         'setup_running'] else None
     return context
예제 #12
0
def setup(request):
    """Start the setup process."""
    openvpn.service.notify_enabled(None, True)

    global setup_process
    if not openvpn.is_setup() and not setup_process:
        setup_process = actions.superuser_run('openvpn', ['setup'],
                                              run_in_background=True)

    openvpn.add_shortcut()

    return redirect('openvpn:index')
예제 #13
0
def get_status():
    """Get the current settings from OpenVPN server."""
    status = {
        'is_setup': openvpn.is_setup(),
        'setup_running': False,
        'enabled': openvpn.is_enabled(),
        'is_running': openvpn.is_running()
    }

    status['setup_running'] = bool(setup_process)

    return status
예제 #14
0
파일: views.py 프로젝트: JoKeyser/Plinth
def ecc(_):
    """Migrate from RSA to ECC."""
    if openvpn.is_setup():
        actions.superuser_run('openvpn', ['setup'], run_in_background=True)
    return redirect('openvpn:index')