Commit 0713dccf authored by Michal Čihař's avatar Michal Čihař

Clean environment for ssh key management

Issue #528
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 4b6bbd66
...@@ -29,7 +29,7 @@ from weblate import settings_example ...@@ -29,7 +29,7 @@ from weblate import settings_example
from weblate import appsettings from weblate import appsettings
from weblate.accounts.avatar import HAS_LIBRAVATAR from weblate.accounts.avatar import HAS_LIBRAVATAR
from weblate.accounts.forms import HAS_ICU from weblate.accounts.forms import HAS_ICU
from weblate.trans.util import get_configuration_errors from weblate.trans.util import get_configuration_errors, get_clean_env
import weblate import weblate
import django import django
...@@ -261,6 +261,7 @@ def generate_ssh_key(request): ...@@ -261,6 +261,7 @@ def generate_ssh_key(request):
'-f', RSA_KEY_FILE[:-4] '-f', RSA_KEY_FILE[:-4]
], ],
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
env=get_clean_env(),
) )
messages.success(request, _('Created new SSH key.')) messages.success(request, _('Created new SSH key.'))
except (subprocess.CalledProcessError, OSError) as exc: except (subprocess.CalledProcessError, OSError) as exc:
...@@ -288,6 +289,7 @@ def add_host_key(request): ...@@ -288,6 +289,7 @@ def add_host_key(request):
output = subprocess.check_output( output = subprocess.check_output(
cmdline, cmdline,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
env=get_clean_env(),
) )
keys = [ keys = [
line line
...@@ -329,6 +331,7 @@ def ssh(request): ...@@ -329,6 +331,7 @@ def ssh(request):
['which', 'ssh-keygen'], ['which', 'ssh-keygen'],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
env=get_clean_env(),
) )
can_generate = (ret == 0 and not os.path.exists(RSA_KEY_FILE)) can_generate = (ret == 0 and not os.path.exists(RSA_KEY_FILE))
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment