get-hosts fixes

This commit is contained in:
max furman 2019-10-26 17:40:26 -07:00
parent 5616386eed
commit 862d704f6b
3 changed files with 4 additions and 5 deletions

View file

@ -257,7 +257,7 @@ func (h *caHandler) Route(r Router) {
r.MethodFunc("POST", "/ssh/config", h.SSHConfig) r.MethodFunc("POST", "/ssh/config", h.SSHConfig)
r.MethodFunc("POST", "/ssh/config/{type}", h.SSHConfig) r.MethodFunc("POST", "/ssh/config/{type}", h.SSHConfig)
r.MethodFunc("POST", "/ssh/check-host", h.SSHCheckHost) r.MethodFunc("POST", "/ssh/check-host", h.SSHCheckHost)
r.MethodFunc("POST", "/ssh/get-hosts", h.SSHGetHosts) r.MethodFunc("GET", "/ssh/get-hosts", h.SSHGetHosts)
// For compatibility with old code: // For compatibility with old code:
r.MethodFunc("POST", "/re-sign", h.Renew) r.MethodFunc("POST", "/re-sign", h.Renew)

View file

@ -611,9 +611,8 @@ func (c *Client) SSHCheckHost(principal string) (*api.SSHCheckPrincipalResponse,
return &check, nil return &check, nil
} }
// SSHGetHostPrincipals performs the POST /ssh/check-host request to the CA with the // SSHGetHosts performs the GET /ssh/get-hosts request to the CA.
// given principal. func (c *Client) SSHGetHosts() (*api.SSHGetHostsResponse, error) {
func (c *Client) SSHGetHostPrincipals() (*api.SSHGetHostsResponse, error) {
u := c.endpoint.ResolveReference(&url.URL{Path: "/ssh/get-hosts"}) u := c.endpoint.ResolveReference(&url.URL{Path: "/ssh/get-hosts"})
resp, err := c.client.Get(u.String()) resp, err := c.client.Get(u.String())
if err != nil { if err != nil {

View file

@ -67,7 +67,7 @@ func New(c *Config) (AuthDB, error) {
tables := [][]byte{ tables := [][]byte{
revokedCertsTable, certsTable, usedOTTTable, revokedCertsTable, certsTable, usedOTTTable,
sshCertsTable, sshHostsTable, sshUsersTable, sshCertsTable, sshHostsTable, sshHostPrincipalsTable, sshUsersTable,
} }
for _, b := range tables { for _, b := range tables {
if err := db.CreateTable(b); err != nil { if err := db.CreateTable(b); err != nil {