Changeset - 267c0dbcddd3
[Not reviewed]
default
0 2 0
Mads Kiilerich - 6 years ago 2019-06-22 19:46:25
mads@kiilerich.com
kallithea-cli: set ssh_authorized_keys when creating .ini file so it doesn't have to be set manually before using ssh

The user that is creating the .ini will be / should be the kallithea user that also will be used at runtime.
2 files changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_config.py
Show inline comments
 
@@ -53,24 +53,25 @@ def config_create(config_file, key_value
 

	
 
    The primary high level configuration keys and their default values are
 
    shown with --show-defaults . Custom values for these keys can be specified
 
    on the command line as key=value arguments.
 

	
 
    Additional key=value arguments will be patched/inserted in the [app:main]
 
    section ... until another section name specifies where any following values
 
    should go.
 
    """
 

	
 
    mako_variable_values = {
 
        'git_hook_interpreter': sys.executable,
 
        'user_home_path': os.path.expanduser('~'),
 
    }
 
    ini_settings = defaultdict(dict)
 

	
 
    section_name = None
 
    for parameter in key_value_pairs:
 
        parts = parameter.split('=', 1)
 
        if len(parts) == 1 and parameter.startswith('[') and parameter.endswith(']'):
 
            section_name = parameter
 
        elif len(parts) == 2:
 
            key, value = parts
 
            if section_name is None and key in inifile.default_variables:
 
                mako_variable_values[key] = value
kallithea/lib/paster_commands/template.ini.mako
Show inline comments
 
@@ -322,24 +322,27 @@ allow_custom_hooks_settings = True
 
#    INSTALL
 
#    CHANGELOG
 

	
 
<%text>####################################</%text>
 
<%text>###           SSH CONFIG        ####</%text>
 
<%text>####################################</%text>
 

	
 
<%text>## SSH is disabled by default, until an Administrator decides to enable it.</%text>
 
ssh_enabled = false
 

	
 
<%text>## File where users' SSH keys will be stored *if* ssh_enabled is true.</%text>
 
#ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
 
%if user_home_path:
 
ssh_authorized_keys = ${user_home_path}/.ssh/authorized_keys
 
%endif
 

	
 
<%text>## Path to be used in ssh_authorized_keys file to invoke kallithea-cli with ssh-serve.</%text>
 
#kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
 

	
 
<%text>####################################</%text>
 
<%text>###        CELERY CONFIG        ####</%text>
 
<%text>####################################</%text>
 

	
 
use_celery = false
 

	
 
<%text>## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq:</%text>
 
broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost
0 comments (0 inline, 0 general)