Skip to content

Commit

Permalink
Chore: HTTPS as default way to run OpenRegistry through Open SSL
Browse files Browse the repository at this point in the history
this PR resolves issue #83
  • Loading branch information
guacamole committed Mar 1, 2022
1 parent 5aff9e5 commit be0766c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ OpenRegistry.yml
config.yaml
config.yml
.cache_ggshield
.certs
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ mod-fix:
tools:
pip3 install ggshield pre-commit
pre-commit install

certs:
bash scripts/localcerts.sh
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ func main() {
}

router.Register(cfg, e, reg, authSvc, localCache, pgStore)
logger.Errorf("error initialising OpenRegistry Server: %s", e.Start(cfg.Registry.Address()))
logger.Errorf("error initialising OpenRegistry Server: %s",
e.StartTLS(cfg.Registry.Address(), ".certs/openregistry.local.crt", ".certs/openregistry.local.key"))
}
8 changes: 8 additions & 0 deletions scripts/localcerts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

DOMAIN="openregistry.local"
CERTS_DIR=".certs"
mkdir -p ${CERTS_DIR}
openssl req -newkey rsa:2048 -nodes -keyout ${CERTS_DIR}/${DOMAIN}.key -x509 -days 365 -out ${CERTS_DIR}/${DOMAIN}.crt -subj \
"/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=${DOMAIN}"

0 comments on commit be0766c

Please sign in to comment.