kdudkov / goatak

go ATAK/CivTAK fast and simple server and client
https://github.com/kdudkov/goatak/wiki
GNU Affero General Public License v3.0
117 stars 32 forks source link

iTAK fails to connect #21

Open gressdave58 opened 2 months ago

gressdave58 commented 2 months ago

Using clone setup // no ssl : I would say the WARN "error client" message should be a true ERROR

any ideas ? thanks

time=2024-08-26T21:15:12.620-04:00 level=DEBUG msg="200 GET /connections " logger=admin_api client=127.0.0.1:62025 status=200 ms=0 time=2024-08-26T21:15:13.199-04:00 level=INFO msg="TCP connection from174.196.128.181:6119" DG NewApp:AddClientHandler.. enter time=2024-08-26T21:15:13.207-04:00 level=INFO msg=starting client=tcp:174.196.128.181:6119 time=2024-08-26T21:15:13.207-04:00 level=DEBUG msg="send version msg" client=tcp:174.196.128.181:6119 time=2024-08-26T21:15:13.209-04:00 level=WARN msg=error client=tcp:174.196.128.181:6119 error="bad xml: <\x05\xd4c\xb8\x17B\f\x00\x00,\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\b\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9d\x00\x9c\x00=\x00<" time=2024-08-26T21:15:13.210-04:00 level=INFO msg=stopping client=tcp:174.196.128.181:6119 time=2024-08-26T21:15:13.210-04:00 level=INFO msg="remove handler: tcp:174.196.128.181:6119" time=2024-08-26T21:15:13.211-04:00 level=DEBUG msg="sending <event version=\"2.0\" type=\"t-x-takp-v\" uid=\"protouid\" time=\"2024-08-27T01:15:13.208283Z\" start=\"2024-08-27T01:15:13.208284Z\" stale=\"2024-08-27T01:16:13.208284Z\" how=\"m-g\"><TakProtocolSupport version=\"1\"><point lat=\"0\" lon=\"0\" hae=\"0\" ce=\"999999\" le=\"999999\">" client=tcp:174.196.128.181:6119 time=2024-08-26T21:15:13.211-04:00 level=ERROR msg="error sending ver req" client=tcp:174.196.128.181:6119 error="client is off" time=2024-08-26T21:15:13.626-04:00 level=DEBUG msg="200 GET /connections " logger=admin_api client=127.0.0.1:62025 status=200 ms=0

kdudkov commented 2 months ago

looks like malformed xml from your client. What is your client version and connect string?

gressdave58 commented 2 months ago

Hey thanks for the response.. This am i debugged it a little better: On connect looks like there is no xml being sent as show in the processXMLRead below.

Do you know of a iPhone comparable client ?

274: //nolint:nilnil 275: func (h ConnClientHandler) processXMLRead(er cot.TagReader) (*cot.CotMessage, error) { 276: tag, dat, err := er.ReadTag() => 277: if err != nil { 278: return nil, err 279: } 280: 281: if tag == "?xml" { 282: return nil, nil (dlv) p tag

""(dlv) p dat[]uint8 len: 0, cap: 0, nil(dlv) p errerror(errors.errorString) {s: "EOF"} (dlv) n

github.com/kdudkov/goatak/internal/client.(ConnClientHandler).processXMLRead() ./internal/client/client_handler.go:278 (PC: 0xa57e405) Warning: debugging optimized function 273: 274: //nolint:nilnil 275: func (h ConnClientHandler) processXMLRead(er cot.TagReader) (cot.CotMessage, error) { 276: tag, dat, err := er.ReadTag() 277: if err != nil { => 278: return nil, err 279: } 280: 281: if tag == "?xml" { 282: return nil, nil 283: }

---- sorry still learning the protocol I did see this from client / wireshark on the PSH,ACK

Then client sends FIN,ACK

** I'll have to read this cat protobuf/protocol.txt

Client i was using was iTAK from US Army V2.9.2 build 629, i don't have protocol spec yet...

PS: Nice code base, looks very tight and clean..

