Skip to content

Certs #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ local
libssh/compile_commands.json
wheelhouse
.idea
tests/unit_test_cert_key-cert.pub
33 changes: 33 additions & 0 deletions examples/exec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
import pwd
import socket

from ssh.session import Session
from ssh import options

# Linux only
USERNAME = pwd.getpwuid(os.geteuid()).pw_name
HOST = 'localhost'
PORT = 22

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))

s = Session()
s.options_set(options.HOST, HOST)
s.options_set(options.USER, USERNAME)
s.options_set_port(PORT)
s.set_socket(sock)
s.connect()

# Authenticate with agent
s.userauth_agent(USERNAME)

chan = s.channel_new()
chan.open_session()
chan.request_exec('echo me')
size, data = chan.read()
while size > 0:
print(data.strip())
size, data = chan.read()
chan.close()
15 changes: 14 additions & 1 deletion ssh/c_ssh.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,14 @@ cdef extern from "libssh/libssh.h" nogil:
SSH_KEYTYPE_ECDSA,
SSH_KEYTYPE_ED25519,
SSH_KEYTYPE_DSS_CERT01,
SSH_KEYTYPE_RSA_CERT01
SSH_KEYTYPE_RSA_CERT01,
SSH_KEYTYPE_ECDSA_P256,
SSH_KEYTYPE_ECDSA_P384,
SSH_KEYTYPE_ECDSA_P521,
SSH_KEYTYPE_ECDSA_P256_CERT01,
SSH_KEYTYPE_ECDSA_P384_CERT01,
SSH_KEYTYPE_ECDSA_P521_CERT01,
SSH_KEYTYPE_ED25519_CERT01
enum ssh_keycmp_e:
SSH_KEY_CMP_PUBLIC,
SSH_KEY_CMP_PRIVATE
Expand Down Expand Up @@ -452,6 +459,12 @@ cdef extern from "libssh/libssh.h" nogil:

const char *ssh_pki_key_ecdsa_name(const ssh_key key)

char *ssh_get_fingerprint_hash(ssh_publickey_hash_type type,
unsigned char *hash,
size_t len)
void ssh_print_hash(ssh_publickey_hash_type type,
unsigned char *hash,
size_t len)
void ssh_print_hexa(
const char *descr, const unsigned char *what, size_t len)
int ssh_send_ignore(ssh_session session, const char *data)
Expand Down
Loading