mirror of
https://github.com/azukaar/Cosmos-Server.git
synced 2026-05-24 14:28:41 -05:00
[release] v0.21.0-unstable96
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.21.0-unstable95",
|
||||
"version": "0.21.0-unstable96",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
||||
@@ -16,13 +16,6 @@ type DeviceEditRequestJSON struct {
|
||||
}
|
||||
|
||||
func DeviceEdit_API(w http.ResponseWriter, req *http.Request) {
|
||||
if utils.FBL.AgentMode {
|
||||
utils.Error("Constellation: Agents cannot manage devices. Use a manager server", nil)
|
||||
utils.HTTPError(w, "Constellation Error: Agents cannot manage devices. Use a manager server",
|
||||
http.StatusInternalServerError, "UC001")
|
||||
return
|
||||
}
|
||||
|
||||
if req.Method != "POST" {
|
||||
utils.Error("DeviceEdit: Method not allowed "+req.Method, nil)
|
||||
utils.HTTPError(w, "Method not allowed", http.StatusMethodNotAllowed, "HTTP001")
|
||||
|
||||
@@ -940,9 +940,22 @@ func populateIPTableMasquerade() {
|
||||
if err != nil {
|
||||
utils.Error("Constellation: Failed to check existing iptables rules", err)
|
||||
// Continue anyway
|
||||
} else if strings.Contains(string(output), "COSMOS-CLOUD-EXIT-NODE") {
|
||||
utils.Log("Constellation: IPTables rules already exist, skipping")
|
||||
return
|
||||
}
|
||||
|
||||
// Remove rules with our comment marker from nat table (IP range might have changed)
|
||||
cmd = exec.Command("sh", "-c", "iptables-save -t nat | grep 'COSMOS-CLOUD-EXIT-NODE' | grep '^-A' | sed 's/-A/-D/' | xargs -r -L1 iptables -t nat")
|
||||
if err := cmd.Run(); err != nil {
|
||||
utils.Error("Constellation: Error removing NAT rules", err)
|
||||
} else {
|
||||
utils.Log("Constellation: NAT rules removed")
|
||||
}
|
||||
|
||||
// Remove rules with our comment marker from filter table
|
||||
cmd = exec.Command("sh", "-c", "iptables-save | grep 'COSMOS-CLOUD-EXIT-NODE' | grep '^-A' | sed 's/-A/-D/' | xargs -r -L1 iptables")
|
||||
if err := cmd.Run(); err != nil {
|
||||
utils.Error("Constellation: Error removing FORWARD rules", err)
|
||||
} else {
|
||||
utils.Log("Constellation: FORWARD rules removed")
|
||||
}
|
||||
|
||||
// Add iptables rules with comment markers
|
||||
|
||||
Reference in New Issue
Block a user