Skip to content
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

Make Context conform to "x/crypto/ssh".ConnMetadata interface #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 21, 2019

  1. Make Context implement "x/crypto/ssh".ConnMetadata interface

    It's useful for this package's sshContext to implement ConnMetadata when you
    want to authenticate user certificates from a PublicKeyHandler.
    
    Somewhat realistic example of user certificate checking after this patch:
    
        checker := gossh.CertChecker{
            IsUserAuthority: func(pub gossh.PublicKey) bool {
                // our own logic to check whether pub is acceptable
                return true
            }
        }
    
        func isUserCertOk(ctx ssh.Context, key ssh.PublicKey) bool {
            if cert, ok := key.(*gossh.Certificate); ok {
                _, err := checker.Authenticate(ctx, cert)
            }
        }
    
        sshServer := &ssh.Server{
            // ...
            PublicKeyHandler: isUserCertOK,
        }
    ransford-stripe committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    27642ab View commit details
    Browse the repository at this point in the history