maatma: automatically sync wg config after public key reception

This commit is contained in:
nemunaire 2019-03-16 02:45:59 +01:00
parent 8c881b0e3a
commit 748939c3b4

View File

@ -110,6 +110,8 @@ func getWgTunnelInfo(w http.ResponseWriter, r *http.Request, ps httprouter.Param
return return
} }
syncWgConf()
tinfo := getTunnelInfo(token.IdStudent) tinfo := getTunnelInfo(token.IdStudent)
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
@ -264,6 +266,13 @@ AllowedIPs = %s/%d
return nil return nil
} }
func syncWgConf() (err error) {
_, err = exec.Command("sh", "/root/wg-sync.sh").Output()
return
}
type WGDump struct { type WGDump struct {
PubKey string PubKey string
PSK string PSK string