Skip to content

[Feature] HTTPS and CA Certificates#65

Open
cprbucat2 wants to merge 7 commits into
mainfrom
cprbucat2/issue62
Open

[Feature] HTTPS and CA Certificates#65
cprbucat2 wants to merge 7 commits into
mainfrom
cprbucat2/issue62

Conversation

@cprbucat2
Copy link
Copy Markdown
Owner

@cprbucat2 cprbucat2 commented Jul 18, 2023

Old behavior

Cannot have authentication without HTTPS.

New behavior

  • Installed user CA cerificates into the production Docker image
  • Generated CA certificates for development
  • Added HTTPS to Go server
  • Change port number from 8080 to 8443
  • Upgrade HTTP to HTTPS

Additional info (related issues, images, etc.)

Closes #62

-Installed user CA cerificates into the production Docker image
-Generated CA certificates for development
-Added HTTPS to Go server
@bobpaw
Copy link
Copy Markdown
Collaborator

bobpaw commented Jul 21, 2023

Might need to do

RUN apk --no-cache add ca-certificates && update-ca-certificates

Delete accidental duplicated Dockerfile
Remove unneccessary expose port line
@cprbucat2
Copy link
Copy Markdown
Owner Author

To pass Go CI / lint check
Signed-off-by: Aidan Hoover <96591790+cprbucat2@users.noreply.github.com>
@cprbucat2 cprbucat2 marked this pull request as ready for review August 4, 2023 18:07
Comment thread Dockerfile
Comment thread Dockerfile
Comment thread app/app.go

func redirect(w http.ResponseWriter, req *http.Request) {
log.Print(req.Host)
req.URL.Host = req.Host[:len(req.Host)-3] + "443"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs a comment to explain what it's doing. Also maybe we should not do it by length because what if somebody decides they want to do it on port 80 and now this fucks up everything by removing the colon.

Comment thread app/app.go
func main() {
// redirect every http request to https
go func() {
err := http.ListenAndServe(":8080", http.HandlerFunc(redirect))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the ports to 80

Comment thread app/app.go
router.POST("/api/submit", postUserSubmission)

if err := router.Run("0.0.0.0:8080"); err != nil {
if err := router.RunTLS("0.0.0.0:8443", "/etc/ssl/certs/cert.pem", "/etc/ssl/certs/key.pem"); err != nil {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets change it to just 443 and rewrite it to 8443 in the docker compose file

Comment thread docker-compose.yml
target: server
tty: true # Get colorized Gin output.
ports:
- 8443:8443
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it 80 and 443 in the production docker compose file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTPS

2 participants