mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 11:46:40 +00:00
pregenerate RSA keys for testrig accounts. If a user is added without a key, the testrig will panic and provide a key to paste in (#287)
This commit is contained in:
parent
7e4c3fa5c7
commit
26a95ad27d
|
@ -25,6 +25,7 @@
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -483,23 +484,46 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preserializedKeys := []string {
|
||||||
|
"MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDGj2wLnDIHnP6wjJ+WmIhp7NGAaKWwfxBWfdMFR+Y0ilkK5ld5igT45UHAmzN3v4HcwHGGpPITD9caDYj5YaGOX+dSdGLgXWwItR0j+ivrHEJmvz8hG6z9wKEZKUUrRw7Ob72S0LOsreq98bjdiWJKHNka27slqQjGyhLQtcg6pe1CLJtnuJH4GEMLj7jJB3/Mqv3vl5CQZ+Js0bXfgw5TF/x/Bzq/8qsxQ1vnmYHJsR0eLPEuDJOvoFPiJZytI09S7qBEJL5PDeVSfjQi3o71sqOzZlEL0b0Ny48rfo/mwJAdkmfcnydRDxeGUEqpAWICCOdUL0+W3/fCffaRZsk1AgMBAAECggEAUuyO6QJgeoF8dGsmMxSc0/ANRp1tpRpLznNZ77ipUYP9z+mG2sFjdjb4kOHASuB18aWFRAAbAQ76fGzuqYe2muk+iFcG/EDH35MUCnRuZxA0QwjX6pHOW2NZZFKyCnLwohJUj74Na65ufMk4tXysydrmaKsfq4i+m5bE6NkiOCtbXsjUGVdJKzkT6X1gEyEPEHgrgVZz9OpRY5nwjZBMcFI6EibFnW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0N86nWWPBaC5YJzK+qyh1huQxk8DWdY6VXPshs+vYTCsV5d6KZKKN3S5yR7Hir6lxT4sP30UR7WmIib5o90r+lO5xjdlqQMhl0fgXM48h+iyyHuaG8LQ274whhazccM1l683/6Cfg/hVDnJUfsRhTU1aQgECgYBrZPTZcf6+u+I3qHcqNYBl2YPUCly/+7LsJzVB2ebxlCSqwsq5yamn0fRxiMq7xSVvPXm+1b6WwEUH1mIMqiKMhk1hQJkVMMsRCRVJioqxROa8hua4G6xWI1riN8lp8hraCwl+NXEgi37ESgLjEFBvPGegH+BNbWgzeU2clcrGlwKBgHBxlFLf6AjDxjR8Z5dnZVPyvLOUjejs5nsLdOfONJ8F/MU0PoKFWdBavhbnwXwium6NvcearnhbWL758sKooZviQL6m/sKDGWMq3O8SCnX+TKTEOw+kLLFn4L3sT02WaHYg+C5iVEDdGlsXSehhI2e7hBoTulE/zbUkbA3+wlmv",
|
||||||
|
}
|
||||||
|
|
||||||
|
if diff := len(accounts) - len(preserializedKeys); diff > 0 {
|
||||||
|
var keyStrings = make([]string, diff)
|
||||||
|
for i := 0; i < diff; i ++ {
|
||||||
|
priv, _ := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
|
key, _ := x509.MarshalPKCS8PrivateKey(priv)
|
||||||
|
keyStrings = append(keyStrings, base64.StdEncoding.EncodeToString(key))
|
||||||
|
}
|
||||||
|
panic(fmt.Sprintf("mismatch between number of hardcoded test RSA keys and accounts used for test data. Insert the following generated key[s]: \n%+v", keyStrings))
|
||||||
|
}
|
||||||
|
|
||||||
// generate keys for each account
|
// generate keys for each account
|
||||||
|
i := 0
|
||||||
for _, v := range accounts {
|
for _, v := range accounts {
|
||||||
priv, err := rsa.GenerateKey(rand.Reader, 2048)
|
premadeBytes, err := base64.StdEncoding.DecodeString(preserializedKeys[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
pub := &priv.PublicKey
|
key, err := x509.ParsePKCS8PrivateKey(premadeBytes)
|
||||||
|
if err != nil {
|
||||||
// normally only local accounts get a private key (obviously)
|
panic(err)
|
||||||
// but for testing purposes and signing requests, we'll give
|
}
|
||||||
// remote accounts a private key as well
|
priv, ok := key.(*rsa.PrivateKey)
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Sprintf("generated key at index %d is of incorrect type", i))
|
||||||
|
}
|
||||||
v.PrivateKey = priv
|
v.PrivateKey = priv
|
||||||
v.PublicKey = pub
|
v.PublicKey = &priv.PublicKey
|
||||||
|
i++
|
||||||
}
|
}
|
||||||
return accounts
|
return accounts
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTestAttachments returns a map of attachments keyed according to which account
|
// NewTestAttachments returns a map of attachments keyed according to which account
|
||||||
// and status they belong to, and which attachment number of that status they are.
|
// and status they belong to, and which attachment number of that status they are.
|
||||||
func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||||
|
|
Loading…
Reference in a new issue