Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.6 short invites #1571

Merged
merged 48 commits into from Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
720d5ea
Implement libretroshare short invites support
G10h4ck May 12, 2019
bde6235
Fix windows compilation
G10h4ck May 13, 2019
dac7643
Merge pull request #1565 from G10h4ck/short_invites_v2
csoler May 21, 2019
56e591f
added a flag in peerState specific to short invites, and several chec…
csoler May 22, 2019
4eb6b0b
fixed uninitialized memory read for variable mRsEventsHandle
csoler May 26, 2019
8fddb55
fixed stupid bug that crashed the code in a different place
csoler May 27, 2019
3a799ba
added optional display of short invites in places with certificates
csoler Jun 6, 2019
4bd5aaa
added parsing of short invites in connect friend wizard (not working …
csoler Jun 9, 2019
fb52f67
fixed up addign friend from short invite
csoler Jun 9, 2019
76cf64f
fixed compilation
csoler Jun 9, 2019
a7141cb
removed unused startWizard and loadCert code in HomePage
csoler Jun 9, 2019
6294aef
removed unused intro page from ConnectFriendWizard
csoler Jun 9, 2019
0c510a5
removed unused RsId and Fof pages from ConnectFriendWizard
csoler Jun 9, 2019
c0436b7
removed unused Email page from ConnectFriendWizard
csoler Jun 9, 2019
a55e824
removed unused FriendRequest page from ConnectFriendWizard
csoler Jun 9, 2019
a04079d
removed unused Cert page from ConnectFriendWizard
csoler Jun 9, 2019
1f56ef3
removed unused Cert page from ConnectFriendWizard
csoler Jun 9, 2019
38434f2
removed unused Cert page from ConnectFriendWizard
csoler Jun 9, 2019
57a5485
fixed adding friend with short invite
csoler Jun 10, 2019
805f753
fixed parsing of short invite
csoler Jun 20, 2019
6114d97
removed CIRCLES-related dead code from friendlist
csoler Jun 20, 2019
e132ce7
attempt to add SSL-only friends in FriendList - does not work yet
csoler Jun 20, 2019
9312d0c
converted short invites to compact PGP format for increased robustness
csoler Jun 21, 2019
a52451b
moved SSL part of friend list into a separate function
csoler Jun 22, 2019
daec6b3
arranged to show PGP id for friends from short invite. Name not avail…
csoler Jun 22, 2019
6419b03
merged upstream/master
csoler Sep 8, 2019
dd90314
fixed missing type conversion
csoler Sep 8, 2019
c8064e1
fixed missing parameter in jsonapi declaration
csoler Sep 8, 2019
3a58aa4
add special profile item for not yet validated peer from short invite
csoler Sep 10, 2019
bbf92bd
fixed remanent bug due causing the deletion of rsEvent
csoler Sep 10, 2019
b0c7f8f
fixed display of non validated nodes without fingerprint
csoler Sep 10, 2019
a20ec1a
fixed exchange of PGP keys in binary format and update of PGP signatu…
csoler Sep 14, 2019
bea6769
removed unused code from p3gossipdiscovery
csoler Sep 14, 2019
b4fe1d4
started documenting p3GossipDiscovery
csoler Sep 16, 2019
32b4312
improved security checks in authssl by verifying that the supplied PG…
csoler Sep 17, 2019
44d6cb7
finished documentation/review of discovery
csoler Sep 17, 2019
654d760
fixed comments from review of PR
csoler Sep 19, 2019
4fabf3d
renamed skip_signature_validation into more appropriate skip_pgp_sign…
csoler Sep 19, 2019
ed864f9
removed some debug info about PGP signature validation, and added the…
csoler Sep 21, 2019
6919711
restricted check for matching PGP ids to short invites only, since ot…
csoler Sep 21, 2019
9c7edff
fixed bug caused by shadowing a variable
csoler Sep 22, 2019
19ced52
fixed bug caused by wrong reading of disc flag
csoler Sep 22, 2019
9b78447
used RsInfo instead of std::cerr in authssl.cc
csoler Sep 22, 2019
cdeee01
removed dependency of FriendDialog on RsAutoUpdatePage which is not n…
csoler Sep 22, 2019
282d2d3
added missing notifications when adding friends
csoler Sep 22, 2019
a04d56e
fixed wrong default value for showUnconnected nodes
csoler Sep 23, 2019
d055887
removed some dead code
csoler Sep 23, 2019
24781a7
removed unused mOthersList from PeerMgr
csoler Sep 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 20 additions & 10 deletions libretroshare/src/pqi/authssl.cc
Expand Up @@ -534,7 +534,7 @@ bool AuthSSLimpl::validateOwnCertificate(X509 *x509, EVP_PKEY *pkey)
uint32_t diagnostic ;

/* standard authentication */
if (!AuthX509WithGPG(x509,diagnostic))
if (!AuthX509WithGPG(x509,true,diagnostic))
{
std::cerr << "Validate Own certificate ERROR: diagnostic = " << diagnostic << std::endl;
return false;
Expand Down Expand Up @@ -970,7 +970,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
}


bool AuthSSLimpl::AuthX509WithGPG(X509 *x509, uint32_t& diagnostic)
bool AuthSSLimpl::AuthX509WithGPG(X509 *x509,bool verbose, uint32_t& diagnostic)
{
RsPgpId issuer = RsX509Cert::getCertIssuer(*x509);
RsPeerDetails pd;
Expand Down Expand Up @@ -1127,11 +1127,12 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509, uint32_t& diagnostic)
goto err;
}

