Show More
@@ -1,59 +1,59 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 | from .events import SshKeyFileChangeEvent |
|
22 | from .events import SshKeyFileChangeEvent | |
23 | from .subscribers import generate_ssh_authorized_keys_file_subscriber |
|
23 | from .subscribers import generate_ssh_authorized_keys_file_subscriber | |
24 |
|
24 | |||
25 | from rhodecode.config.settings_maker import SettingsMaker |
|
25 | from rhodecode.config.settings_maker import SettingsMaker | |
26 |
|
26 | |||
27 | log = logging.getLogger(__name__) |
|
27 | log = logging.getLogger(__name__) | |
28 |
|
28 | |||
29 |
|
29 | |||
30 | def _sanitize_settings_and_apply_defaults(settings): |
|
30 | def _sanitize_settings_and_apply_defaults(settings): | |
31 | """ |
|
31 | """ | |
32 | Set defaults, convert to python types and validate settings. |
|
32 | Set defaults, convert to python types and validate settings. | |
33 | """ |
|
33 | """ | |
34 | settings_maker = SettingsMaker(settings) |
|
34 | settings_maker = SettingsMaker(settings) | |
35 |
|
35 | |||
36 | settings_maker.make_setting(config_keys.generate_authorized_keyfile, False, parser='bool') |
|
36 | settings_maker.make_setting(config_keys.generate_authorized_keyfile, False, parser='bool') | |
37 | settings_maker.make_setting(config_keys.wrapper_allow_shell, False, parser='bool') |
|
37 | settings_maker.make_setting(config_keys.wrapper_allow_shell, False, parser='bool') | |
38 | settings_maker.make_setting(config_keys.enable_debug_logging, False, parser='bool') |
|
38 | settings_maker.make_setting(config_keys.enable_debug_logging, False, parser='bool') | |
39 | settings_maker.make_setting(config_keys.ssh_key_generator_enabled, True, parser='bool') |
|
39 | settings_maker.make_setting(config_keys.ssh_key_generator_enabled, True, parser='bool') | |
40 |
|
40 | |||
41 | settings_maker.make_setting(config_keys.authorized_keys_file_path, '~/.ssh/authorized_keys_rhodecode') |
|
41 | settings_maker.make_setting(config_keys.authorized_keys_file_path, '~/.ssh/authorized_keys_rhodecode') | |
42 | settings_maker.make_setting(config_keys.wrapper_cmd, '') |
|
42 | settings_maker.make_setting(config_keys.wrapper_cmd, '') | |
43 | settings_maker.make_setting(config_keys.authorized_keys_line_ssh_opts, '') |
|
43 | settings_maker.make_setting(config_keys.authorized_keys_line_ssh_opts, '') | |
44 |
|
44 | |||
45 |
settings_maker.make_setting(config_keys.ssh_hg_bin, ' |
|
45 | settings_maker.make_setting(config_keys.ssh_hg_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/hg') | |
46 |
settings_maker.make_setting(config_keys.ssh_git_bin, ' |
|
46 | settings_maker.make_setting(config_keys.ssh_git_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/git') | |
47 |
settings_maker.make_setting(config_keys.ssh_svn_bin, ' |
|
47 | settings_maker.make_setting(config_keys.ssh_svn_bin, '/usr/local/bin/rhodecode_bin/vcs_bin/svnserve') | |
48 |
|
48 | |||
49 | settings_maker.env_expand() |
|
49 | settings_maker.env_expand() | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | def includeme(config): |
|
52 | def includeme(config): | |
53 | settings = config.registry.settings |
|
53 | settings = config.registry.settings | |
54 | _sanitize_settings_and_apply_defaults(settings) |
|
54 | _sanitize_settings_and_apply_defaults(settings) | |
55 |
|
55 | |||
56 | # if we have enable generation of file, subscribe to event |
|
56 | # if we have enable generation of file, subscribe to event | |
57 | if settings[config_keys.generate_authorized_keyfile]: |
|
57 | if settings[config_keys.generate_authorized_keyfile]: | |
58 | config.add_subscriber( |
|
58 | config.add_subscriber( | |
59 | generate_ssh_authorized_keys_file_subscriber, SshKeyFileChangeEvent) |
|
59 | generate_ssh_authorized_keys_file_subscriber, SshKeyFileChangeEvent) |
General Comments 0
You need to be logged in to leave comments.
Login now