madeindra / signal-setup-guide

Setup guide for Signal (OpenWhisper) server & client. Please refer to the discussion section for questions & difficulties.
MIT License
156 stars 95 forks source link

Update Profile Name, Contact Sync, and Sticker Setup #4

Closed pdanielkoe closed 4 years ago

pdanielkoe commented 4 years ago

Bro, numpang tanya,

on your setup, is the update profile name working ? mine has issue with it

"PUT /v1/profile/name/vXjIrXH4WtckWlRiK8SLhqh%2BzAYvdbk2Q%2FfYHAlYTmrVc6CQImnKDMqs0iwgCfmaWL6qMZRw7iOoO4LGy53dPWqkQSNql%2FJtlV47swouJ%2Bz0 HTTP/1.1" 400 63 "-" "Signal-Android 4.58.5 (API 27)" 19

for the desktop, after success link, the contact not loaded, any idea whats wrong with it ? is it because the CDS ? but when I tried to send message to other device from android, at the Desktop it show the chat but without the contact.

and also about the sticker, the sticker we need to upload manually at the S3 bucket or ?

Terima kasih Bro...

madeindra commented 4 years ago

Yes, the name is working on my setup.

For the contact sync, can you see what's in the console log on electron?

I've not try sticker, you need to upload sticker pack to your s3 bucket first, I've not get the sticker file.

EDIT: Someone on signal community inform me that when your URL contain "%2F", Nginx will convert it to "/", thus causing the 400 error.

pdanielkoe commented 4 years ago

yea I saw that thread too, https://community.signalusers.org/t/unable-to-set-profile-name/12214/10

hmmm weird I followed your NGINX setup actually.. the '%2F' url generated from android right ?

pdanielkoe commented 4 years ago

for contact sync is this error

TypeError: this.server.getKeysForIdentifier is not a function at (Signal-Desktop-mod/js/libtextsecure.js:40457:7)
reason: "Failed to retrieve new device keys for number +60146188485"
stack: "TypeError: this.server.getKeysForIdentifier is not a function at (Signal-Desktop-mod/js/libtextsecure.js:40118:14   at async OutgoingMessage.sendToIdentifier (Signal-Desktop-mod/js/libtextsecure.js:40457:7)"
message: "this.server.getKeysForIdentifier is not a function"
__proto__: Error

then I tried print out this.server


confirmCode: async ƒ confirmCode( number, code, newPassword, registrationId, deviceName, options = {} )
getAttachment: async ƒ getAttachment(id)
getAvatar: ƒ getAvatar(path)
getDevices: ƒ getDevices()
getKeysForNumber: ƒ getKeysForNumber(number, deviceId = '*')
getKeysForNumberUnauth: ƒ getKeysForNumberUnauth( number, deviceId = '*', { accessKey } = {} )
getMessageSocket: ƒ getMessageSocket()
getMyKeys: ƒ getMyKeys()
getProfile: ƒ getProfile(number)
getProfileUnauth: ƒ getProfileUnauth(number, { accessKey } = {})
getProvisioningSocket: ƒ getProvisioningSocket()
getSenderCertificate: ƒ getSenderCertificate()
getSticker: ƒ getSticker(packId, stickerId)
getStickerPackManifest: ƒ getStickerPackManifest(packId)
makeProxiedRequest: async ƒ makeProxiedRequest(url, options = {})
putAttachment: async ƒ putAttachment(encryptedBin)
putStickers: async ƒ putStickers( encryptedManifest, encryptedStickers, onProgress )
registerKeys: ƒ registerKeys(genKeys)
registerSupportForUnauthenticatedDelivery: ƒ registerSupportForUnauthenticatedDelivery()
removeSignalingKey: ƒ removeSignalingKey()
requestVerificationSMS: ƒ requestVerificationSMS(number)
requestVerificationVoice: ƒ requestVerificationVoice(number)
sendMessages: ƒ sendMessages( destination, messageArray, timestamp, silent, online )
sendMessagesUnauth: ƒ sendMessagesUnauth( destination, messageArray, timestamp, silent, online, { accessKey } = {} )
setSignedPreKey: ƒ setSignedPreKey(signedPreKey)
updateDeviceName: ƒ updateDeviceName(deviceName)

