pki: fix team association, complement to 68e5c4cd2b
The fix introduced in the referenced commit was not working. This time, it has been tested with the following commands: # Associate all certificate to a team curl http://localhost:8081/api/certs/ | jq -r .[].id | while read CERTID; do curl -X PUT -d '{"id_team":1}' http://localhost:8081/api/certs/$CERTID; done # For each certificate associated with the team, try to connect to the server with each certificate. Report failing certificates. curl -s http://localhost:8081/api/teams/1/certificates | jq -r '.[] | .id + " " + .password' | while read CERTID PASSWORD; do curl -sf --cert-type P12 --cert $CERTID.p12:$PASSWORD https://fic.srs.epita.fr/my.json > /dev/null || echo $CERTID; done
This commit is contained in:
parent
b778d29dd9
commit
771627a0da
@ -3,6 +3,7 @@ package pki
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -12,7 +13,7 @@ import (
|
|||||||
const SymlinkPrefix = "_AUTH_ID_"
|
const SymlinkPrefix = "_AUTH_ID_"
|
||||||
|
|
||||||
func GetCertificateAssociation(serial uint64) string {
|
func GetCertificateAssociation(serial uint64) string {
|
||||||
return fmt.Sprintf(SymlinkPrefix + "%0X", serial)
|
return fmt.Sprintf(SymlinkPrefix + "%0[2]*[1]X", serial, int(math.Ceil(math.Log2(float64(serial))/8)*2))
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAssociations(dirname string) (assocs []string, err error) {
|
func GetAssociations(dirname string) (assocs []string, err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user