initial commit
This commit is contained in:
		
							부모
							
								
									369874975f
								
							
						
					
					
						커밋
						3973ce8db9
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,3 +1,5 @@
 | 
			
		||||
etc
 | 
			
		||||
 | 
			
		||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
 | 
			
		||||
*.o
 | 
			
		||||
*.a
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										53
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								README.md
									
									
									
									
									
								
							@ -1,2 +1,53 @@
 | 
			
		||||
# golang-https-example
 | 
			
		||||
golang-https-example
 | 
			
		||||
====================
 | 
			
		||||
 | 
			
		||||
A TLS /  SSL enabled WebServer in Go with, done right - includes valid https certificates.
 | 
			
		||||
 | 
			
		||||
Install
 | 
			
		||||
=======
 | 
			
		||||
 | 
			
		||||
Install the server and some certificates
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# Clone this repo
 | 
			
		||||
git clone git@github.com:coolaj86/golang-https-example.git
 | 
			
		||||
pushd golang-https-example
 | 
			
		||||
 | 
			
		||||
# Clone some valid dummy certificates
 | 
			
		||||
git clone git@github.com:Daplie/localhost.daplie.com-certificates.git \
 | 
			
		||||
  ./etc/letsencrypt/live/localhost.daplie.com/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Test
 | 
			
		||||
====
 | 
			
		||||
 | 
			
		||||
Run the server
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# Run the Code
 | 
			
		||||
go run serve.go --port 8443 --letsencrypt-dir=./etc/letsencrypt/live/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
View it in your browser
 | 
			
		||||
 | 
			
		||||
<https://localhost.daplie.com:8443>
 | 
			
		||||
 | 
			
		||||
Test it with `openssl`
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
openssl s_client -showcerts \
 | 
			
		||||
  -connect localhost:8443 \
 | 
			
		||||
  -servername localhost.daplie.com \
 | 
			
		||||
  -CAfile ./etc/letsencrypt/live/localhost.daplie.com/certs/ca/root.pem
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Test it with `curl`
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
# should work
 | 
			
		||||
curl https://localhost.daplie.com:8443
 | 
			
		||||
 | 
			
		||||
# if the Root CA isn't in your bundle
 | 
			
		||||
curl https://localhost.daplie.com:8443 \
 | 
			
		||||
  --cacert=./etc/letsencrypt/live/localhost.daplie.com/certs/ca/root.pem
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										0
									
								
								etc/letsencrypt/live/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								etc/letsencrypt/live/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
		불러오는 중...
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user