allow feedback to issue ziti_dump and collect this information as well

This commit is contained in:
dovholuknf
2021-01-29 19:56:22 -05:00
parent f1be5e309c
commit e85a96fa21
10 changed files with 331 additions and 13 deletions
+4 -1
View File
@@ -285,7 +285,6 @@ namespace ZitiDesktopEdge {
async private void ShowFeedback(object sender, MouseButtonEventArgs e) {
try {
MainWindow.ShowLoad("Collecting Information", "Please wait while we run some commands\nand collect some diagnostic information");
DataClient client = (DataClient)Application.Current.Properties["ServiceClient"];
var mailMessage = new MailMessage("help@openziti.org", "help@openziti.org");
mailMessage.Subject = "Ziti Support";
mailMessage.IsBodyHtml = false;
@@ -296,6 +295,10 @@ namespace ZitiDesktopEdge {
mailMessage.Body = sb.ToString();
string timestamp = DateTime.Now.ToFileTime().ToString();
var dataClient = (DataClient)Application.Current.Properties["ServiceClient"];
await dataClient.zitiDump();
var monitorClient = (MonitorClient)Application.Current.Properties["MonitorClient"];
MonitorServiceStatusEvent resp = await monitorClient.CaptureLogsAsync();
if (resp == null) {
@@ -101,19 +101,24 @@ namespace ZitiDesktopEdge.DataStructures {
public IdentityTogglePayload Payload { get; set; }
}
public class SetLogLevelFunction : ServiceFunction
{
public SetLogLevelFunction(string level)
{
public class SetLogLevelFunction : ServiceFunction {
public SetLogLevelFunction(string level) {
this.Function = "SetLogLevel";
this.Payload = new SetLogLevelPayload()
{
this.Payload = new SetLogLevelPayload() {
Level = level
};
}
public SetLogLevelPayload Payload { get; set; }
}
public class ZitiDumpFunction : ServiceFunction {
public ZitiDumpFunction(string level) {
this.Function = "ZitiDump";
//this.Payload = null;//nothing for now
}
//public SetLogLevelPayload Payload { get; set; }
}
public class FingerprintPayload
{
public string Fingerprint { get; set; }
@@ -250,6 +250,18 @@ namespace ZitiDesktopEdge.ServiceClient {
}
}
async public Task zitiDump() {
try {
await sendAsync(new ServiceFunction() { Function = "ZitiDump" });
var rtn = await readAsync<SvcResponse>(ipcReader);
return; // rtn;
} catch (IOException ioe) {
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
}
async public Task<ZitiTunnelStatus> debugAsync() {
try {
await sendAsync(new ServiceFunction() { Function = "Debug" });
+1 -1
View File
@@ -14,7 +14,7 @@ REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
SET REPO_URL=https://github.com/openziti/ziti-tunnel-sdk-c.git
SET ZITI_TUNNEL_REPO_BRANCH=intercepted.conn.sequenced.close
SET ZITI_TUNNEL_REPO_BRANCH=v0.8.9
REM override the c sdk used in the build - leave blank for the same as specified in the tunneler sdk
SET ZITI_SDK_C_BRANCH=
REM the number of TCP connections the tunneler sdk can have at any one time
+14 -5
View File
@@ -472,20 +472,29 @@ func log_writer_cb(level C.int, loc C.string, msg C.string, msglen C.int) {
}
//export ziti_dump_go_callback
func ziti_dump_go_callback(outputPath *C.char, line *C.char) {
func ziti_dump_go_callback(outputPath *C.char, charData *C.char) {
f, err := os.OpenFile(C.GoString(outputPath),
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Println(err)
log.Warnf("unexpect error opening file: %v", err)
_ = f.Close()
return
}
defer f.Close()
_, _ = f.WriteString(C.GoString(line))
_, _ = f.WriteString("\n")
_, _ = f.WriteString(C.GoString(charData))
_ = f.Close()
}
func ZitiDump(zid *ZIdentity, path string) {
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
e := os.Remove(path)
if e != nil {
//probably did not exist
log.Debugf("Could not remove file at: %s", cpath)
} else {
log.Debugf("Removed existing ziti_dump file at: %s", cpath)
}
C.ziti_dump_go_wrapper(unsafe.Pointer(zid.czctx), cpath)
log.Infof("ziti_dump saved to: %s", path)
}
@@ -0,0 +1,106 @@
=================
Session:
Session Info: id[hNwmz5OZ8] name[NetFoundry_ClintDec17] api_session[QnnNUXslj]
=================
Services:
CSUP_DC_LDWARCNV07_3389: id[2O-zHThGg] perm(dial=true,bind=false)
CSUP_DC_TTDRVWCNV02_443: id[3yAmNThGg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV01_3389: id[60qRNThMR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV09_80: id[7PrzHThGg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV09_443: id[8FXkNT2Mg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV04_443: id[B_gmNo2GR] perm(dial=true,bind=false)
Edge_router_AWS_22: id[D-FqsqO1Y] perm(dial=true,bind=false)
NFTestService_SSH: id[Ht0wKadpE] perm(dial=true,bind=false)
AAD_DC_BAVNWASCNV07_3389: id[I61stwhMR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV02_80: id[JRbkHT2GR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV03_443: id[KN4kNT2MR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV09_3389: id[MB8kHThGg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV08_80: id[N_czHT2GR] perm(dial=true,bind=false)
CSUP_DC_HRWARCNV03_3389: id[PA_c9O1MR] perm(dial=true,bind=false)
CSUP_DC_HRWARCNV03_80: id[SL5iHohMR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV07_443: id[UREzHT2GR] perm(dial=true,bind=false)
Edge_router_DC_22: id[UsZL4JAGg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV02_443: id[Vy0kHohMR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV07_80: id[WFszHT2MR] perm(dial=true,bind=false)
AAD_DC_BAVNWASCNV04_3389: id[Wzdstw2GR] perm(dial=true,bind=false)
CSUP_DC_TTDRVWCNV02_80: id[XzbiHohGR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV01_443: id[YMkzNohMR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV03_80: id[ZBIkHThMg] perm(dial=true,bind=false)
AAD_DC_BAVNWARCNV07_3389: id[bIyPpwhMg] perm(dial=true,bind=false)
NFTestService_RDP: id[dR0uY2GDE] perm(dial=true,bind=false)
CSUP_DC_TTDWARCNV03_80: id[eSiWHo2GR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV04_3389: id[iRqkHohGR] perm(dial=true,bind=false)
NFTestServce_FileShare: id[k5Abb2dDE] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV02_3389: id[lM2zNT2Mg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV03_3389: id[lYZzHT2Mg] perm(dial=true,bind=false)
CSUP_DC_HRWARCNV03_443: id[mFKiNT2MR] perm(dial=true,bind=false)
CSUP_DC_TTDWARCNV03_443: id[oXRWNThMR] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV04_80: id[qWmmNT2Gg] perm(dial=true,bind=false)
CSUP_DC_TTDWARCNV03_3389: id[s73mHo2Gg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV08_443: id[uAFkNThGg] perm(dial=true,bind=false)
NFTestService_SQL: id[uX-30aGpE] perm(dial=true,bind=false)
CSUP_DC_TTDRVWCNV02_3389: id[uqtmHT2Gg] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV01_80: id[wtmkHT2MR] perm(dial=true,bind=false)
Azure Edge router: id[y81jgYRd0] perm(dial=true,bind=false)
CSUP_DC_LDWARCNV08_3389: id[zCHzHohGR] perm(dial=true,bind=false)
==================
Net Sessions:
==================
Channels:
==================
Connections:
==================
@@ -0,0 +1,34 @@
=================
Session:
Session Info: id[SeKrRDtGR] name[clint-thru-us-east] api_session[difqd2zHi]
=================
Services:
hello.ziti.dh: id[QhOGqVpGR] perm(dial=true,bind=false)
mumbai-speedtest: id[kv8opktMg] perm(dial=true,bind=false)
speedtest.e2e: id[nEsdC4pMg] perm(dial=true,bind=false)
speedtest2.us-east.ziti: id[uPHuLFTGR] perm(dial=true,bind=false)
==================
Net Sessions:
==================
Channels:
==================
Connections:
==================
@@ -0,0 +1,90 @@
=================
Session:
Session Info: id[771RPvaHq] name[clint_dovholuk-bastion1] api_session[2ufSdTAUJ]
=================
Services:
spice-console-5901: id[2ux0XDR0x] perm(dial=true,bind=false)
engine1-web: id[4sc-VSa0x] perm(dial=true,bind=false)
engine1-ssh: id[5g36Vva0x] perm(dial=true,bind=false)
router1-web: id[6otFVvR0q] perm(dial=true,bind=false)
spice-console-5908: id[8d1Hima0q] perm(dial=true,bind=false)
spice-console-5903: id[AZ0HimRHx] perm(dial=true,bind=false)
node1-ssh: id[Aq46VSaHx] perm(dial=true,bind=false)
spice-console-5912: id[BVu0XmR0x] perm(dial=true,bind=false)
spice-console-5915: id[CkLhXmRHq] perm(dial=true,bind=false)
spice-console-5900: id[EYcCimR0x] perm(dial=true,bind=false)
spice-console-5919: id[L-NhiDaHq] perm(dial=true,bind=false)
spice-console-5904: id[Mft0Xma0x] perm(dial=true,bind=false)
spice-console-5905: id[OQEHiDR0q] perm(dial=true,bind=false)
spice-console-5917: id[RRGhiDa0x] perm(dial=true,bind=false)
router1-web-ip: id[RWGFVva0x] perm(dial=true,bind=false)
spice-console-5902: id[RbX0XDaHx] perm(dial=true,bind=false)
spice-console-5918: id[XJshima0x] perm(dial=true,bind=false)
gateway-01-ssh: id[Ya76VSRHq] perm(dial=true,bind=false)
node1-idrac-vnc: id[dPJFsSaHq] perm(dial=true,bind=false)
spice-console-5914: id[eG90XDR0q] perm(dial=true,bind=false)
spice-console-5916: id[enw3XmaHq] perm(dial=true,bind=false)
spice-console-5913: id[ffoHimR0q] perm(dial=true,bind=false)
spice-console-5910: id[fzyHXDa0q] perm(dial=true,bind=false)
engine1-websocket: id[iECFVSR0q] perm(dial=true,bind=false)
spice-console-5907: id[ipNHXma0q] perm(dial=true,bind=false)
spice-console-5911: id[jT60XDa0x] perm(dial=true,bind=false)
engine1-portal: id[kIxFsvRHx] perm(dial=true,bind=false)
node1-idrac-ssh: id[kRD6sSaHx] perm(dial=true,bind=false)
spice-console-5906: id[oXV0iDa0x] perm(dial=true,bind=false)
node1-idrac-web: id[oZaFVvR0q] perm(dial=true,bind=false)
node1-idrac-ip: id[pFSFsvRHq] perm(dial=true,bind=false)
spice-console-5909: id[wG.0ima0q] perm(dial=true,bind=false)
==================
Net Sessions:
==================
Channels:
==================
Connections:
==================
@@ -0,0 +1,56 @@
=================
Session:
Session Info: id[P71KZETMg] name[mattermost.clint.dovholuk.desktop] api_session[IE2lYdAo7]
=================
Services:
Mattermost.ziti.com: id[sX1aKGoGR] perm(dial=true,bind=false)
==================
Net Sessions:
4JW5YdAju: service_id[sX1aKGoGR]
==================
Channels:
ch[3](Mattermost-Public-Edge-us-east-1-2@tls://3.89.54.6:443)
connected [latency=43]
ch[2](Mattermost-Public-Edge-ap-south-1@tls://52.66.203.222:443)
connected [latency=226]
ch[1](Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443)
connected [latency=39]
ch[0](Mattermost-Public-Edge-us-east-1-1@tls://34.225.67.34:443)
connected [latency=49]
==================
Connections:
conn[7]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
conn[6]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
conn[5]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
conn[4]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
conn[3]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
conn[2]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
conn[1]: state[Connected] service[Mattermost.ziti.com] using ch[1] Mattermost-Public-Edge-us-east-2-1@tls://18.190.98.221:443
==================
+3
View File
@@ -432,11 +432,14 @@ func serveIpc(conn net.Conn) {
case "SetLogLevel":
setLogLevel(enc, cmd.Payload["Level"].(string))
case "ZitiDump":
log.Debug("request to ZitiDump received")
for _, id := range rts.ids {
if id.CId != nil {
cziti.ZitiDump(id.CId, fmt.Sprintf(`%s\%s.ziti.txt`, config.LogsPath(), id.Name))
}
}
log.Debug("request to ZitiDump complete")
respond(enc, dto.Response{Message: "ZitiDump complete", Code: SUCCESS, Error: "", Payload: nil})
case "Debug":
dbg()
respond(enc, dto.Response{