looks like it from this chunk,

        if (accessKey) {
          innerPromise = this.server
            .getKeysForIdentifierUnauth(identifier, deviceId, { accessKey })
            .then(handleResult)
            .catch(error => {
              if (error.code === 401 || error.code === 403) {
                if (this.failoverIdentifiers.indexOf(identifier) === -1) {
                  this.failoverIdentifiers.push(identifier);
                }
                return this.server
                  .getKeysForIdentifier(identifier, deviceId)
                  .then(handleResult);
              }
              throw error;
            });
        } else {
          innerPromise = this.server
            .getKeysForIdentifier(identifier, deviceId)
            .then(handleResult);
        }

are they change it to getKeysForNumber & getKeysForNumberUnauth, what do you think?

pdanielkoe commented 4 years ago

ahhh after i change to that function looks like my server received the request.. but at the desktop issue withe the cert for the cloudfront ==

failed, reason: unable to get local issuer certificate

madeindra commented 4 years ago

yea I saw that thread too, https://community.signalusers.org/t/unable-to-set-profile-name/12214/10

hmmm weird I followed your NGINX setup actually.. the '%2F' url generated from android right ?

My guide won't be 100% correct, I suggest you use the guide as a starter and modify it if you find error such this URL decoding error, I've not revise the Nginx conf example.

madeindra commented 4 years ago

ahhh after i change to that function looks like my server received the request.. but at the desktop issue withe the cert for the cloudfront ==

failed, reason: unable to get local issuer certificate

I did not take a long time for the desktop version, I didn't even need to modify how the methods work and yet it works with my server.

If you have any problem with cloudfront certificate, it could be that you took wrong certificate value, you need the CA's certificate, not the domain certificate.

For example, let's say you open https://github.com on chrome, you will be able to click lockpad icon beside the address bar, next you need to click on certificate and you will see 3 certificates. You need the value from the top-most orange certificate (CA's Certificate) for the desktop version, that's what I did with the desktop.

pdanielkoe commented 4 years ago

yea I saw that thread too, https://community.signalusers.org/t/unable-to-set-profile-name/12214/10 hmmm weird I followed your NGINX setup actually.. the '%2F' url generated from android right ?

My guide won't be 100% correct, I suggest you use the guide as a starter and modify it if you find error such this URL decoding error, I've not revise the Nginx conf example.

Thanks to your guide actually, I could set this almost all the signal setup from from scratch..

pdanielkoe commented 4 years ago

ahhh after i change to that function looks like my server received the request.. but at the desktop issue withe the cert for the cloudfront == failed, reason: unable to get local issuer certificate

I did not take a long time for the desktop version, I didn't even need to modify how the methods work and yet it works with my server.

If you have any problem with cloudfront certificate, it could be that you took wrong certificate value, you need the CA's certificate, not the domain certificate.

For example, let's say you open https://github.com on chrome, you will be able to click lockpad icon beside the address bar, next you need to click on certificate and you will see 3 certificates. You need the value from the top-most orange certificate (CA's Certificate) for the desktop version, that's what I did with the desktop.

for the CA I use firefox to get the CA PEM. image and then take these 2 image

  1. CA for own domain (letsencrypt) and put it at config/default.json certificateAuthority this one should be works because not showing any error on the console when talk to the server
  2. CA for cloudfront this one put it as a default value in 2 function related to attachment in js/modules/web_api.js correct ?
madeindra commented 4 years ago

ahhh after i change to that function looks like my server received the request.. but at the desktop issue withe the cert for the cloudfront == failed, reason: unable to get local issuer certificate

I did not take a long time for the desktop version, I didn't even need to modify how the methods work and yet it works with my server. If you have any problem with cloudfront certificate, it could be that you took wrong certificate value, you need the CA's certificate, not the domain certificate. For example, let's say you open https://github.com on chrome, you will be able to click lockpad icon beside the address bar, next you need to click on certificate and you will see 3 certificates. You need the value from the top-most orange certificate (CA's Certificate) for the desktop version, that's what I did with the desktop.

for the CA I use firefox to get the CA PEM. image and then take these 2 image

  1. CA for own domain (letsencrypt) and put it at config/default.json certificateAuthority this one should be works because not showing any error on the console when talk to the server
  2. CA for cloudfront this one put it as a default value in 2 function related to attachment in js/modules/web_api.js correct ?

