Skip to content

Commit

Permalink
update to use TLS encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
gilgameshskytrooper committed Jan 6, 2018
1 parent baef4b5 commit 3eb7ca4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ public/json/\._time\.txt
main
prometheus
Macbook
server.crt
server.key
8 changes: 6 additions & 2 deletions prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ func main() {

if EnableLed {
if foundNixie {
fmt.Println(nixie.CurrentTimeAsString() + Red + Green + Blue)
b := []byte(nixie.CurrentTimeAsString() + Red + Green + Blue)
_, err := port.Write(b)
if err != nil {
Expand Down Expand Up @@ -1485,5 +1484,10 @@ func main() {
//Pass on the AJAX post /upload handler to the uploadHandler() function
http.HandleFunc("/upload", uploadHandler)
log.Println("Listening...")
log.Fatal(http.ListenAndServe(":3000", nil))
tlserr := http.ListenAndServeTLS(":3000", "server.crt", "server.key", nil)
if tlserr != nil {
fmt.Println("If you want the program to utilize TLS (i.e. host an encrypted HTTPS front end, please do the following in command line in the same directory as prometheus.go to first create a private self-signed rsa key, then a public key (x509) key based on the private key:\n\topenssl genrsa -out server.key 2048\n\topenssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650\nThen make sure you finish filling in the details asked in command line.\n\nFor now, unencrypted http will be used.")
log.Fatal(http.ListenAndServe(":3000", nil))
}

}
8 changes: 4 additions & 4 deletions public/json/alarms.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[{"name":"alarm1","time":"01:31","sound":"off","vibration":"off"},
{"name":"alarm2","time":"06:00","sound":"off","vibration":"off"},
{"name":"alarm3","time":"19:47","sound":"off","vibration":"off"},
{"name":"alarm4","time":"19:48","sound":"off","vibration":"off"}]
[{"name":"alarm1","time":"16:59","sound":"off","vibration":"off"},
{"name":"alarm2","time":"08:00","sound":"off","vibration":"off"},
{"name":"alarm3","time":"00:12","sound":"off","vibration":"off"},
{"name":"alarm4","time":"09:00","sound":"off","vibration":"off"}]
2 changes: 1 addition & 1 deletion public/json/colors
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#ffffff
#dbff00
2 changes: 1 addition & 1 deletion public/json/enableemail
Original file line number Diff line number Diff line change
@@ -1 +1 @@
true
false
2 changes: 1 addition & 1 deletion public/json/enableled
Original file line number Diff line number Diff line change
@@ -1 +1 @@
false
true
2 changes: 1 addition & 1 deletion public/json/ip
Original file line number Diff line number Diff line change
@@ -1 +1 @@
130.71.230.216
130.71.230.235

0 comments on commit 3eb7ca4

Please sign in to comment.