<--- went into the processXMLReader as h.GetVersion() == 0 func (h *ConnClientHandler) handleRead(ctx context.Context) { defer h.Stop()

    er := cot.NewTagReader(h.conn)
    pr := cot.NewProtoReader(h.conn)

    for ctx.Err() == nil {
            var msg *cot.CotMessage

            var err error

            switch h.GetVersion() {
            case 0:
                    msg, err = h.processXMLRead(er)
            case 1:
                    msg, err = h.processProtoRead(pr)
            }    

On Tue, Aug 27, 2024 at 7:51 AM Konstantin @.***> wrote:

looks like malformed xml from your client. What is your client version and connect string?

— Reply to this email directly, view it on GitHub https://github.com/kdudkov/goatak/issues/21#issuecomment-2312350998, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYZFTAZ74ZLJT7ESEIPPAPTZTRR4DAVCNFSM6AAAAABNFCOVEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJSGM2TAOJZHA . You are receiving this because you authored the thread.Message ID: @.***>

kdudkov commented 2 months ago

Every client I know (including civil ITAK) starts conversation with plain XML. I've never test MIL iTAK, don't have one. CIV iTak works well. Write to me in telegram if you feel like to debug some more.

gressdave58 commented 2 months ago

Hi kdudkov,

Sorry but i've never used telegram :-( don't know how to contact you so attached is my qr.

Here is a WinTak ( 5.2.0.153 client ) trying to connect and appears same EOF iTak is getting ... excuse the "DG" msg's i added just to debug

time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 sn: 4a776c686466230330b8a32af19fc9bcec3f9afa" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 subject: CN=test,O=test" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 issuer: CN=my_ca,O=my_ca,C=RU" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 valid till 2027-06-19 00:40:46 +0000 UTC" DG tcpserver.go:getCertUser .. enter: DG NewApp:AddClientHandler.. enter time=2024-08-29T17:39:02.637-04:00 level=INFO msg=starting client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:02.637-04:00 level=DEBUG msg="send version msg" client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG handleRead:er: &{0xc00074c0c0} :pr: &{0xc00074c120} time=2024-08-29T17:39:02.637-04:00 level=DEBUG msg="sending <event version=\"2.0\" type=\"t-x-takp-v\" uid=\"protouid\" time=\"2024-08-29T21:39:02.637693Z\" start=\"2024-08-29T21:39:02.637693Z\" stale=\"2024-08-29T21:40:02.637693Z\" how=\"m-g\"><TakProtocolSupport version=\"1\"><point lat=\"0\" lon=\"0\" hae=\"0\" ce=\"999999\" le=\"999999\">" client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG tcpserver.go:onTLSClientConnect.. enter: DG msg:0: DGDG <------- EOF: EOF time=2024-08-29T17:39:02.637-04:00 level=INFO msg=EOF client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:02.637-04:00 level=WARN msg=error client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa error=EOF time=2024-08-29T17:39:02.637-04:00 level=INFO msg=stopping client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG NewApp:RemoveHandlerCb.. enter DG NewApp:RemoveClientHandler.. enter time=2024-08-29T17:39:02.637-04:00 level=INFO msg="remove handler: ssl:192.168.0.4:50726" DG NewApp:cleanOldUnits .. enter time=2024-08-29T17:39:17.907-04:00 level=DEBUG msg="SSL connection from 192.168.0.4:50757" DG tcpserver.go:verifyConnection .. enter: DG tcpserver.go:getCertUser .. enter: time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 sn: 4a776c686466230330b8a32af19fc9bcec3f9afa" time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 subject: CN=test,O=test" time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 issuer: CN=my_ca,O=my_ca,C=RU" time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 valid till 2027-06-19 00:40:46 +0000 UTC" DG tcpserver.go:getCertUser .. enter: DG NewApp:AddClientHandler.. enter time=2024-08-29T17:39:17.938-04:00 level=INFO msg=starting client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:17.938-04:00 level=DEBUG msg="send version msg" client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG handleRead:er: &{0xc0006a40c0} :pr: &{0xc0006a4120} time=2024-08-29T17:39:17.938-04:00 level=DEBUG msg="sending <event version=\"2.0\" type=\"t-x-takp-v\" uid=\"protouid\" time=\"2024-08-29T21:39:17.938399Z\" start=\"2024-08-29T21:39:17.938399Z\" stale=\"2024-08-29T21:40:17.9384Z\" how=\"m-g\"><TakProtocolSupport version=\"1\"><point lat=\"0\" lon=\"0\" hae=\"0\" ce=\"999999\" le=\"999999\">" client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG msg:0: DG tcpserver.go:onTLSClientConnect.. enter: DGDG <------- EOF: EOF time=2024-08-29T17:39:17.938-04:00 level=INFO msg=EOF client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:17.938-04:00 level=WARN msg=error client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa error=EOF time=2024-08-29T17:39:17.938-04:00 level=INFO msg=stopping client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG NewApp:RemoveHandlerCb.. enter DG NewApp:RemoveClientHandler.. enter time=2024-08-29T17:39:17.938-04:00 level=INFO msg="remove handler: ssl:192.168.0.4:50757" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 sn: 4a776c686466230330b8a32af19fc9bcec3f9afa" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 subject: CN=test,O=test" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 issuer: CN=my_ca,O=my_ca,C=RU" time=2024-08-29T17:39:02.637-04:00 level=INFO msg="cert #0 valid till 2027-06-19 00:40:46 +0000 UTC" DG tcpserver.go:getCertUser .. enter: DG NewApp:AddClientHandler.. enter time=2024-08-29T17:39:02.637-04:00 level=INFO msg=starting client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:02.637-04:00 level=DEBUG msg="send version msg" client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG handleRead:er: &{0xc00074c0c0} :pr: &{0xc00074c120} time=2024-08-29T17:39:02.637-04:00 level=DEBUG msg="sending <event version=\"2.0\" type=\"t-x-takp-v\" uid=\"protouid\" time=\"2024-08-29T21:39:02.637693Z\" start=\"2024-08-29T21:39:02.637693Z\" stale=\"2024-08-29T21:40:02.637693Z\" how=\"m-g\"><TakProtocolSupport version=\"1\"><point lat=\"0\" lon=\"0\" hae=\"0\" ce=\"999999\" le=\"999999\">" client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG tcpserver.go:onTLSClientConnect.. enter: DG msg:0: DGDG <------- EOF: EOF time=2024-08-29T17:39:02.637-04:00 level=INFO msg=EOF client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:02.637-04:00 level=WARN msg=error client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa error=EOF time=2024-08-29T17:39:02.637-04:00 level=INFO msg=stopping client=ssl:192.168.0.4:50726 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG NewApp:RemoveHandlerCb.. enter DG NewApp:RemoveClientHandler.. enter time=2024-08-29T17:39:02.637-04:00 level=INFO msg="remove handler: ssl:192.168.0.4:50726" DG NewApp:cleanOldUnits .. enter time=2024-08-29T17:39:17.907-04:00 level=DEBUG msg="SSL connection from 192.168.0.4:50757" DG tcpserver.go:verifyConnection .. enter: DG tcpserver.go:getCertUser .. enter: time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 sn: 4a776c686466230330b8a32af19fc9bcec3f9afa" time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 subject: CN=test,O=test" time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 issuer: CN=my_ca,O=my_ca,C=RU" time=2024-08-29T17:39:17.938-04:00 level=INFO msg="cert #0 valid till 2027-06-19 00:40:46 +0000 UTC" DG tcpserver.go:getCertUser .. enter: DG NewApp:AddClientHandler.. enter time=2024-08-29T17:39:17.938-04:00 level=INFO msg=starting client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:17.938-04:00 level=DEBUG msg="send version msg" client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG handleRead:er: &{0xc0006a40c0} :pr: &{0xc0006a4120} time=2024-08-29T17:39:17.938-04:00 level=DEBUG msg="sending <event version=\"2.0\" type=\"t-x-takp-v\" uid=\"protouid\" time=\"2024-08-29T21:39:17.938399Z\" start=\"2024-08-29T21:39:17.938399Z\" stale=\"2024-08-29T21:40:17.9384Z\" how=\"m-g\"><TakProtocolSupport version=\"1\"><point lat=\"0\" lon=\"0\" hae=\"0\" ce=\"999999\" le=\"999999\">" client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG msg:0: DG tcpserver.go:onTLSClientConnect.. enter: DGDG <------- EOF: EOF time=2024-08-29T17:39:17.938-04:00 level=INFO msg=EOF client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa time=2024-08-29T17:39:17.938-04:00 level=WARN msg=error client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa error=EOF time=2024-08-29T17:39:17.938-04:00 level=INFO msg=stopping client=ssl:192.168.0.4:50757 login=test scope=test cert_sn=4a776c686466230330b8a32af19fc9bcec3f9afa DG NewApp:RemoveHandlerCb.. enter DG NewApp:RemoveClientHandler.. enter time=2024-08-29T17:39:17.938-04:00 level=INFO msg="remove handler: ssl:192.168.0.4:50757"

kdudkov commented 1 month ago

could you try to connect to takserver.ru (qr code is in readme.md)? That way I can fugure where the problem is - in your specific client or in your server configuration.

gressdave58 commented 1 month ago

iTAK connected perfect using the QR code .. thanks

On Mon, 2 Sept 2024 at 07:38, Konstantin @.***> wrote:

could you try to connect to takserver.ru (qr code is in readme.md)? That way I can fugure where the problem is - in your specific client or in your server configuration.

— Reply to this email directly, view it on GitHub https://github.com/kdudkov/goatak/issues/21#issuecomment-2324532942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYZFTA3DSAFAHAF5UZ6GTQLZURE3ZAVCNFSM6AAAAABNFCOVEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRUGUZTEOJUGI . You are receiving this because you authored the thread.Message ID: @.***>