Client software download

How exactly does the client software download process work? I add a client, download the client side application to install…could you give me an overview of exactly what happens there?

I looked all over the server and do not see the client files anywhere, nor do I get how it preconfigures the client with all of the settings.

I ask as I have another project that this sort of work flow would be very helpful but never could understand how to make it happen?

It downloads the client installer from the internet, verifies its signature and then replaces the settings in a file in the installer. You can see the settings file here: https://github.com/uroni/urbackup_frontend_wx/blob/next/data/initial_settings.cfg It looks for the GUIDs in the installer and replaces the data in-between.

It comes from the backup server itself though? So if, for instance, you add to the client GUI a section that outlines who to contact for support (i.e. not you :wink: ) we can control where the updated files come from? If I get it correctly, there is a file on the server labeled “UrBackupUpdate.exe” that they would download and run as part of the update process and any changes we make to that file will propagate to our clients if we increment the version number in the “version.txt” file on the server?

I also have gleaned that I believe most of the code that controls this is in urbackup_backend/urbackupserver/serverinterface/download_client.cpp at next · uroni/urbackup_backend · GitHub ?

The backup server downloads it here https://github.com/uroni/urbackup_backend/blob/next/urbackupserver/server_update.cpp (if not disabled in the settings). You’ll have to create and distribute your own private/public key pair and signatures because I am not giving you the private key :wink:

Where’s your sense of adventure? :wink:

Got it now, I think.

Not to be a bother, but I am having a bit of trouble following: urbackup_backend/cryptoplugin/CryptoFactory.cpp at next · uroni/urbackup_backend · GitHub

bool CryptoFactory::verifyFile(const std::string &keyfilename, const std::string &filename, const std::string &sigfilename)
{
	CryptoPP::DSA::PublicKey PublicKey; 
	CryptoPP::AutoSeededRandomPool rnd;

	try
	{
		PublicKey.Load(CryptoPP::FileSource(keyfilename.c_str(), true).Ref());
		
		CryptoPP::DSA::Verifier verifier( PublicKey );
		CryptoPP::SignatureVerificationFilter svf(verifier);

		CryptoPP::FileSource( sigfilename.c_str(), true, new CryptoPP::Redirector( svf, CryptoPP::Redirector::PASS_WAIT_OBJECTS ) );
		CryptoPP::FileSource( filename.c_str(), true, new CryptoPP::Redirector( svf ) );

		return svf.GetLastResult();
	}
	catch(const CryptoPP::Exception& e)
	{
		Server->Log("Exception occured in CryptoFactory::verifyFile: " + e.GetWhat(), LL_ERROR);
	}

	return false;
}

Which I believe derives its key pairs from:

bool CryptoFactory::generatePrivatePublicKeyPair(const std::string &keybasename)
{
	CryptoPP::AutoSeededRandomPool rnd;

	CryptoPP::DSA::PrivateKey dsaPrivate;
	dsaPrivate.GenerateRandomWithKeySize(rnd, 1024);

	Server->Log("Calculating public key...", LL_INFO);
	CryptoPP::DSA::PublicKey dsaPublic;
	dsaPublic.AssignFrom(dsaPrivate);

	if (!dsaPrivate.Validate(rnd, 3) || !dsaPublic.Validate(rnd, 3))
	{
		Server->Log("Validating key pair failed", LL_ERROR);
		return false;
	}

	dsaPrivate.Save(CryptoPP::FileSink((keybasename+".priv").c_str()).Ref());
	dsaPublic.Save(CryptoPP::FileSink((keybasename+".pub").c_str()).Ref());
	return true;
}

I take it that the software generates its own key pair? But then what?

I apologize for all the questions, I am just struggling with this project as comments are few and far between. That is all well and good for the person who authors it, but it makes it difficult for others to follow as we do not have all of the code memorized and it takes a long time to reverse-engineer.

@uroni, could you check your PMs please? I have sent you two and it doesn’t appear they have ever been viewed.