##// END OF EJS Templates
fix(ssh): added missing import
super-admin -
r5321:4e02b442 default
parent child Browse files
Show More
@@ -1,59 +1,60 b''
1 # Copyright (C) 2016-2023 RhodeCode GmbH
1 # Copyright (C) 2016-2023 RhodeCode GmbH
2 #
2 #
3 # This program is free software: you can redistribute it and/or modify
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License, version 3
4 # it under the terms of the GNU Affero General Public License, version 3
5 # (only), as published by the Free Software Foundation.
5 # (only), as published by the Free Software Foundation.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU Affero General Public License
12 # You should have received a copy of the GNU Affero General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 #
14 #
15 # This program is dual-licensed. If you wish to learn more about the
15 # This program is dual-licensed. If you wish to learn more about the
16 # RhodeCode Enterprise Edition, including its added features, Support services,
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 import logging
19 import logging
20
20
21 from . import config_keys
21 from . import config_keys
22
22
23 from rhodecode.config.settings_maker import SettingsMaker
23 from rhodecode.config.settings_maker import SettingsMaker
24
24
25 log = logging.getLogger(__name__)
25 log = logging.getLogger(__name__)
26
26
27
27
28 def _sanitize_settings_and_apply_defaults(settings):
28 def _sanitize_settings_and_apply_defaults(settings):
29 """
29 """
30 Set defaults, convert to python types and validate settings.
30 Set defaults, convert to python types and validate settings.
31 """
31 """
32 settings_maker = SettingsMaker(settings)
32 settings_maker = SettingsMaker(settings)
33
33
34 settings_maker.make_setting(config_keys.generate_authorized_keyfile, False, parser='bool')
34 settings_maker.make_setting(config_keys.generate_authorized_keyfile, False, parser='bool')
35 settings_maker.make_setting(config_keys.wrapper_allow_shell, False, parser='bool')
35 settings_maker.make_setting(config_keys.wrapper_allow_shell, False, parser='bool')
36 settings_maker.make_setting(config_keys.enable_debug_logging, False, parser='bool')
36 settings_maker.make_setting(config_keys.enable_debug_logging, False, parser='bool')
37 settings_maker.make_setting(config_keys.ssh_key_generator_enabled, True, parser='bool')
37 settings_maker.make_setting(config_keys.ssh_key_generator_enabled, True, parser='bool')
38
38
39 settings_maker.make_setting(config_keys.authorized_keys_file_path, '~/.ssh/authorized_keys_rhodecode')
39 settings_maker.make_setting(config_keys.authorized_keys_file_path, '~/.ssh/authorized_keys_rhodecode')
40 settings_maker.make_setting(config_keys.wrapper_cmd, '')
40 settings_maker.make_setting(config_keys.wrapper_cmd, '')
41 settings_maker.make_setting(config_keys.authorized_keys_line_ssh_opts, '')
41 settings_maker.make_setting(config_keys.authorized_keys_line_ssh_opts, '')
42
42
43 settings_maker.make_setting(config_keys.ssh_hg_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/hg')
43 settings_maker.make_setting(config_keys.ssh_hg_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/hg')
44 settings_maker.make_setting(config_keys.ssh_git_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/git')
44 settings_maker.make_setting(config_keys.ssh_git_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/git')
45 settings_maker.make_setting(config_keys.ssh_svn_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/svnserve')
45 settings_maker.make_setting(config_keys.ssh_svn_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/svnserve')
46
46
47 settings_maker.env_expand()
47 settings_maker.env_expand()
48
48
49
49
50 def includeme(config):
50 def includeme(config):
51 settings = config.registry.settings
51 settings = config.registry.settings
52 _sanitize_settings_and_apply_defaults(settings)
52 _sanitize_settings_and_apply_defaults(settings)
53
53
54 # if we have enable generation of file, subscribe to event
54 # if we have enable generation of file, subscribe to event
55 if settings[config_keys.generate_authorized_keyfile]:
55 if settings[config_keys.generate_authorized_keyfile]:
56 # lazy import here for faster code reading... via sshwrapper-v2 mode
56 # lazy import here for faster code reading... via sshwrapper-v2 mode
57 from .subscribers import generate_ssh_authorized_keys_file_subscriber
57 from .subscribers import generate_ssh_authorized_keys_file_subscriber
58 from .events import SshKeyFileChangeEvent
58 config.add_subscriber(
59 config.add_subscriber(
59 generate_ssh_authorized_keys_file_subscriber, SshKeyFileChangeEvent)
60 generate_ssh_authorized_keys_file_subscriber, SshKeyFileChangeEvent)
General Comments 0
You need to be logged in to leave comments. Login now