1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Work in bernhardreiter's PR#4.

This commit is contained in:
Sascha L. Teichmann 2021-12-01 19:35:19 +01:00
parent 70eb8875a4
commit f2d8cd1e90
2 changed files with 7 additions and 7 deletions

View file

@ -14,7 +14,7 @@ const (
defaultConfigPath = "/usr/lib/casf/config.toml"
defaultFolder = "/var/www/"
defaultWeb = "/var/www/html"
defaultPGPURL = "http://pgp.mit.edu/pks/lookup?search=${KEY}&op=index"
defaultOpenPGPURL = "https://openpgp.circl.lu/pks/lookup?search=${KEY}&op=index"
)
type config struct {
@ -23,7 +23,7 @@ type config struct {
Web string `toml:"web"`
TLPs []tlp `toml:"tlps"`
UploadSignature bool `toml:"upload_signature"`
PGPURL string `toml:"pgp_url"`
OpenPGPURL string `toml:"openpgp_url"`
Domain string `toml:"domain"`
NoPassphrase bool `toml:"no_passphrase"`
Publisher *csaf.Publisher `toml:"publisher"`
@ -56,8 +56,8 @@ func (t *tlp) UnmarshalText(text []byte) error {
return fmt.Errorf("invalid config TLP value: %v", string(text))
}
func (cfg *config) GetPGPURL(key string) string {
return strings.ReplaceAll(cfg.PGPURL, "${KEY}", key)
func (cfg *config) GetOpenPGPURL(key string) string {
return strings.ReplaceAll(cfg.OpenPGPURL, "${KEY}", key)
}
func (cfg *config) modelTLPs() []csaf.TLPLabel {
@ -98,8 +98,8 @@ func loadConfig() (*config, error) {
cfg.TLPs = []tlp{tlpCSAF, tlpWhite, tlpGreen, tlpAmber, tlpRed}
}
if cfg.PGPURL == "" {
cfg.PGPURL = defaultPGPURL
if cfg.OpenPGPURL == "" {
cfg.OpenPGPURL = defaultOpenPGPURL
}
return &cfg, nil

View file

@ -339,7 +339,7 @@ func (c *controller) upload(rw http.ResponseWriter, r *http.Request) {
// TODO: Check for conflicts.
pmd.Publisher = ex.publisher
pmd.SetPGP(fingerprint, c.cfg.GetPGPURL(fingerprint))
pmd.SetPGP(fingerprint, c.cfg.GetOpenPGPURL(fingerprint))
return nil
}); err != nil {