RsInfo() << __PRETTY_FUNCTION__ << " Verified: " << sigtypestring
<< " signature of certificate sslId: "
<< RsX509Cert::getCertSslId(*x509)
<< ", Version " << std::hex << certificate_version << std::dec
<< " using PGP key " << pd.fpr << " " << pd.name << std::endl;
if(verbose)
std::cerr<< " Verified: " << sigtypestring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep RsInfo() << __PRETTY_FUNCTION__ instead of std::cerr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, here I removed it because it prints too much. We don't need the time nor the function name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don'T want the function name just keep RsInfo() at least it will print well on all platforms, plain std::cXXX doesn't work on Android so I had to do a dirty trick to be able to get those messages too, but it doesn'T wok always, while if you use the thins defined in util/rsdebug.h it works well on all platforms

<< " signature of certificate sslId: "
<< RsX509Cert::getCertSslId(*x509)
<< ", Version " << std::hex << certificate_version << std::dec
<< " using PGP key " << pd.fpr << " " << pd.name << std::endl;
}

EVP_MD_CTX_destroy(ctx);
Expand Down Expand Up @@ -1196,8 +1197,17 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)

RsPeerId sslId = RsX509Cert::getCertSslId(*x509Cert);
std::string sslCn = RsX509Cert::getCertIssuerString(*x509Cert);

RsPgpId pgpId(sslCn);

if(sslCn.length() == 40)
{
RsPgpFingerprint pgpFpr(sslCn); // we also accept fingerprint format, so that in the future we can switch to fingerprints without backward compatibility issues

if(!pgpFpr.isNull())
pgpId = PGPHandler::pgpIdFromFingerprint(pgpFpr); // in the future, we drop PGP ids and keep the fingerprint all along
}

RsPeerDetails det;
if(!rsPeers->getPeerDetails(sslId,det))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra check deny connection to a new location of a PGP friend, IMHO we should remove it

{
Expand Down Expand Up @@ -1249,7 +1259,7 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
}

uint32_t auth_diagnostic;
if(!isSslOnlyFriend && !AuthX509WithGPG(x509Cert, auth_diagnostic))
if(!isSslOnlyFriend && !AuthX509WithGPG(x509Cert,true, auth_diagnostic))
{
std::string errMsg = "Certificate was rejected because PGP "
"signature verification failed with diagnostic: "
Expand Down Expand Up @@ -1334,7 +1344,7 @@ bool AuthSSLimpl::parseX509DetailsFromFile(
}

uint32_t diagnostic = 0;
if(!AuthX509WithGPG(x509, diagnostic))
if(!AuthX509WithGPG(x509,false, diagnostic))
{
RsErr() << __PRETTY_FUNCTION__ << " AuthX509WithGPG failed with "
<< "diagnostic: " << diagnostic << std::endl;
Expand Down Expand Up @@ -1748,7 +1758,7 @@ bool AuthSSLimpl::loadList(std::list<RsItem*>& load)
X509 *peer = loadX509FromPEM(kit->value);
/* authenticate it */
uint32_t diagnos ;
if (AuthX509WithGPG(peer,diagnos))
if (AuthX509WithGPG(peer,false,diagnos))
{
LocalStoreCert(peer);
}
Expand Down
4 changes: 3 additions & 1 deletion libretroshare/src/pqi/authssl.h
Expand Up @@ -140,10 +140,12 @@ class AuthSSL
* @param[in] x509 pointer ti the X509 certificate to check
* @param[out] diagnostic one of RS_SSL_HANDSHAKE_DIAGNOSTIC_* diagnostic
* codes
* @param[in] verbose if true, prints the authentication result to screen.
* @return true if correctly signed, false otherwise
*/
virtual bool AuthX509WithGPG(
X509* x509,
bool verbose,
uint32_t& diagnostic = RS_DEFAULT_STORAGE_PARAM(uint32_t)
) = 0;

Expand Down Expand Up @@ -233,7 +235,7 @@ class AuthSSLimpl : public AuthSSL, public p3Config
virtual X509* SignX509ReqWithGPG(X509_REQ *req, long days) override;

/// @see AuthSSL
bool AuthX509WithGPG(X509 *x509, uint32_t& auth_diagnostic) override;
bool AuthX509WithGPG(X509 *x509, bool verbose, uint32_t& auth_diagnostic) override;

/// @see AuthSSL
int VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx) override;
Expand Down
3 changes: 1 addition & 2 deletions libretroshare/src/pqi/pqissl.cc
Expand Up @@ -1185,8 +1185,7 @@ int pqissl::Authorise_SSL_Connection()
bool isSslOnlyFriend = rsPeers->isSslOnlyFriend(certPeerId);

uint32_t authErrCode = 0;
if( !isSslOnlyFriend &&
!AuthSSL::instance().AuthX509WithGPG(peercert, authErrCode) )
if( !isSslOnlyFriend && !AuthSSL::instance().AuthX509WithGPG(peercert,false, authErrCode) )
{
RsFatal() << __PRETTY_FUNCTION__ << " failure verifying peer "
<< "certificate signature. This should never happen at this "
Expand Down
2 changes: 1 addition & 1 deletion libretroshare/src/pqi/pqissllistener.cc
Expand Up @@ -790,7 +790,7 @@ int pqissllistener::completeConnection(int fd, IncomingSSLInfo& info)

uint32_t authErrCode = 0;
if( !isSslOnlyFriend &&
!AuthSSL::instance().AuthX509WithGPG(peercert, authErrCode) )
!AuthSSL::instance().AuthX509WithGPG(peercert,false, authErrCode) )
{
RsFatal() << __PRETTY_FUNCTION__ << " failure verifying peer "
<< "certificate signature. This should never happen at this "
Expand Down