mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 20:39:57 +00:00
AUTH-3455: Generate short-lived ssh cert per hostname
This commit is contained in:
@@ -2,6 +2,7 @@ package token
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -11,6 +12,16 @@ import (
|
||||
"github.com/cloudflare/cloudflared/config"
|
||||
)
|
||||
|
||||
// GenerateSSHCertFilePathFromURL will return a file path for creating short lived certificates
|
||||
func GenerateSSHCertFilePathFromURL(url *url.URL, suffix string) (string, error) {
|
||||
configPath, err := getConfigPath()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
name := strings.Replace(fmt.Sprintf("%s%s-%s", url.Hostname(), url.EscapedPath(), suffix), "/", "-", -1)
|
||||
return filepath.Join(configPath, name), nil
|
||||
}
|
||||
|
||||
// GenerateAppTokenFilePathFromURL will return a filepath for given Access org token
|
||||
func GenerateAppTokenFilePathFromURL(appDomain, aud string, suffix string) (string, error) {
|
||||
configPath, err := getConfigPath()
|
||||
|
Reference in New Issue
Block a user