It's a yes for both question, and yet you still got an error? Weird did you set your server in public server or localhost?

pdanielkoe commented 4 years ago

ahhh after i change to that function looks like my server received the request.. but at the desktop issue withe the cert for the cloudfront == failed, reason: unable to get local issuer certificate

I did not take a long time for the desktop version, I didn't even need to modify how the methods work and yet it works with my server. If you have any problem with cloudfront certificate, it could be that you took wrong certificate value, you need the CA's certificate, not the domain certificate. For example, let's say you open https://github.com on chrome, you will be able to click lockpad icon beside the address bar, next you need to click on certificate and you will see 3 certificates. You need the value from the top-most orange certificate (CA's Certificate) for the desktop version, that's what I did with the desktop.

for the CA I use firefox to get the CA PEM. image and then take these 2 image

  1. CA for own domain (letsencrypt) and put it at config/default.json certificateAuthority this one should be works because not showing any error on the console when talk to the server
  2. CA for cloudfront this one put it as a default value in 2 function related to attachment in js/modules/web_api.js correct ?

It's a yes for both question, and yet you still got an error? Weird did you set your server in public server or localhost?

arghhhhh stupid me... I redo it and it works, looks like when I manually replace new line to '\n'. I think I mistakenly delete some char.. very silly mistake..

yeaa now the contact is working..

Thank you masbro..

I setup the in public server, so its accessible, what I trying to do actually is converting the Desktop (electron) to web version..

pdanielkoe commented 4 years ago

Bro, you have any idea where to download the default stickers pack ?

madeindra commented 4 years ago

Bro, you have any idea where to download the default stickers pack ?

nope, I've not found that pack, it seems like you need to get the pack then upload it to s3 before using it. I can't even set Giphy gif, no idea why, even when I already get my own API key, I suspect it has something to do with content proxy.

madeindra commented 4 years ago

ahhh after i change to that function looks like my server received the request.. but at the desktop issue withe the cert for the cloudfront == failed, reason: unable to get local issuer certificate

I did not take a long time for the desktop version, I didn't even need to modify how the methods work and yet it works with my server. If you have any problem with cloudfront certificate, it could be that you took wrong certificate value, you need the CA's certificate, not the domain certificate. For example, let's say you open https://github.com on chrome, you will be able to click lockpad icon beside the address bar, next you need to click on certificate and you will see 3 certificates. You need the value from the top-most orange certificate (CA's Certificate) for the desktop version, that's what I did with the desktop.

for the CA I use firefox to get the CA PEM. image and then take these 2 image

  1. CA for own domain (letsencrypt) and put it at config/default.json certificateAuthority this one should be works because not showing any error on the console when talk to the server
  2. CA for cloudfront this one put it as a default value in 2 function related to attachment in js/modules/web_api.js correct ?

It's a yes for both question, and yet you still got an error? Weird did you set your server in public server or localhost?

arghhhhh stupid me... I redo it and it works, looks like when I manually replace new line to '\n'. I think I mistakenly delete some char.. very silly mistake..

yeaa now the contact is working..

Thank you masbro..

I setup the in public server, so its accessible, what I trying to do actually is converting the Desktop (electron) to web version..

That's good for you, sorry if I can't help a lot. Many people asked me about Android and Server modification, the desktop is too easy to edit for some people that rarely people asked about it, that's why I know the desktop version less than the android client and server.

pdanielkoe commented 4 years ago

bro I updated NGINX conf for the proxy_pass

