Esempio n. 1
0
    def __init__(self, hostname, key, message):
        from reviewboard.scmtools.sshutils import humanize_key

        SCMError.__init__(self, message)
        self.hostname = hostname
        self.key = humanize_key(key)
        self.raw_key = key
Esempio n. 2
0
    def __init__(self, hostname, key, message):
        from reviewboard.scmtools.sshutils import humanize_key

        SCMError.__init__(self, message)
        self.hostname = hostname
        self.key = humanize_key(key)
        self.raw_key = key
Esempio n. 3
0
    def __init__(self, hostname, key, expected_key):
        from reviewboard.scmtools.sshutils import humanize_key

        SSHKeyError.__init__(
            self, hostname, key,
            _("Warning! The host key for server %(hostname)s does not match "
              "the expected key.\n"
              "It's possible that someone is performing a man-in-the-middle "
              "attack. It's also possible that the RSA host key has just "
              "been changed. Please contact your system administrator if "
              "you're not sure. Do not accept this host key unless you're "
              "certain it's safe!") % {
                  'hostname': hostname,
                  'ip_address': socket.gethostbyname(hostname),
              })
        self.expected_key = humanize_key(expected_key)
        self.raw_expected_key = expected_key
Esempio n. 4
0
    def __init__(self, hostname, key, expected_key):
        from reviewboard.scmtools.sshutils import humanize_key

        SSHKeyError.__init__(
            self, hostname, key,
            _("Warning! The host key for server %(hostname)s does not match "
              "the expected key.\n"
              "It's possible that someone is performing a man-in-the-middle "
              "attack. It's also possible that the RSA host key has just "
              "been changed. Please contact your system administrator if "
              "you're not sure. Do not accept this host key unless you're "
              "certain it's safe!")
            % {
                'hostname': hostname,
                'ip_address': socket.gethostbyname(hostname),
            })
        self.expected_key = humanize_key(expected_key)
        self.raw_expected_key = expected_key
Esempio n. 5
0
    if request.method == 'POST':
        form = SSHSettingsForm(request.POST, request.FILES)

        if form.is_valid():
            try:
                form.create(request.FILES)
                return HttpResponseRedirect('.')
            except Exception, e:
                # Fall through. It will be reported inline and in the log.
                logging.error('Uploading SSH key failed: %s' % e)
    else:
        form = SSHSettingsForm()

    if key:
        fingerprint = sshutils.humanize_key(key)
    else:
        fingerprint = None

    return render_to_response(template_name, RequestContext(request, {
        'title': _('SSH Settings'),
        'key': key,
        'fingerprint': fingerprint,
        'public_key': sshutils.get_public_key(key),
        'form': form,
    }))


def manual_updates_required(request,
                            template_name="admin/manual_updates_required.html"):
    """
Esempio n. 6
0
        form = SSHSettingsForm(request.POST, request.FILES)

        if form.is_valid():
            try:
                form.create(request.FILES)
                return HttpResponseRedirect('.')
            except Exception, e:
                # Fall through. It will be reported inline and in the log.
                logging.error('Uploading SSH key failed: %s' % e)
    else:
        form = SSHSettingsForm()

    public_key = ''

    if key:
        fingerprint = sshutils.humanize_key(key)
    else:
        fingerprint = None

    return render_to_response(
        template_name,
        RequestContext(
            request, {
                'title': _('SSH Settings'),
                'key': key,
                'fingerprint': fingerprint,
                'public_key': sshutils.get_public_key(key),
                'form': form,
            }))