# reverse proxy
      location / {
            proxy_pass                          http://127.0.0.1:8080$uri;
            ...
"PUT /v1/profile/name/RtJHhKlkvx+9UUlfjuddjA3IWYL8kzuFeSNHnHxkDmdl/tfLBLERUgrTz+W4Ad5Umx1U2Y0dQugH1ua33lb3u+5CW9lgroRFWeffc5goRnjv HTTP/1.1" 404 43 "-" "Signal-Android 4.58.5.debug (API 27)" 9

%2 gone, but 400 to 404.. hahahaha

madeindra commented 4 years ago

location

What value did you edit? Are you updating name? What error shown on the screen?

pdanielkoe commented 4 years ago

location

What value did you edit? Are you updating name? What error shown on the screen?

from your NGINX conf https://github.com/indrawp/Setup-Guide/blob/master/example-nginx.conf proxy_pass http://127.0.0.1:8080; >>> proxy_pass http://127.0.0.1:8080$uri; so the NGINX not doing the URL encoding

Yep I trying updating name from the android apps, when I press save saw that log at the server side.

madeindra commented 4 years ago

location

What value did you edit? Are you updating name? What error shown on the screen?

from your NGINX conf https://github.com/indrawp/Setup-Guide/blob/master/example-nginx.conf proxy_pass http://127.0.0.1:8080; >>> proxy_pass http://127.0.0.1:8080$uri; so the NGINX not doing the URL encoding

Yep I trying updating name from the android apps, when I press save saw that log at the server side.

You saw the log, but did the name change or not? Do the android client show error toast? Can you check on the logcat?

pdanielkoe commented 4 years ago

hmmm I think the name only change on android itself side only. log cat not show any error..

madeindra commented 4 years ago

hmmm I think the name only change on android itself side only. log cat not show any error..

Can you try it with 2 devices to see if the change is reflected on another side, if not, there will be an error in the receiver side.

pdanielkoe commented 4 years ago

hmmm I think the name only change on android itself side only. log cat not show any error..

Can you try it with 2 devices to see if the change is reflected on another side, if not, there will be an error in the receiver side.

yep, only at one side bro, at another device not reflected... I think the server side has issue, 400 bad request, 404 not found...

madeindra commented 4 years ago

hmmm I think the name only change on android itself side only. log cat not show any error..

Can you try it with 2 devices to see if the change is reflected on another side, if not, there will be an error in the receiver side.

yep, only at one side bro, at another device not reflected... I think the server side has issue, 400 bad request, 404 not found...

In my experience, some error doesn't mean anything and I can still use signal without any obstacle, but if the change is not reflected, it could be a problem with WebSocket in signal android

pdanielkoe commented 4 years ago

hmmm but if its websocket like the chat may not works also right ? mine chat & attachment are working fine. I think voice & video call also working..

madeindra commented 4 years ago

hmmm but if its websocket like the chat may not works also right ? mine chat & attachment are working fine. I think voice & video call also working..

The class called something like PushServiceSocket, did you see something like that in receiver end logcat?

pdanielkoe commented 4 years ago

now got new issue after they include the pin stuff server log: [26/Apr/2020:11:24:39 +0000] "GET /v1/token/fe7c1bfae98f9b073d220366ea31163ee82f6d04bead774f71ca8e5c40847bfe HTTP/1.1" 404 43 "-" "Signal-Android 4.59.3 (API 27)" 6


W/ConfirmKbsPinRepository: null
    org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException: Response: Response{protocol=h2, code=404, message=, url=https://chat-server.forlearning.net/v1/token/fe7c1bfae98f9b073d220366ea31163ee82f6d04bead774f71ca8e5c40847bfe}
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeRequest(PushServiceSocket.java:1549)
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeRequest(PushServiceSocket.java:1485)
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.getKeyBackupServiceToken(PushServiceSocket.java:767)
        at org.whispersystems.signalservice.api.KeyBackupService.newSession(KeyBackupService.java:101)
        at org.whispersystems.signalservice.api.KeyBackupService.newPinChangeSession(KeyBackupService.java:58)
        at org.thoughtcrime.securesms.pin.PinState.onPinChangedOrCreated(PinState.java:158)
        at org.thoughtcrime.securesms.lock.v2.ConfirmKbsPinRepository.lambda$setPin$0(ConfirmKbsPinRepository.java:28)
        at org.thoughtcrime.securesms.lock.v2.-$$Lambda$ConfirmKbsPinRepository$vQvadyfaV8iWm9I_XIHdb_suQvc.run(Unknown Source:6)
        at org.thoughtcrime.securesms.util.concurrent.SimpleTask.lambda$run$3(SimpleTask.java:52)
        at org.thoughtcrime.securesms.util.concurrent.-$$Lambda$SimpleTask$OTDucwZS-nPNqd9iOWD9wqPkXos.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

both is in master branch

madeindra commented 4 years ago

I suggest you not to use ready-for-production release, unless they have release it on play store. Currently they are still on 4.58