Merge pull request #1306 from csoler/v0.6-TorOnly

V0.6 tor only
This commit is contained in:
csoler 2018-07-31 14:18:24 +02:00 committed by GitHub
commit c948517c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 1171 additions and 1063 deletions

View File

@ -23,13 +23,9 @@ TEMPLATE = subdirs
SUBDIRS += openpgpsdk SUBDIRS += openpgpsdk
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
retrotor { SUBDIRS += libbitdht
libretroshare.depends = openpgpsdk libbitdht.file = libbitdht/src/libbitdht.pro
} else { libretroshare.depends = openpgpsdk libbitdht
SUBDIRS += libbitdht
libbitdht.file = libbitdht/src/libbitdht.pro
libretroshare.depends = openpgpsdk libbitdht
}
SUBDIRS += libretroshare SUBDIRS += libretroshare
libretroshare.file = libretroshare/src/libretroshare.pro libretroshare.file = libretroshare/src/libretroshare.pro
@ -45,15 +41,12 @@ retroshare_gui {
retroshare_gui.target = retroshare_gui retroshare_gui.target = retroshare_gui
} }
retrotor {
} else {
retroshare_nogui { retroshare_nogui {
SUBDIRS += retroshare_nogui SUBDIRS += retroshare_nogui
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
retroshare_nogui.depends = libretroshare libresapi retroshare_nogui.depends = libretroshare libresapi
retroshare_nogui.target = retroshare_nogui retroshare_nogui.target = retroshare_nogui
} }
}
retroshare_android_service { retroshare_android_service {
SUBDIRS += retroshare_android_service SUBDIRS += retroshare_android_service

View File

@ -94,7 +94,7 @@ namespace resource_api{
std::string getDefaultDocroot() std::string getDefaultDocroot()
{ {
return RsAccounts::DataDirectory(false) + "/webui"; return RsAccounts::systemDataDirectory(false) + "/webui";
} }
const char* API_ENTRY_PATH = "/api/v2"; const char* API_ENTRY_PATH = "/api/v2";

View File

@ -467,6 +467,8 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
req.mStream << makeKeyValueReference("hidden_adress", hidden_address) req.mStream << makeKeyValueReference("hidden_adress", hidden_address)
<< makeKeyValueReference("hidden_port", hidden_port_str); << makeKeyValueReference("hidden_port", hidden_port_str);
uint16_t hidden_port = 0; uint16_t hidden_port = 0;
bool auto_tor = false ; // to be set by API, so disabled until then.
if(hidden_address.empty() != hidden_port_str.empty()) if(hidden_address.empty() != hidden_port_str.empty())
{ {
resp.setFail("you must both specify string hidden_adress and string hidden_port to create a hidden node."); resp.setFail("you must both specify string hidden_adress and string hidden_port to create a hidden node.");
@ -539,7 +541,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
mPassword = pgp_password; mPassword = pgp_password;
mFixedPassword = pgp_password; mFixedPassword = pgp_password;
} }
bool ssl_ok = RsAccounts::GenerateSSLCertificate(pgp_id, "", ssl_name, "", hidden_port!=0, ssl_password, ssl_id, err_string); bool ssl_ok = RsAccounts::createNewAccount(pgp_id, "", ssl_name, "", hidden_port!=0, auto_tor!=0, ssl_password, ssl_id, err_string);
// clear fixed password to restore normal password operation // clear fixed password to restore normal password operation
// { // {

View File

@ -27,6 +27,7 @@
#include "hash_cache.h" #include "hash_cache.h"
#include "filelist_io.h" #include "filelist_io.h"
#include "file_sharing_defaults.h" #include "file_sharing_defaults.h"
#include "retroshare/rsinit.h"
//#define HASHSTORAGE_DEBUG 1 //#define HASHSTORAGE_DEBUG 1
@ -478,7 +479,7 @@ bool HashStorage::try_load_import_old_hash_cache()
{ {
// compute file name // compute file name
std::string base_dir = rsAccounts->PathAccountDirectory(); std::string base_dir = RsAccounts::AccountDirectory();
std::string old_cache_filename = base_dir + "/" + "file_cache.bin" ; std::string old_cache_filename = base_dir + "/" + "file_cache.bin" ;
// check for unencrypted // check for unencrypted

View File

@ -29,7 +29,7 @@
#include "retroshare/rsids.h" #include "retroshare/rsids.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "rsserver/rsaccounts.h" #include "retroshare/rsinit.h"
#include "rsserver/p3face.h" #include "rsserver/p3face.h"
@ -48,7 +48,7 @@ p3FileDatabase::p3FileDatabase(p3ServiceControl *mpeers)
{ {
// make sure the base directory exists // make sure the base directory exists
std::string base_dir = rsAccounts->PathAccountDirectory(); std::string base_dir = RsAccounts::AccountDirectory();
if(base_dir.empty()) if(base_dir.empty())
throw std::runtime_error("Cannot create base directory to store/access file sharing files.") ; throw std::runtime_error("Cannot create base directory to store/access file sharing files.") ;

View File

@ -39,12 +39,12 @@
#include "retroshare/rstypes.h" #include "retroshare/rstypes.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "retroshare/rsinit.h"
#include "rsitems/rsfiletransferitems.h" #include "rsitems/rsfiletransferitems.h"
#include "rsitems/rsserviceids.h" #include "rsitems/rsserviceids.h"
#include "rsserver/p3face.h" #include "rsserver/p3face.h"
#include "rsserver/rsaccounts.h"
#include "turtle/p3turtle.h" #include "turtle/p3turtle.h"
#include "util/rsdebug.h" #include "util/rsdebug.h"
@ -148,8 +148,9 @@ void ftServer::SetupFtServer()
mFtController = new ftController(mFtDataplex, mServiceCtrl, getServiceInfo().mServiceType); mFtController = new ftController(mFtDataplex, mServiceCtrl, getServiceInfo().mServiceType);
mFtController -> setFtSearchNExtra(mFtSearch, mFtExtra); mFtController -> setFtSearchNExtra(mFtSearch, mFtExtra);
std::string emergencySaveDir = rsAccounts->PathAccountDirectory(); std::string emergencySaveDir = RsAccounts::AccountDirectory();
std::string emergencyPartialsDir = rsAccounts->PathAccountDirectory(); std::string emergencyPartialsDir = RsAccounts::AccountDirectory();
if (emergencySaveDir != "") if (emergencySaveDir != "")
{ {
emergencySaveDir += "/"; emergencySaveDir += "/";

View File

@ -32,9 +32,6 @@ static struct RsLog::logInfo pqipersongrpzoneInfo = {RsLog::Default, "pqipersong
/**** /****
* #define PQI_DISABLE_UDP 1 * #define PQI_DISABLE_UDP 1
***/ ***/
#ifdef RETROTOR
#define PQI_DISABLE_UDP 1
#endif
/********************************** SSL Specific features ***************************/ /********************************** SSL Specific features ***************************/

View File

@ -121,51 +121,80 @@ class RsInit
/* Seperate Class for dealing with Accounts */ /* Seperate static Class for dealing with Accounts */
namespace RsAccounts class RsAccountsDetail ;
class RsAccounts
{ {
/** public:
* @brief ConfigDirectory (normally ~/.retroshare) you can call this method // Should be called once before everything else.
* even before initialisation (you can't with some other methods)
* @see RsAccountsDetail::PathBaseDirectory() static bool init(const std::string &opt_base_dir, int& error_code);
*/
std::string ConfigDirectory();
/** /**
* @brief DataDirectory * @brief ConfigDirectory (normally ~/.retroshare) you can call this method
* you can call this method even before initialisation (you can't with some other methods) * even before initialisation (you can't with some other methods)
* @param check if set to true and directory does not exist, return empty string *
* @return path where global platform independent files are stored, like bdboot.txt or webinterface files * On linux: ~/.retroshare/
*/ *
std::string DataDirectory(bool check = true); * @see RsAccountsDetail::PathBaseDirectory()
*/
static std::string ConfigDirectory();
std::string PGPDirectory(); /**
std::string AccountDirectory(); * @brief DataDirectory
* you can call this method even before initialisation (you can't with some other methods)
* @param check if set to true and directory does not exist, return empty string
* @return path where global platform independent files are stored, like bdboot.txt or webinterface files
*/
static std::string systemDataDirectory(bool check = true);
static std::string PGPDirectory();
// PGP Accounts. // PGP Accounts.
int GetPGPLogins(std::list<RsPgpId> &pgpIds); static int GetPGPLogins(std::list<RsPgpId> &pgpIds);
int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email); static int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email);
bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString); static bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString);
// PGP Support Functions. // PGP Support Functions.
bool ExportIdentity(const std::string& fname,const RsPgpId& pgp_id) ; static bool ExportIdentity(const std::string& fname,const RsPgpId& pgp_id) ;
bool ImportIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ; static bool ImportIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ;
bool ImportIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ; static bool ImportIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ;
void GetUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys); static void GetUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys);
bool CopyGnuPGKeyrings() ; static bool CopyGnuPGKeyrings() ;
// Rs Accounts // Rs Accounts
bool SelectAccount(const RsPeerId& id); static bool SelectAccount(const RsPeerId& id);
static bool GetPreferredAccountId(RsPeerId &id);
static bool GetAccountIds(std::list<RsPeerId> &ids);
bool GetPreferredAccountId(RsPeerId &id); static bool GetAccountDetails(const RsPeerId &id, RsPgpId &gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location);
bool GetAccountIds(std::list<RsPeerId> &ids);
bool GetAccountDetails(const RsPeerId &id,
RsPgpId &gpgId, std::string &gpgName,
std::string &gpgEmail, std::string &location);
bool GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); static bool createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc,bool is_auto_tor, const std::string& passwd, RsPeerId &sslId, std::string &errString);
static void storeSelectedAccount() ;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// All methods bellow can only be called ones SelectAccount() as been called. //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static bool getCurrentAccountOptions(bool& is_hidden,bool& is_tor_auto,bool& is_first_time) ;
static bool checkCreateAccountDirectory(); // Generate the hierarchy of directories below ~/.retroshare/[SSL dir]/
static bool isHiddenNode() ; // true if the running node is a hidden node. Used to choose which services to start.
static bool isTorAuto() ; // true if the running node is a hidden node using automated Tor management
static std::string AccountDirectory(); // linux: ~/.retroshare/[SSL dir]/
static std::string AccountKeysDirectory(); // linux: ~/.retroshare/[SSL dir]/keys/
static std::string AccountPathCertFile(); // linux: ~/.retroshare/[SSL dir]/keys/user_cert.pem
static std::string AccountPathKeyFile(); // linux: ~/.retroshare/[SSL dir]/keys/user_pk.pem
static std::string AccountLocationName();
static bool lockPreferredAccount() ; // are these methods any useful??
static void unlockPreferredAccount() ;
private:
static RsAccountsDetail *rsAccounts ;
}; };

View File

@ -49,7 +49,7 @@
#include <openssl/ssl.h> #include <openssl/ssl.h>
// Global singleton declaration of data. // Global singleton declaration of data.
RsAccountsDetail *rsAccounts; RsAccountsDetail *RsAccounts::rsAccounts;
/* Uses private class - so must be hidden */ /* Uses private class - so must be hidden */
static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys); static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys);
@ -67,11 +67,8 @@ RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("")
bool RsAccountsDetail::loadAccounts() bool RsAccountsDetail::loadAccounts()
{ {
int failing_accounts ; int failing_accounts ;
#ifdef RETROTOR #warning we might need some switch here for hidden nodes only
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,true);
#else
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false); getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false);
#endif
loadPreferredAccount(); loadPreferredAccount();
checkPreferredId(); checkPreferredId();
@ -105,7 +102,7 @@ bool RsAccountsDetail::checkAccountDirectory()
return false; return false;
} }
return setupAccount(PathAccountDirectory()); return setupAccount(getCurrentAccountPathAccountDirectory());
} }
#warning we need to clean that up. Login should only ask for a SSL id, instead of a std::string. #warning we need to clean that up. Login should only ask for a SSL id, instead of a std::string.
@ -219,7 +216,7 @@ std::string RsAccountsDetail::PathBaseDirectory()
} }
std::string RsAccountsDetail::PathAccountDirectory() std::string RsAccountsDetail::getCurrentAccountPathAccountDirectory()
{ {
std::string path; std::string path;
@ -235,9 +232,9 @@ std::string RsAccountsDetail::PathAccountDirectory()
return path; return path;
} }
std::string RsAccountsDetail::PathAccountKeysDirectory() std::string RsAccountsDetail::getCurrentAccountPathAccountKeysDirectory()
{ {
std::string path = PathAccountDirectory(); std::string path = getCurrentAccountPathAccountDirectory();
if (path.empty()) if (path.empty())
{ {
return path; return path;
@ -247,9 +244,9 @@ std::string RsAccountsDetail::PathAccountKeysDirectory()
return path; return path;
} }
std::string RsAccountsDetail::PathKeyFile() std::string RsAccountsDetail::getCurrentAccountPathKeyFile()
{ {
std::string path = PathAccountKeysDirectory(); std::string path = getCurrentAccountPathAccountKeysDirectory();
if (path.empty()) if (path.empty())
{ {
return path; return path;
@ -259,9 +256,9 @@ std::string RsAccountsDetail::PathKeyFile()
return path; return path;
} }
std::string RsAccountsDetail::PathCertFile() std::string RsAccountsDetail::getCurrentAccountPathCertFile()
{ {
std::string path = PathAccountKeysDirectory(); std::string path = getCurrentAccountPathAccountKeysDirectory();
if (path.empty()) if (path.empty())
{ {
return path; return path;
@ -270,7 +267,7 @@ std::string RsAccountsDetail::PathCertFile()
return path; return path;
} }
std::string RsAccountsDetail::LocationName() std::string RsAccountsDetail::getCurrentAccountLocationName()
{ {
std::map<RsPeerId, AccountDetails>::const_iterator it; std::map<RsPeerId, AccountDetails>::const_iterator it;
it = mAccounts.find(mPreferredId); it = mAccounts.find(mPreferredId);
@ -450,7 +447,7 @@ bool RsAccountsDetail::storePreferredAccount()
* *
*/ */
bool RsAccountsDetail::getPreferredAccountId(RsPeerId &id) bool RsAccountsDetail::getCurrentAccountId(RsPeerId &id)
{ {
id = mPreferredId; id = mPreferredId;
return (!mPreferredId.isNull()); return (!mPreferredId.isNull());
@ -479,7 +476,7 @@ bool RsAccountsDetail::getAccountIds(std::list<RsPeerId> &ids)
} }
bool RsAccountsDetail::getAccountDetails(const RsPeerId &id, bool RsAccountsDetail::getCurrentAccountDetails(const RsPeerId &id,
RsPgpId &gpgId, std::string &gpgName, RsPgpId &gpgId, std::string &gpgName,
std::string &gpgEmail, std::string &location) std::string &gpgEmail, std::string &location)
{ {
@ -496,14 +493,16 @@ bool RsAccountsDetail::getAccountDetails(const RsPeerId &id,
return false; return false;
} }
bool RsAccountsDetail::getAccountOptions(bool &ishidden, bool &isFirstTimeRun) bool RsAccountsDetail::getCurrentAccountOptions(bool &ishidden,bool& isautotor, bool &isFirstTimeRun)
{ {
std::map<RsPeerId, AccountDetails>::iterator it; std::map<RsPeerId, AccountDetails>::iterator it;
it = mAccounts.find(mPreferredId); it = mAccounts.find(mPreferredId);
if (it != mAccounts.end()) if (it != mAccounts.end())
{ {
ishidden = it->second.mIsHiddenLoc; ishidden = it->second.mIsHiddenLoc;
isFirstTimeRun = it->second.mFirstRun; isFirstTimeRun = it->second.mFirstRun;
isautotor = it->second.mIsAutoTor;
return true; return true;
} }
return false; return false;
@ -598,7 +597,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
std::string lochex = (*it).substr(6); // rest of string. std::string lochex = (*it).substr(6); // rest of string.
bool hidden_location = false; bool hidden_location = false;
bool auto_tor = false;
bool valid_prefix = false; bool valid_prefix = false;
if (prefix == "LOC06_") if (prefix == "LOC06_")
{ {
valid_prefix = true; valid_prefix = true;
@ -607,6 +608,8 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
{ {
valid_prefix = true; valid_prefix = true;
hidden_location = true; hidden_location = true;
auto_tor = RsDirUtil::checkDirectory(mBaseDirectory+"/"+*it+"/hidden_service");
} }
else else
{ {
@ -626,7 +629,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
AccountDetails tmpId; AccountDetails tmpId;
tmpId.mIsHiddenLoc = hidden_location; tmpId.mIsHiddenLoc = hidden_location;
tmpId.mIsAutoTor = auto_tor;
tmpId.mAccountDir = *it; tmpId.mAccountDir = *it;
if (checkAccount(accountdir, tmpId,unsupported_keys)) if (checkAccount(accountdir, tmpId,unsupported_keys))
{ {
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
@ -692,7 +697,7 @@ static bool checkAccount(const std::string &accountdir, AccountDetails &account,
std::cerr << "issuerName: " << account.mPgpId << " id: " << account.mSslId << std::endl; std::cerr << "issuerName: " << account.mPgpId << " id: " << account.mSslId << std::endl;
#endif #endif
if(! rsAccounts->GetPGPLoginDetails(account.mPgpId, account.mPgpName, account.mPgpEmail)) if(! RsAccounts::GetPGPLoginDetails(account.mPgpId, account.mPgpName, account.mPgpEmail))
return false ; return false ;
if(!AuthGPG::getAuthGPG()->haveSecretKey(account.mPgpId)) if(!AuthGPG::getAuthGPG()->haveSecretKey(account.mPgpId))
@ -983,7 +988,7 @@ bool RsAccountsDetail::copyGnuPGKeyrings()
/* Create SSL Certificates */ /* Create SSL Certificates */
bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString) bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc,bool isautotor, const std::string& passwd, RsPeerId &sslId, std::string &errString)
{ {
/* select the PGP Identity first */ /* select the PGP Identity first */
if (!SelectPGPAccount(pgp_id)) if (!SelectPGPAccount(pgp_id))
@ -1136,6 +1141,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
newAccount.mLocation = loc; newAccount.mLocation = loc;
newAccount.mIsHiddenLoc = ishiddenloc; newAccount.mIsHiddenLoc = ishiddenloc;
newAccount.mIsAutoTor = isautotor;
newAccount.mFirstRun = true; newAccount.mFirstRun = true;
@ -1259,11 +1265,51 @@ bool RsInit::LoadPassword(const std::string& id, const std::string& inPwd)
* PUBLIC INTERFACE FUNCTIONS * PUBLIC INTERFACE FUNCTIONS
********************************************************************************/ ********************************************************************************/
bool RsAccounts::init(const std::string& opt_base_dir,int& error_code)
{
rsAccounts = new RsAccountsDetail ;
// first check config directories, and set bootstrap values.
if(!rsAccounts->setupBaseDirectory(opt_base_dir))
{
error_code = RS_INIT_BASE_DIR_ERROR ;
return false ;
}
// Setup PGP stuff.
std::string pgp_dir = rsAccounts->PathPGPDirectory();
if(!RsDirUtil::checkCreateDirectory(pgp_dir))
throw std::runtime_error("Cannot create pgp directory " + pgp_dir) ;
AuthGPG::init( pgp_dir + "/retroshare_public_keyring.gpg",
pgp_dir + "/retroshare_secret_keyring.gpg",
pgp_dir + "/retroshare_trustdb.gpg",
pgp_dir + "/lock");
// load Accounts.
if (!rsAccounts->loadAccounts())
{
error_code = RS_INIT_NO_KEYRING ;
return false ;
}
return true;
}
// Directories. // Directories.
std::string RsAccounts::ConfigDirectory() { return RsAccountsDetail::PathBaseDirectory(); } std::string RsAccounts::ConfigDirectory() { return RsAccountsDetail::PathBaseDirectory(); }
std::string RsAccounts::DataDirectory(bool check) { return RsAccountsDetail::PathDataDirectory(check); } std::string RsAccounts::systemDataDirectory(bool check) { return RsAccountsDetail::PathDataDirectory(check); }
std::string RsAccounts::PGPDirectory() { return rsAccounts->PathPGPDirectory(); } std::string RsAccounts::PGPDirectory() { return rsAccounts->PathPGPDirectory(); }
std::string RsAccounts::AccountDirectory() { return rsAccounts->PathAccountDirectory(); } std::string RsAccounts::AccountDirectory() { return rsAccounts->getCurrentAccountPathAccountDirectory(); }
std::string RsAccounts::AccountKeysDirectory() { return rsAccounts->getCurrentAccountPathAccountKeysDirectory(); }
std::string RsAccounts::AccountPathCertFile() { return rsAccounts->getCurrentAccountPathCertFile(); }
std::string RsAccounts::AccountPathKeyFile() { return rsAccounts->getCurrentAccountPathKeyFile(); }
std::string RsAccounts::AccountLocationName() { return rsAccounts->getCurrentAccountLocationName(); }
bool RsAccounts::lockPreferredAccount() { return rsAccounts->lockPreferredAccount();} // are these methods any useful??
void RsAccounts::unlockPreferredAccount() { rsAccounts->unlockPreferredAccount(); }
bool RsAccounts::checkCreateAccountDirectory() { return rsAccounts->checkAccountDirectory(); }
// PGP Accounts. // PGP Accounts.
int RsAccounts::GetPGPLogins(std::list<RsPgpId> &pgpIds) int RsAccounts::GetPGPLogins(std::list<RsPgpId> &pgpIds)
@ -1307,6 +1353,7 @@ bool RsAccounts::CopyGnuPGKeyrings()
return rsAccounts->copyGnuPGKeyrings(); return rsAccounts->copyGnuPGKeyrings();
} }
void RsAccounts::storeSelectedAccount() { rsAccounts->storePreferredAccount() ;}
// Rs Accounts // Rs Accounts
bool RsAccounts::SelectAccount(const RsPeerId &id) bool RsAccounts::SelectAccount(const RsPeerId &id)
{ {
@ -1315,7 +1362,40 @@ bool RsAccounts::SelectAccount(const RsPeerId &id)
bool RsAccounts::GetPreferredAccountId(RsPeerId &id) bool RsAccounts::GetPreferredAccountId(RsPeerId &id)
{ {
return rsAccounts->getPreferredAccountId(id); return rsAccounts->getCurrentAccountId(id);
}
bool RsAccounts::getCurrentAccountOptions(bool& is_hidden,bool& is_tor_auto,bool& is_first_time)
{
return rsAccounts->getCurrentAccountOptions(is_hidden,is_tor_auto,is_first_time);
}
bool RsAccounts::isHiddenNode()
{
bool hidden = false ;
bool is_tor_only = false ;
bool is_first_time = false ;
if(!getCurrentAccountOptions(hidden,is_tor_only,is_first_time))
{
std::cerr << "(EE) Critical problem: RsAccounts::getCurrentAccountOptions() called but no account chosen!" << std::endl;
throw std::runtime_error("inconsistent configuration") ;
}
return hidden ;
}
bool RsAccounts::isTorAuto()
{
bool hidden = false ;
bool is_tor_only = false ;
bool is_first_time = false ;
if(!getCurrentAccountOptions(hidden,is_tor_only,is_first_time))
{
std::cerr << "(EE) Critical problem: RsAccounts::getCurrentAccountOptions() called but no account chosen!" << std::endl;
throw std::runtime_error("inconsistent configuration") ;
}
return is_tor_only ;
} }
bool RsAccounts::GetAccountIds(std::list<RsPeerId> &ids) bool RsAccounts::GetAccountIds(std::list<RsPeerId> &ids)
@ -1327,12 +1407,12 @@ bool RsAccounts::GetAccountDetails(const RsPeerId &id,
RsPgpId &pgpId, std::string &pgpName, RsPgpId &pgpId, std::string &pgpName,
std::string &pgpEmail, std::string &location) std::string &pgpEmail, std::string &location)
{ {
return rsAccounts->getAccountDetails(id, pgpId, pgpName, pgpEmail, location); return rsAccounts->getCurrentAccountDetails(id, pgpId, pgpName, pgpEmail, location);
} }
bool RsAccounts::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString) bool RsAccounts::createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc, bool isautotor, const std::string& passwd, RsPeerId &sslId, std::string &errString)
{ {
return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, passwd, sslId, errString); return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, isautotor, passwd, sslId, errString);
} }
/********************************************************************************* /*********************************************************************************

View File

@ -49,6 +49,7 @@ class AccountDetails
std::string mLocation; std::string mLocation;
bool mIsHiddenLoc; bool mIsHiddenLoc;
bool mFirstRun; bool mFirstRun;
bool mIsAutoTor;
}; };
@ -58,9 +59,6 @@ class RsAccountsDetail
RsAccountsDetail(); RsAccountsDetail();
// These functions are externally accessible via RsAccounts namespace. // These functions are externally accessible via RsAccounts namespace.
// These functions are accessible from inside libretroshare. // These functions are accessible from inside libretroshare.
bool setupBaseDirectory(std::string alt_basedir); bool setupBaseDirectory(std::string alt_basedir);
@ -87,52 +85,43 @@ class RsAccountsDetail
// PGP Path is only dependent on BaseDirectory. // PGP Path is only dependent on BaseDirectory.
std::string PathPGPDirectory(); std::string PathPGPDirectory();
// Below are dependent on mPreferredId. // Generate a new account based on a given PGP key returns its SSL id and sets it to be the preferred account.
std::string PathAccountDirectory();
std::string PathAccountKeysDirectory(); bool GenerateSSLCertificate(const RsPgpId& gpg_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc, bool is_auto_tor,const std::string& passwd, RsPeerId &sslId, std::string &errString);
std::string PathKeyFile();
std::string PathCertFile();
std::string LocationName();
// PGP Accounts. // PGP Accounts.
int GetPGPLogins(std::list<RsPgpId> &pgpIds); int GetPGPLogins(std::list<RsPgpId> &pgpIds);
int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email); int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email);
bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString); bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString);
bool SelectPGPAccount(const RsPgpId& pgpId);
bool SelectPGPAccount(const RsPgpId& pgpId);
// PGP Support Functions. // PGP Support Functions.
bool exportIdentity(const std::string& fname,const RsPgpId& pgp_id) ; bool exportIdentity(const std::string& fname,const RsPgpId& pgp_id) ;
bool importIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ; bool importIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ;
bool importIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ; bool importIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ;
void getUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys); void getUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys);
bool copyGnuPGKeyrings() ; bool copyGnuPGKeyrings() ;
// Selecting Rs Account. // Selecting Rs Account.
bool getAccountIds(std::list<RsPeerId> &ids);
bool selectAccountByString(const std::string &prefUserString); bool selectAccountByString(const std::string &prefUserString);
bool selectId(const RsPeerId& preferredId); bool selectId(const RsPeerId& preferredId);
// Details of Rs Account.
bool getPreferredAccountId(RsPeerId &id);
bool getAccountDetails(const RsPeerId &id, RsPgpId& gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location);
bool getAccountOptions(bool &ishidden, bool &isFirstTimeRun);
bool getAccountIds(std::list<RsPeerId> &ids);
bool GenerateSSLCertificate(const RsPgpId& gpg_id,
const std::string& org, const std::string& loc,
const std::string& country, const bool ishiddenloc,
const std::string& passwd, RsPeerId &sslId,
std::string &errString);
// From init file.
bool storePreferredAccount(); bool storePreferredAccount();
bool loadPreferredAccount(); bool loadPreferredAccount();
// Details of current Rs Account.
bool getCurrentAccountId(RsPeerId &id);
bool getCurrentAccountDetails(const RsPeerId &id, RsPgpId& gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location);
bool getCurrentAccountOptions(bool &ishidden, bool &isautotor, bool &isFirstTimeRun);
std::string getCurrentAccountPathAccountDirectory();
std::string getCurrentAccountPathAccountKeysDirectory();
std::string getCurrentAccountPathKeyFile();
std::string getCurrentAccountPathCertFile();
std::string getCurrentAccountLocationName();
private: private:
bool checkPreferredId(); bool checkPreferredId();
@ -155,6 +144,4 @@ class RsAccountsDetail
std::map<std::string,std::vector<std::string> > mUnsupportedKeys ; std::map<std::string,std::vector<std::string> > mUnsupportedKeys ;
}; };
// Global singleton declaration of data.
extern RsAccountsDetail *rsAccounts;

View File

@ -431,26 +431,10 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
AuthSSL::AuthSSLInit(); AuthSSL::AuthSSLInit();
AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL, ""); AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL, "");
rsAccounts = new RsAccountsDetail(); int error_code ;
// first check config directories, and set bootstrap values. if(!RsAccounts::init(opt_base_dir,error_code))
if(!rsAccounts->setupBaseDirectory(opt_base_dir)) return error_code ;
return RS_INIT_BASE_DIR_ERROR ;
// Setup PGP stuff.
std::string pgp_dir = rsAccounts->PathPGPDirectory();
if(!RsDirUtil::checkCreateDirectory(pgp_dir))
throw std::runtime_error("Cannot create pgp directory " + pgp_dir) ;
AuthGPG::init( pgp_dir + "/retroshare_public_keyring.gpg",
pgp_dir + "/retroshare_secret_keyring.gpg",
pgp_dir + "/retroshare_trustdb.gpg",
pgp_dir + "/lock");
// load Accounts.
if (!rsAccounts->loadAccounts())
return RS_INIT_NO_KEYRING ;
// choose alternative account. // choose alternative account.
if(prefUserString != "") if(prefUserString != "")
@ -464,7 +448,7 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
return RS_INIT_AUTH_FAILED ; return RS_INIT_AUTH_FAILED ;
} }
if(rsAccounts->selectId(ssl_id)) if(RsAccounts::SelectAccount(ssl_id))
{ {
std::cerr << "Auto-selectng account ID " << ssl_id << std::endl; std::cerr << "Auto-selectng account ID " << ssl_id << std::endl;
return RS_INIT_HAVE_ACCOUNT; return RS_INIT_HAVE_ACCOUNT;
@ -474,7 +458,7 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
#ifdef RS_AUTOLOGIN #ifdef RS_AUTOLOGIN
/* check that we have selected someone */ /* check that we have selected someone */
RsPeerId preferredId; RsPeerId preferredId;
bool existingUser = rsAccounts->getPreferredAccountId(preferredId); bool existingUser = RsAccounts::GetPreferredAccountId(preferredId);
if (existingUser) if (existingUser)
{ {
@ -550,44 +534,43 @@ bool RsInit::LoadPassword(const std::string& inPwd)
*/ */
int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath) int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath)
{ {
if (!rsAccounts->lockPreferredAccount()) try
{ {
return 3; // invalid PreferredAccount. if (!RsAccounts::lockPreferredAccount())
throw 3; // invalid PreferredAccount.
// Logic that used to be external to RsInit...
RsPeerId accountId;
if (!RsAccounts::GetPreferredAccountId(accountId))
throw 3; // invalid PreferredAccount;
RsPgpId pgpId;
std::string pgpName, pgpEmail, location;
if(!RsAccounts::GetAccountDetails(accountId, pgpId, pgpName, pgpEmail, location))
throw 3; // invalid PreferredAccount;
if(0 == AuthGPG::getAuthGPG() -> GPGInit(pgpId))
throw 3; // PGP Error.
int retVal = LockConfigDirectory(RsAccounts::AccountDirectory(), lockFilePath);
if(retVal > 0)
throw retVal ;
if(LoadCertificates(autoLoginNT) != 1)
{
UnlockConfigDirectory();
throw 3;
}
return 0;
} }
catch(int retVal)
int retVal = 0; {
RsAccounts::unlockPreferredAccount();
// Logic that used to be external to RsInit... return retVal ;
RsPeerId accountId; }
if (!rsAccounts->getPreferredAccountId(accountId))
{
retVal = 3; // invalid PreferredAccount;
}
RsPgpId pgpId;
std::string pgpName, pgpEmail, location;
if (retVal == 0 && !rsAccounts->getAccountDetails(accountId, pgpId, pgpName, pgpEmail, location))
retVal = 3; // invalid PreferredAccount;
if (retVal == 0 && !rsAccounts->SelectPGPAccount(pgpId))
retVal = 3; // PGP Error.
if(retVal == 0)
retVal = LockConfigDirectory(rsAccounts->PathAccountDirectory(), lockFilePath);
if(retVal == 0 && LoadCertificates(autoLoginNT) != 1)
{
UnlockConfigDirectory();
retVal = 3;
}
if(retVal != 0)
{
rsAccounts->unlockPreferredAccount();
}
return retVal;
} }
@ -603,20 +586,20 @@ int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath
int RsInit::LoadCertificates(bool autoLoginNT) int RsInit::LoadCertificates(bool autoLoginNT)
{ {
RsPeerId preferredId; RsPeerId preferredId;
if (!rsAccounts->getPreferredAccountId(preferredId)) if (!RsAccounts::GetPreferredAccountId(preferredId))
{ {
std::cerr << "No Account Selected" << std::endl; std::cerr << "No Account Selected" << std::endl;
return 0; return 0;
} }
if (rsAccounts->PathCertFile() == "") if (RsAccounts::AccountPathCertFile() == "")
{ {
std::cerr << "RetroShare needs a certificate" << std::endl; std::cerr << "RetroShare needs a certificate" << std::endl;
return 0; return 0;
} }
if (rsAccounts->PathKeyFile() == "") if (RsAccounts::AccountPathKeyFile() == "")
{ {
std::cerr << "RetroShare needs a key" << std::endl; std::cerr << "RetroShare needs a key" << std::endl;
return 0; return 0;
@ -638,9 +621,10 @@ int RsInit::LoadCertificates(bool autoLoginNT)
} }
} }
std::cerr << "rsAccounts->PathKeyFile() : " << rsAccounts->PathKeyFile() << std::endl; std::cerr << "rsAccounts->PathKeyFile() : " << RsAccounts::AccountPathKeyFile() << std::endl;
if(0 == AuthSSL::getAuthSSL() -> InitAuth(rsAccounts->PathCertFile().c_str(), rsAccounts->PathKeyFile().c_str(), rsInitConfig->passwd.c_str(), rsAccounts->LocationName())) if(0 == AuthSSL::getAuthSSL() -> InitAuth(RsAccounts::AccountPathCertFile().c_str(), RsAccounts::AccountPathKeyFile().c_str(), rsInitConfig->passwd.c_str(),
RsAccounts::AccountLocationName()))
{ {
std::cerr << "SSL Auth Failed!"; std::cerr << "SSL Auth Failed!";
return 0 ; return 0 ;
@ -665,7 +649,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
rsInitConfig->gxs_passwd = rsInitConfig->passwd; rsInitConfig->gxs_passwd = rsInitConfig->passwd;
rsInitConfig->passwd = ""; rsInitConfig->passwd = "";
rsAccounts->storePreferredAccount(); RsAccounts::storeSelectedAccount();
return 1; return 1;
} }
@ -673,7 +657,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
bool RsInit::RsClearAutoLogin() bool RsInit::RsClearAutoLogin()
{ {
RsPeerId preferredId; RsPeerId preferredId;
if (!rsAccounts->getPreferredAccountId(preferredId)) if (!RsAccounts::getSelectedAccountId(preferredId))
{ {
std::cerr << "RsInit::RsClearAutoLogin() No Account Selected" << std::endl; std::cerr << "RsInit::RsClearAutoLogin() No Account Selected" << std::endl;
return 0; return 0;
@ -833,11 +817,8 @@ RsGRouter *rsGRouter = NULL ;
#include "pqi/p3linkmgr.h" #include "pqi/p3linkmgr.h"
#include "pqi/p3netmgr.h" #include "pqi/p3netmgr.h"
#ifndef RETROTOR
#include "tcponudp/tou.h" #include "tcponudp/tou.h"
#include "tcponudp/rsudpstack.h" #include "tcponudp/rsudpstack.h"
#endif
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
#include "dht/p3bitdht.h" #include "dht/p3bitdht.h"
@ -884,6 +865,17 @@ RsControl *RsControl::instance()
int RsServer::StartupRetroShare() int RsServer::StartupRetroShare()
{ {
RsPeerId ownId = AuthSSL::getAuthSSL()->OwnId();
std::cerr << "========================================================================" << std::endl;
std::cerr << "== RsInit:: starting up Retroshare core ==" << std::endl;
std::cerr << "== ==" << std::endl;
std::cerr << "== Account/SSL ID : " << ownId << " ==" << std::endl;
std::cerr << "== Node type : " << (RsAccounts::isHiddenNode()?"Hidden":"Normal") << " ==" << std::endl;
if(RsAccounts::isHiddenNode())
std::cerr << "== Tor/I2P configuration : " << (RsAccounts::isTorAuto()?"Tor Auto":"Manual ") << " ==" << std::endl;
std::cerr << "========================================================================" << std::endl;
/**************************************************************************/ /**************************************************************************/
/* STARTUP procedure */ /* STARTUP procedure */
/**************************************************************************/ /**************************************************************************/
@ -899,8 +891,6 @@ int RsServer::StartupRetroShare()
return false ; return false ;
} }
RsPeerId ownId = AuthSSL::getAuthSSL()->OwnId();
/**************************************************************************/ /**************************************************************************/
/* Any Initial Configuration (Commandline Options) */ /* Any Initial Configuration (Commandline Options) */
/**************************************************************************/ /**************************************************************************/
@ -909,7 +899,7 @@ int RsServer::StartupRetroShare()
std::cerr << "set the debugging to crashMode." << std::endl; std::cerr << "set the debugging to crashMode." << std::endl;
if ((!rsInitConfig->haveLogFile) && (!rsInitConfig->outStderr)) if ((!rsInitConfig->haveLogFile) && (!rsInitConfig->outStderr))
{ {
std::string crashfile = rsAccounts->PathAccountDirectory(); std::string crashfile = RsAccounts::AccountDirectory();
crashfile += "/" + configLogFileName; crashfile += "/" + configLogFileName;
setDebugCrashMode(crashfile.c_str()); setDebugCrashMode(crashfile.c_str());
} }
@ -921,7 +911,7 @@ int RsServer::StartupRetroShare()
} }
/* check account directory */ /* check account directory */
if (!rsAccounts->checkAccountDirectory()) if (!RsAccounts::checkCreateAccountDirectory())
{ {
std::cerr << "RsServer::StartupRetroShare() - Fatal Error....." << std::endl; std::cerr << "RsServer::StartupRetroShare() - Fatal Error....." << std::endl;
std::cerr << "checkAccount failed!" << std::endl; std::cerr << "checkAccount failed!" << std::endl;
@ -933,8 +923,8 @@ int RsServer::StartupRetroShare()
// Load up Certificates, and Old Configuration (if present) // Load up Certificates, and Old Configuration (if present)
std::cerr << "Load up Certificates, and Old Configuration (if present)." << std::endl; std::cerr << "Load up Certificates, and Old Configuration (if present)." << std::endl;
std::string emergencySaveDir = rsAccounts->PathAccountDirectory(); std::string emergencySaveDir = RsAccounts::AccountDirectory();
std::string emergencyPartialsDir = rsAccounts->PathAccountDirectory(); std::string emergencyPartialsDir = RsAccounts::AccountDirectory();
if (emergencySaveDir != "") if (emergencySaveDir != "")
{ {
emergencySaveDir += "/"; emergencySaveDir += "/";
@ -948,13 +938,15 @@ int RsServer::StartupRetroShare()
/**************************************************************************/ /**************************************************************************/
std::cerr << "Load Configuration" << std::endl; std::cerr << "Load Configuration" << std::endl;
mConfigMgr = new p3ConfigMgr(rsAccounts->PathAccountDirectory()); mConfigMgr = new p3ConfigMgr(RsAccounts::AccountDirectory());
mGeneralConfig = new p3GeneralConfig(); mGeneralConfig = new p3GeneralConfig();
// Get configuration options from rsAccounts. // Get configuration options from rsAccounts.
bool isHiddenNode = false; bool isHiddenNode = false;
bool isFirstTimeRun = false; bool isFirstTimeRun = false;
rsAccounts->getAccountOptions(isHiddenNode, isFirstTimeRun); bool isTorAuto = false;
RsAccounts::getCurrentAccountOptions(isHiddenNode,isTorAuto, isFirstTimeRun);
/**************************************************************************/ /**************************************************************************/
/* setup classes / structures */ /* setup classes / structures */
@ -995,36 +987,40 @@ int RsServer::StartupRetroShare()
sockaddr_clear(&tmpladdr); sockaddr_clear(&tmpladdr);
tmpladdr.sin_port = htons(rsInitConfig->port); tmpladdr.sin_port = htons(rsInitConfig->port);
rsUdpStack *mDhtStack = NULL ;
if(!RsAccounts::isHiddenNode())
{
#ifdef LOCALNET_TESTING #ifdef LOCALNET_TESTING
rsUdpStack *mDhtStack = new rsUdpStack(UDP_TEST_RESTRICTED_LAYER, tmpladdr); mDhtStack = new rsUdpStack(UDP_TEST_RESTRICTED_LAYER, tmpladdr);
/* parse portRestrictions */ /* parse portRestrictions */
unsigned int lport, uport; unsigned int lport, uport;
if (doPortRestrictions) if (doPortRestrictions)
{
if (2 == sscanf(portRestrictions.c_str(), "%u-%u", &lport, &uport))
{ {
std::cerr << "Adding Port Restriction (" << lport << "-" << uport << ")"; if (2 == sscanf(portRestrictions.c_str(), "%u-%u", &lport, &uport))
std::cerr << std::endl; {
} std::cerr << "Adding Port Restriction (" << lport << "-" << uport << ")";
else std::cerr << std::endl;
{ }
std::cerr << "Failed to parse Port Restrictions ... exiting"; else
std::cerr << std::endl; {
exit(1); std::cerr << "Failed to parse Port Restrictions ... exiting";
} std::cerr << std::endl;
exit(1);
}
RestrictedUdpLayer *url = (RestrictedUdpLayer *) mDhtStack->getUdpLayer(); RestrictedUdpLayer *url = (RestrictedUdpLayer *) mDhtStack->getUdpLayer();
url->addRestrictedPortRange(lport, uport); url->addRestrictedPortRange(lport, uport);
} }
#else //LOCALNET_TESTING #else //LOCALNET_TESTING
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
rsUdpStack *mDhtStack = new rsUdpStack(tmpladdr); mDhtStack = new rsUdpStack(tmpladdr);
#endif #endif
#endif //LOCALNET_TESTING #endif //LOCALNET_TESTING
}
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
@ -1032,12 +1028,12 @@ int RsServer::StartupRetroShare()
#define BITDHT_FILTERED_IP_FILENAME "bdfilter.txt" #define BITDHT_FILTERED_IP_FILENAME "bdfilter.txt"
std::string bootstrapfile = rsAccounts->PathAccountDirectory(); std::string bootstrapfile = RsAccounts::AccountDirectory();
if (bootstrapfile != "") if (bootstrapfile != "")
bootstrapfile += "/"; bootstrapfile += "/";
bootstrapfile += BITDHT_BOOTSTRAP_FILENAME; bootstrapfile += BITDHT_BOOTSTRAP_FILENAME;
std::string filteredipfile = rsAccounts->PathAccountDirectory(); std::string filteredipfile = RsAccounts::AccountDirectory();
if (filteredipfile != "") if (filteredipfile != "")
filteredipfile += "/"; filteredipfile += "/";
filteredipfile += BITDHT_FILTERED_IP_FILENAME; filteredipfile += BITDHT_FILTERED_IP_FILENAME;
@ -1077,7 +1073,7 @@ int RsServer::StartupRetroShare()
bdbootRF.close(); bdbootRF.close();
} }
#else #else
std::string installfile = rsAccounts->PathDataDirectory(); std::string installfile = RsAccounts::systemDataDirectory();
installfile += "/"; installfile += "/";
installfile += BITDHT_BOOTSTRAP_FILENAME; installfile += BITDHT_BOOTSTRAP_FILENAME;
@ -1104,96 +1100,105 @@ int RsServer::StartupRetroShare()
/* construct the rest of the stack, important to build them in the correct order! */ /* construct the rest of the stack, important to build them in the correct order! */
/* MOST OF THIS IS COMMENTED OUT UNTIL THE REST OF libretroshare IS READY FOR IT! */ /* MOST OF THIS IS COMMENTED OUT UNTIL THE REST OF libretroshare IS READY FOR IT! */
UdpSubReceiver *udpReceivers[RSUDP_NUM_TOU_RECVERS]; p3BitDht *mBitDht = NULL ;
int udpTypes[RSUDP_NUM_TOU_RECVERS]; rsDht = NULL ;
rsFixedUdpStack *mProxyStack = NULL ;
#ifdef RS_USE_DHT_STUNNER if(!RsAccounts::isHiddenNode())
// FIRST DHT STUNNER.
UdpStunner *mDhtStunner = new UdpStunner(mDhtStack);
mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */
mDhtStack->addReceiver(mDhtStunner);
#ifdef LOCALNET_TESTING
mDhtStunner->SetAcceptLocalNet();
#endif
#endif // RS_USE_DHT_STUNNER
// NEXT BITDHT.
p3BitDht *mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile);
/* install external Pointer for Interface */
rsDht = mBitDht;
// NEXT THE RELAY (NEED to keep a reference for installing RELAYS)
UdpRelayReceiver *mRelay = new UdpRelayReceiver(mDhtStack);
udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX] = mRelay; /* RELAY Connections (DHT Port) */
udpTypes[RSUDP_TOU_RECVER_RELAY_IDX] = TOU_RECEIVER_TYPE_UDPRELAY;
mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX]);
// LAST ON THIS STACK IS STANDARD DIRECT TOU
udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX] = new UdpPeerReceiver(mDhtStack); /* standard DIRECT Connections (DHT Port) */
udpTypes[RSUDP_TOU_RECVER_DIRECT_IDX] = TOU_RECEIVER_TYPE_UDPPEER;
mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX]);
// NOW WE BUILD THE SECOND STACK.
// Create the Second UdpStack... Port should be random (but openable!).
// We do this by binding to xx.xx.xx.xx:0 which which gives us a random port.
struct sockaddr_in sndladdr;
sockaddr_clear(&sndladdr);
#ifdef LOCALNET_TESTING
// // HACK Proxy Port near Dht Port - For Relay Testing.
// uint16_t rndport = rsInitConfig->port + 3;
// sndladdr.sin_port = htons(rndport);
rsFixedUdpStack *mProxyStack = new rsFixedUdpStack(UDP_TEST_RESTRICTED_LAYER, sndladdr);
/* portRestrictions already parsed */
if (doPortRestrictions)
{ {
RestrictedUdpLayer *url = (RestrictedUdpLayer *) mProxyStack->getUdpLayer(); UdpSubReceiver *udpReceivers[RSUDP_NUM_TOU_RECVERS];
url->addRestrictedPortRange(lport, uport); int udpTypes[RSUDP_NUM_TOU_RECVERS];
}
#else
rsFixedUdpStack *mProxyStack = new rsFixedUdpStack(sndladdr);
#endif
#ifdef RS_USE_DHT_STUNNER #ifdef RS_USE_DHT_STUNNER
// FIRSTLY THE PROXY STUNNER. // FIRST DHT STUNNER.
UdpStunner *mProxyStunner = new UdpStunner(mProxyStack); UdpStunner *mDhtStunner = new UdpStunner(mDhtStack);
mProxyStunner->setTargetStunPeriod(300); /* slow (5mins) */ mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */
mProxyStack->addReceiver(mProxyStunner); mDhtStack->addReceiver(mDhtStunner);
#ifdef LOCALNET_TESTING #ifdef LOCALNET_TESTING
mProxyStunner->SetAcceptLocalNet(); mDhtStunner->SetAcceptLocalNet();
#endif #endif
#endif // RS_USE_DHT_STUNNER #endif // RS_USE_DHT_STUNNER
// FINALLY THE PROXY UDP CONNECTIONS // NEXT BITDHT.
udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX] = new UdpPeerReceiver(mProxyStack); /* PROXY Connections (Alt UDP Port) */
udpTypes[RSUDP_TOU_RECVER_PROXY_IDX] = TOU_RECEIVER_TYPE_UDPPEER;
mProxyStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX]);
// REAL INITIALISATION - WITH THREE MODES
tou_init((void **) udpReceivers, udpTypes, RSUDP_NUM_TOU_RECVERS); mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile);
// NEXT THE RELAY (NEED to keep a reference for installing RELAYS)
UdpRelayReceiver *mRelay = new UdpRelayReceiver(mDhtStack);
udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX] = mRelay; /* RELAY Connections (DHT Port) */
udpTypes[RSUDP_TOU_RECVER_RELAY_IDX] = TOU_RECEIVER_TYPE_UDPRELAY;
mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX]);
// LAST ON THIS STACK IS STANDARD DIRECT TOU
udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX] = new UdpPeerReceiver(mDhtStack); /* standard DIRECT Connections (DHT Port) */
udpTypes[RSUDP_TOU_RECVER_DIRECT_IDX] = TOU_RECEIVER_TYPE_UDPPEER;
mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX]);
/* install external Pointer for Interface */
rsDht = mBitDht;
// NOW WE BUILD THE SECOND STACK.
// Create the Second UdpStack... Port should be random (but openable!).
// We do this by binding to xx.xx.xx.xx:0 which which gives us a random port.
struct sockaddr_in sndladdr;
sockaddr_clear(&sndladdr);
#ifdef LOCALNET_TESTING
// // HACK Proxy Port near Dht Port - For Relay Testing.
// uint16_t rndport = rsInitConfig->port + 3;
// sndladdr.sin_port = htons(rndport);
mProxyStack = new rsFixedUdpStack(UDP_TEST_RESTRICTED_LAYER, sndladdr);
/* portRestrictions already parsed */
if (doPortRestrictions)
{
RestrictedUdpLayer *url = (RestrictedUdpLayer *) mProxyStack->getUdpLayer();
url->addRestrictedPortRange(lport, uport);
}
#else
mProxyStack = new rsFixedUdpStack(sndladdr);
#endif
#ifdef RS_USE_DHT_STUNNER #ifdef RS_USE_DHT_STUNNER
mBitDht->setupConnectBits(mDhtStunner, mProxyStunner, mRelay); // FIRSTLY THE PROXY STUNNER.
UdpStunner *mProxyStunner = new UdpStunner(mProxyStack);
mProxyStunner->setTargetStunPeriod(300); /* slow (5mins) */
mProxyStack->addReceiver(mProxyStunner);
#ifdef LOCALNET_TESTING
mProxyStunner->SetAcceptLocalNet();
#endif
#endif // RS_USE_DHT_STUNNER
// FINALLY THE PROXY UDP CONNECTIONS
udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX] = new UdpPeerReceiver(mProxyStack); /* PROXY Connections (Alt UDP Port) */
udpTypes[RSUDP_TOU_RECVER_PROXY_IDX] = TOU_RECEIVER_TYPE_UDPPEER;
mProxyStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX]);
// REAL INITIALISATION - WITH THREE MODES
tou_init((void **) udpReceivers, udpTypes, RSUDP_NUM_TOU_RECVERS);
#ifdef RS_USE_DHT_STUNNER
mBitDht->setupConnectBits(mDhtStunner, mProxyStunner, mRelay);
#else // RS_USE_DHT_STUNNER #else // RS_USE_DHT_STUNNER
mBitDht->setupConnectBits(mRelay); mBitDht->setupConnectBits(mRelay);
#endif // RS_USE_DHT_STUNNER #endif // RS_USE_DHT_STUNNER
#ifdef RS_USE_DHT_STUNNER #ifdef RS_USE_DHT_STUNNER
mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner)); mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner));
#endif // RS_USE_DHT_STUNNER #endif // RS_USE_DHT_STUNNER
// #else //RS_USE_BITDHT // #else //RS_USE_BITDHT
// /* install NULL Pointer for rsDht Interface */ // /* install NULL Pointer for rsDht Interface */
// rsDht = NULL; // rsDht = NULL;
#endif //RS_USE_BITDHT #endif //RS_USE_BITDHT
}
/**************************** BITDHT ***********************************/ /**************************** BITDHT ***********************************/
@ -1208,7 +1213,7 @@ int RsServer::StartupRetroShare()
/****** New Ft Server **** !!! */ /****** New Ft Server **** !!! */
ftServer *ftserver = new ftServer(mPeerMgr, serviceCtrl); ftServer *ftserver = new ftServer(mPeerMgr, serviceCtrl);
ftserver->setConfigDirectory(rsAccounts->PathAccountDirectory()); ftserver->setConfigDirectory(RsAccounts::AccountDirectory());
ftserver->SetupFtServer() ; ftserver->SetupFtServer() ;
@ -1224,12 +1229,12 @@ int RsServer::StartupRetroShare()
std::vector<std::string> plugins_directories ; std::vector<std::string> plugins_directories ;
#ifdef __APPLE__ #ifdef __APPLE__
plugins_directories.push_back(rsAccounts->PathDataDirectory()) ; plugins_directories.push_back(RsAccounts::systemDataDirectory()) ;
#endif #endif
#if !defined(WINDOWS_SYS) && defined(PLUGIN_DIR) #if !defined(WINDOWS_SYS) && defined(PLUGIN_DIR)
plugins_directories.push_back(std::string(PLUGIN_DIR)) ; plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
#endif #endif
std::string extensions_dir = rsAccounts->PathBaseDirectory() + "/extensions6/" ; std::string extensions_dir = RsAccounts::ConfigDirectory() + "/extensions6/" ;
plugins_directories.push_back(extensions_dir) ; plugins_directories.push_back(extensions_dir) ;
if(!RsDirUtil::checkCreateDirectory(extensions_dir)) if(!RsDirUtil::checkCreateDirectory(extensions_dir))
@ -1272,7 +1277,7 @@ int RsServer::StartupRetroShare()
#ifdef RS_ENABLE_GXS #ifdef RS_ENABLE_GXS
std::string currGxsDir = rsAccounts->PathAccountDirectory() + "/gxs"; std::string currGxsDir = RsAccounts::AccountDirectory() + "/gxs";
RsDirUtil::checkCreateDirectory(currGxsDir); RsDirUtil::checkCreateDirectory(currGxsDir);
RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(serviceCtrl); RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(serviceCtrl);
@ -1557,17 +1562,17 @@ int RsServer::StartupRetroShare()
#endif #endif
// new services to test. // new services to test.
#ifndef RETROTOR
p3BanList *mBanList = new p3BanList(serviceCtrl, mNetMgr);
rsBanList = mBanList ;
pqih -> addService(mBanList, true);
#else
rsBanList = NULL ;
#endif
#ifdef RS_USE_BITDHT p3BanList *mBanList = NULL;
mBitDht->setupPeerSharer(mBanList);
#endif if(!RsAccounts::isHiddenNode())
{
mBanList = new p3BanList(serviceCtrl, mNetMgr);
rsBanList = mBanList ;
pqih -> addService(mBanList, true);
}
else
rsBanList = NULL ;
p3BandwidthControl *mBwCtrl = new p3BandwidthControl(pqih); p3BandwidthControl *mBwCtrl = new p3BandwidthControl(pqih);
pqih -> addService(mBwCtrl, true); pqih -> addService(mBwCtrl, true);
@ -1581,30 +1586,34 @@ int RsServer::StartupRetroShare()
/**************************************************************************/ /**************************************************************************/
if(!RsAccounts::isHiddenNode())
{
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
mNetMgr->addNetAssistConnect(1, mBitDht); mBitDht->setupPeerSharer(mBanList);
mNetMgr->addNetListener(mDhtStack);
mNetMgr->addNetListener(mProxyStack);
mNetMgr->addNetAssistConnect(1, mBitDht);
mNetMgr->addNetListener(mDhtStack);
mNetMgr->addNetListener(mProxyStack);
#endif #endif
#ifdef RS_ENABLE_ZEROCONF #ifdef RS_ENABLE_ZEROCONF
p3ZeroConf *mZeroConf = new p3ZeroConf( p3ZeroConf *mZeroConf = new p3ZeroConf(
AuthGPG::getAuthGPG()->getGPGOwnId(), ownId, AuthGPG::getAuthGPG()->getGPGOwnId(), ownId,
mLinkMgr, mNetMgr, mPeerMgr); mLinkMgr, mNetMgr, mPeerMgr);
mNetMgr->addNetAssistConnect(2, mZeroConf); mNetMgr->addNetAssistConnect(2, mZeroConf);
mNetMgr->addNetListener(mZeroConf); mNetMgr->addNetListener(mZeroConf);
#endif #endif
#ifdef RS_ENABLE_ZCNATASSIST #ifdef RS_ENABLE_ZCNATASSIST
// Apple's UPnP & NAT-PMP assistance. // Apple's UPnP & NAT-PMP assistance.
p3zcNatAssist *mZcNatAssist = new p3zcNatAssist(); p3zcNatAssist *mZcNatAssist = new p3zcNatAssist();
mNetMgr->addNetAssistFirewall(1, mZcNatAssist); mNetMgr->addNetAssistFirewall(1, mZcNatAssist);
#else #else
// Original UPnP Interface. // Original UPnP Interface.
pqiNetAssistFirewall *mUpnpMgr = new upnphandler(); pqiNetAssistFirewall *mUpnpMgr = new upnphandler();
mNetMgr->addNetAssistFirewall(1, mUpnpMgr); mNetMgr->addNetAssistFirewall(1, mUpnpMgr);
#endif #endif
}
/**************************************************************************/ /**************************************************************************/
/* need to Monitor too! */ /* need to Monitor too! */
@ -1637,9 +1646,10 @@ int RsServer::StartupRetroShare()
mConfigMgr->addConfiguration("p3History.cfg" , mHistoryMgr); mConfigMgr->addConfiguration("p3History.cfg" , mHistoryMgr);
mConfigMgr->addConfiguration("p3Status.cfg" , mStatusSrv); mConfigMgr->addConfiguration("p3Status.cfg" , mStatusSrv);
mConfigMgr->addConfiguration("turtle.cfg" , tr); mConfigMgr->addConfiguration("turtle.cfg" , tr);
#ifndef RETROTOR
mConfigMgr->addConfiguration("banlist.cfg" , mBanList); if(mBanList != NULL)
#endif mConfigMgr->addConfiguration("banlist.cfg" , mBanList);
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl); mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
mConfigMgr->addConfiguration("reputations.cfg" , mReputations); mConfigMgr->addConfiguration("reputations.cfg" , mReputations);
#ifdef ENABLE_GROUTER #ifdef ENABLE_GROUTER
@ -1647,7 +1657,8 @@ int RsServer::StartupRetroShare()
#endif #endif
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
mConfigMgr->addConfiguration("bitdht.cfg" , mBitDht); if(mBitDht != NULL)
mConfigMgr->addConfiguration("bitdht.cfg" , mBitDht);
#endif #endif
#ifdef RS_ENABLE_GXS #ifdef RS_ENABLE_GXS
@ -1874,7 +1885,8 @@ int RsServer::StartupRetroShare()
//mDhtMgr->start(); //mDhtMgr->start();
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
mBitDht->start(); if(mBitDht != NULL)
mBitDht->start();
#endif #endif
/**************************************************************************/ /**************************************************************************/
@ -1910,6 +1922,10 @@ int RsServer::StartupRetroShare()
/* Startup this thread! */ /* Startup this thread! */
start("rs main") ; start("rs main") ;
std::cerr << "========================================================================" << std::endl;
std::cerr << "== RsInit:: Retroshare core started ==" << std::endl;
std::cerr << "========================================================================" << std::endl;
return 1; return 1;
} }

View File

@ -3,7 +3,7 @@
#include <pqi/authgpg.h> #include <pqi/authgpg.h>
#include "rsloginhandler.h" #include "rsloginhandler.h"
#include "util/rsdir.h" #include "util/rsdir.h"
#include "rsaccounts.h" #include "retroshare/rsinit.h"
//#define DEBUG_RSLOGINHANDLER 1 //#define DEBUG_RSLOGINHANDLER 1
@ -91,7 +91,7 @@ bool RsLoginHandler::getSSLPasswdFromGPGFile(const RsPeerId& ssl_id,std::string&
std::string RsLoginHandler::getSSLPasswdFileName(const RsPeerId& /*ssl_id*/) std::string RsLoginHandler::getSSLPasswdFileName(const RsPeerId& /*ssl_id*/)
{ {
return rsAccounts->PathAccountKeysDirectory() + "/" + "ssl_passphrase.pgp"; return RsAccounts::AccountKeysDirectory() + "/" + "ssl_passphrase.pgp";
} }
#ifdef RS_AUTOLOGIN #ifdef RS_AUTOLOGIN
@ -755,7 +755,7 @@ bool RsLoginHandler::clearAutoLogin(const RsPeerId& ssl_id)
std::string RsLoginHandler::getAutologinFileName(const RsPeerId& /*ssl_id*/) std::string RsLoginHandler::getAutologinFileName(const RsPeerId& /*ssl_id*/)
{ {
return rsAccounts->PathAccountKeysDirectory() + "/" + "help.dta" ; return RsAccounts::AccountKeysDirectory() + "/" + "help.dta" ;
} }
#endif // RS_AUTOLOGIN #endif // RS_AUTOLOGIN

View File

@ -25,7 +25,7 @@
#include "rsserver/p3face.h" #include "rsserver/p3face.h"
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "rsserver/rsaccounts.h" #include "retroshare/rsinit.h"
#include "rsdiscspace.h" #include "rsdiscspace.h"
#include <util/rsthreads.h> #include <util/rsthreads.h>
@ -166,13 +166,13 @@ bool RsDiscSpace::checkForDiscSpace(RsDiscSpace::DiscLocation loc)
#endif #endif
break ; break ;
case RS_CONFIG_DIRECTORY: rs = crossSystemDiskStats(rsAccounts->PathAccountDirectory().c_str(),free_blocks,block_size) ; case RS_CONFIG_DIRECTORY: rs = crossSystemDiskStats(RsAccounts::AccountDirectory().c_str(),free_blocks,block_size) ;
#ifdef DEBUG_RSDISCSPACE #ifdef DEBUG_RSDISCSPACE
std::cerr << " path = " << RsInit::RsConfigDirectory() << std::endl ; std::cerr << " path = " << RsInit::RsConfigDirectory() << std::endl ;
#endif #endif
break ; break ;
case RS_PGP_DIRECTORY: rs = crossSystemDiskStats(rsAccounts->PathPGPDirectory().c_str(),free_blocks,block_size) ; case RS_PGP_DIRECTORY: rs = crossSystemDiskStats(RsAccounts::PGPDirectory().c_str(),free_blocks,block_size) ;
#ifdef DEBUG_RSDISCSPACE #ifdef DEBUG_RSDISCSPACE
std::cerr << " path = " << RsInit::RsPGPDirectory() << std::endl ; std::cerr << " path = " << RsInit::RsPGPDirectory() << std::endl ;
#endif #endif

View File

@ -216,7 +216,7 @@ QTranslator* VOIPPlugin::qt_translator(QApplication */*app*/, const QString& lan
void VOIPPlugin::qt_sound_events(SoundEvents &events) const void VOIPPlugin::qt_sound_events(SoundEvents &events) const
{ {
QDir baseDir = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/sounds"); QDir baseDir = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/sounds");
events.addEvent(QApplication::translate("VOIP", "VOIP") events.addEvent(QApplication::translate("VOIP", "VOIP")
, QApplication::translate("VOIP", "Incoming audio call") , QApplication::translate("VOIP", "Incoming audio call")

View File

@ -67,17 +67,17 @@ public:
enum Status enum Status
{ {
Error = -1, Error = -1,
NotConnected, NotConnected = 0x00,
Connecting, Connecting = 0x01,
Authenticating, Authenticating = 0x02,
Connected Connected = 0x03
}; };
enum TorStatus enum TorStatus
{ {
TorUnknown, TorUnknown = 0x00,
TorOffline, TorOffline = 0x01,
TorReady TorReady = 0x02
}; };

View File

@ -118,12 +118,17 @@ TorProcess *TorManager::process()
return d->process; return d->process;
} }
QString TorManager::dataDirectory() const bool TorManager::isTorAvailable()
{
return !instance()->d->torExecutablePath().isNull();
}
QString TorManager::torDataDirectory() const
{ {
return d->dataDir; return d->dataDir;
} }
void TorManager::setDataDirectory(const QString &path) void TorManager::setTorDataDirectory(const QString &path)
{ {
d->dataDir = QDir::fromNativeSeparators(path); d->dataDir = QDir::fromNativeSeparators(path);

View File

@ -58,18 +58,18 @@ class TorManager : public QObject
Q_PROPERTY(Tor::TorControl* control READ control CONSTANT) Q_PROPERTY(Tor::TorControl* control READ control CONSTANT)
Q_PROPERTY(bool hasError READ hasError NOTIFY errorChanged) Q_PROPERTY(bool hasError READ hasError NOTIFY errorChanged)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorChanged) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorChanged)
Q_PROPERTY(QString dataDirectory READ dataDirectory WRITE setDataDirectory) Q_PROPERTY(QString torDataDirectory READ torDataDirectory WRITE setTorDataDirectory)
public: public:
static bool isTorAvailable() ;
explicit TorManager(QObject *parent = 0);
static TorManager *instance(); static TorManager *instance();
TorProcess *process(); TorProcess *process();
TorControl *control(); TorControl *control();
QString dataDirectory() const;
void setDataDirectory(const QString &path); QString torDataDirectory() const;
void setTorDataDirectory(const QString &path);
QString hiddenServiceDirectory() const; QString hiddenServiceDirectory() const;
void setHiddenServiceDirectory(const QString &path); void setHiddenServiceDirectory(const QString &path);
@ -100,6 +100,7 @@ signals:
void errorChanged(); void errorChanged();
private: private:
explicit TorManager(QObject *parent = 0);
TorManagerPrivate *d; TorManagerPrivate *d;
}; };

View File

@ -34,6 +34,7 @@
#include <rshare.h> #include <rshare.h>
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "TorControl/TorManager.h"
#include "util/misc.h" #include "util/misc.h"
#include <retroshare/rsidentity.h> #include <retroshare/rsidentity.h>
@ -136,7 +137,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
//ui.headerFrame->setHeaderText(tr("Create a new profile")); //ui.headerFrame->setHeaderText(tr("Create a new profile"));
connect(ui.reuse_existing_node_CB, SIGNAL(triggered()), this, SLOT(switchReuseExistingNode())); connect(ui.reuse_existing_node_CB, SIGNAL(triggered()), this, SLOT(switchReuseExistingNode()));
connect(ui.adv_checkbox, SIGNAL(triggered()), this, SLOT(setupState())); connect(ui.adv_checkbox, SIGNAL(toggled(bool)), this, SLOT(setupState()));
connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState())); connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState()));
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson())); connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
@ -181,10 +182,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
* mark last one as default. * mark last one as default.
*/ */
QMenu *menu = new QMenu(tr("Advanced options")); //QMenu *menu = new QMenu(tr("Advanced options"));
menu->addAction(ui.adv_checkbox); //menu->addAction(ui.adv_checkbox);
menu->addAction(ui.reuse_existing_node_CB); //menu->addAction(ui.reuse_existing_node_CB);
ui.optionsButton->setMenu(menu); // ui.optionsButton->setMenu(menu);
mAllFieldsOk = false ; mAllFieldsOk = false ;
mEntropyOk = false ; mEntropyOk = false ;
@ -195,10 +196,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
ui.nodeType_CB->setCurrentIndex(1); ui.nodeType_CB->setCurrentIndex(1);
ui.nodeType_CB->setEnabled(false); ui.nodeType_CB->setEnabled(false);
#endif #endif
#ifdef RETROTOR //#ifdef RETROTOR
ui.adv_checkbox->setChecked(false); // ui.adv_checkbox->setChecked(false);
ui.adv_checkbox->setVisible(true); // ui.adv_checkbox->setVisible(true);
#endif //#endif
initKeyList(); initKeyList();
setupState(); setupState();
@ -259,30 +260,39 @@ void GenCertDialog::setupState()
{ {
bool adv_state = ui.adv_checkbox->isChecked(); bool adv_state = ui.adv_checkbox->isChecked();
#ifdef RETROTOR
bool retrotor = true ;
#else
bool retrotor = false ;
#endif
if(!adv_state) if(!adv_state)
{ {
ui.reuse_existing_node_CB->setChecked(false) ; ui.reuse_existing_node_CB->setChecked(false) ;
ui.nodeType_CB->setCurrentIndex(retrotor?1:0) ;
ui.keylength_comboBox->setCurrentIndex(0) ; ui.keylength_comboBox->setCurrentIndex(0) ;
// ui.nodeType_CB->setCurrentIndex(0);
} }
bool hidden_state = ui.nodeType_CB->currentIndex()==1; ui.reuse_existing_node_CB->setVisible(adv_state) ;
// ui.nodeType_CB->setVisible(adv_state) ;
// ui.nodeType_LB->setVisible(adv_state) ;
// ui.nodeTypeExplanation_TE->setVisible(adv_state) ;
bool hidden_state = ui.nodeType_CB->currentIndex()==1 || ui.nodeType_CB->currentIndex()==2;
bool generate_new = !ui.reuse_existing_node_CB->isChecked(); bool generate_new = !ui.reuse_existing_node_CB->isChecked();
bool tor_auto = ui.nodeType_CB->currentIndex()==1;
genNewGPGKey = generate_new; genNewGPGKey = generate_new;
switch(ui.nodeType_CB->currentIndex())
{
case 0: ui.nodeTypeExplanation_TE->setText(tr("<b>Your IP is visible to trusted nodes only. You can also connect to hidden nodes if running Tor on your machine. Best choice for sharing with trusted friends.</b>"));
break;
case 1: ui.nodeTypeExplanation_TE->setText(tr("<b>Your IP is hidden. All traffic happens over the Tor network. Best choice if you cannot trust friend nodes with your own IP.</b>"));
break;
case 2: ui.nodeTypeExplanation_TE->setText(tr("<b>Hidden node for advanced users only. Allows to use other proxy solutions such as I2P.</b>"));
break;
}
//ui.no_node_label->setVisible(false); //ui.no_node_label->setVisible(false);
setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node")); setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node"));
//ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node")); //ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node"));
ui.label_nodeType->setVisible(adv_state && !retrotor) ;
ui.nodeType_CB->setVisible(adv_state && !retrotor) ;
ui.reuse_existing_node_CB->setEnabled(adv_state) ; ui.reuse_existing_node_CB->setEnabled(adv_state) ;
ui.importIdentity_PB->setVisible(adv_state && !generate_new) ; ui.importIdentity_PB->setVisible(adv_state && !generate_new) ;
ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ; ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ;
@ -318,13 +328,13 @@ void GenCertDialog::setupState()
ui.entropy_bar->setVisible(true); ui.entropy_bar->setVisible(true);
ui.genButton->setVisible(true); ui.genButton->setVisible(true);
ui.hiddenaddr_input->setVisible(hidden_state && !retrotor); ui.hiddenaddr_input->setVisible(hidden_state && !tor_auto);
ui.hiddenaddr_label->setVisible(hidden_state && !retrotor); ui.hiddenaddr_label->setVisible(hidden_state && !tor_auto);
ui.hiddenport_label->setVisible(hidden_state && !retrotor); ui.hiddenport_label->setVisible(hidden_state && !tor_auto);
ui.hiddenport_spinBox->setVisible(hidden_state && !retrotor); ui.hiddenport_spinBox->setVisible(hidden_state && !tor_auto);
ui.cbUseBob->setVisible(hidden_state && !retrotor); ui.cbUseBob->setVisible(hidden_state && !tor_auto);
if(!mAllFieldsOk) if(!mAllFieldsOk)
{ {
@ -470,7 +480,6 @@ void GenCertDialog::genPerson()
/* Check the data from the GUI. */ /* Check the data from the GUI. */
std::string genLoc = ui.node_input->text().toUtf8().constData(); std::string genLoc = ui.node_input->text().toUtf8().constData();
RsPgpId PGPId; RsPgpId PGPId;
bool isHiddenLoc = false;
if(ui.nickname_input->isVisible()) if(ui.nickname_input->isVisible())
{ {
@ -503,18 +512,26 @@ void GenCertDialog::genPerson()
} }
} }
if (ui.nodeType_CB->currentIndex()==1) bool isHiddenLoc = (ui.nodeType_CB->currentIndex()>0);
bool isAutoTor = (ui.nodeType_CB->currentIndex()==1);
if(isAutoTor && !Tor::TorManager::isTorAvailable())
{
QMessageBox::critical(this,tr("Tor is not available"),tr("No Tor executable has been found on your system. You need to install Tor before creating a hidden identity.")) ;
return ;
}
if(isHiddenLoc)
{ {
std::string hl = ui.hiddenaddr_input->text().toStdString(); std::string hl = ui.hiddenaddr_input->text().toStdString();
uint16_t port = ui.hiddenport_spinBox->value(); uint16_t port = ui.hiddenport_spinBox->value();
bool useBob = ui.cbUseBob->isChecked(); bool useBob = ui.cbUseBob->isChecked();
if (useBob && hl.empty()) if (useBob && hl.empty())
hl = "127.0.0.1"; hl = "127.0.0.1";
RsInit::SetHiddenLocation(hl, port, useBob); /* parses it */ RsInit::SetHiddenLocation(hl, port, useBob); /* parses it */
isHiddenLoc = true;
} }
@ -620,7 +637,7 @@ void GenCertDialog::genPerson()
std::string err; std::string err;
this->hide();//To show dialog asking password PGP Key. this->hide();//To show dialog asking password PGP Key.
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl; std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err); bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
if (okGen) if (okGen)
{ {

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>569</width> <width>978</width>
<height>426</height> <height>826</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -50,10 +50,7 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="profileframeVLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>9</number>
</property>
<item> <item>
<widget class="QLabel" name="RSLabel"> <widget class="QLabel" name="RSLabel">
<property name="text"> <property name="text">
@ -71,7 +68,45 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="toolBarHLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="nodeType_LB">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Node type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="nodeType_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Standard node</string>
</property>
</item>
<item>
<property name="text">
<string>Hidden node (over Tor)</string>
</property>
</item>
<item>
<property name="text">
<string>Hidden node (Tor/I2P - Manually configured)</string>
</property>
</item>
</widget>
</item>
<item> <item>
<spacer name="toolBarHSpacer"> <spacer name="toolBarHSpacer">
<property name="orientation"> <property name="orientation">
@ -86,13 +121,9 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="optionsButton"> <widget class="QCheckBox" name="adv_checkbox">
<property name="text"> <property name="text">
<string>Options</string> <string>advanced options</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/svg/options.svg</normaloff>:/icons/svg/options.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -100,16 +131,23 @@
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="nodeTypeExplanation_TE">
<property name="text">
<string>TextLabel</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="profile_groupBox"> <widget class="QGroupBox" name="profile_groupBox">
<property name="styleSheet"> <property name="styleSheet">
@ -233,26 +271,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="2">
<widget class="QComboBox" name="nodeType_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Standard node</string>
</property>
</item>
<item>
<property name="text">
<string>TOR/I2P Hidden node</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2"> <item row="5" column="2">
<widget class="QLineEdit" name="node_input"> <widget class="QLineEdit" name="node_input">
<property name="sizePolicy"> <property name="sizePolicy">
@ -357,6 +375,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="reuse_existing_node_CB">
<property name="text">
<string>Use existing profile...</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="8" column="3"> <item row="8" column="3">
@ -675,28 +700,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1">
<widget class="QLabel" name="label_nodeType">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icons.qrc">:/icons/svg/netgraph.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
@ -729,22 +732,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
<action name="adv_checkbox">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Advanced options</string>
</property>
</action>
<action name="reuse_existing_node_CB">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use existing profile</string>
</property>
</action>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>name_input</tabstop> <tabstop>name_input</tabstop>

View File

@ -84,12 +84,13 @@
#include "statusbar/ToasterDisable.h" #include "statusbar/ToasterDisable.h"
#include "statusbar/SysTrayStatus.h" #include "statusbar/SysTrayStatus.h"
#include "statusbar/torstatus.h" #include "statusbar/torstatus.h"
#include <retroshare/rsstatus.h>
#include <retroshare/rsiface.h> #include "retroshare/rsstatus.h"
#include <retroshare/rspeers.h> #include "retroshare/rsiface.h"
#include <retroshare/rsfiles.h> #include "retroshare/rspeers.h"
#include <retroshare/rsnotify.h> #include "retroshare/rsfiles.h"
#include "retroshare/rsnotify.h"
#include "retroshare/rsinit.h"
#include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxschannels/GxsChannelDialog.h"
#include "gui/gxsforums/GxsForumsDialog.h" #include "gui/gxsforums/GxsForumsDialog.h"
@ -250,14 +251,15 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
if(hiddenmode) if(hiddenmode)
{ {
#ifdef RETROTOR if(RsAccounts::isHiddenNode())
torstatus = new TorStatus(); {
torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool()); torstatus = new TorStatus();
statusBar()->addWidget(torstatus); torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool());
torstatus->getTorStatus(); statusBar()->addWidget(torstatus);
#else torstatus->getTorStatus();
torstatus = NULL ; }
#endif else
torstatus = NULL ;
natstatus = NULL ; natstatus = NULL ;
dhtstatus = NULL ; dhtstatus = NULL ;

View File

@ -76,7 +76,7 @@ SoundManager::SoundManager() : QObject()
void SoundManager::soundEvents(SoundEvents &events) void SoundManager::soundEvents(SoundEvents &events)
{ {
QDir baseDir = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/sounds"); QDir baseDir = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/sounds");
events.mDefaultPath = baseDir.absolutePath(); events.mDefaultPath = baseDir.absolutePath();

View File

@ -149,7 +149,7 @@ static QStringList getBaseDirList()
// Search chat styles in config dir and data dir (is application dir for portable) // Search chat styles in config dir and data dir (is application dir for portable)
QStringList baseDirs; QStringList baseDirs;
baseDirs.append(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())); baseDirs.append(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
baseDirs.append(QString::fromUtf8(RsAccounts::DataDirectory().c_str())); baseDirs.append(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()));
return baseDirs; return baseDirs;
} }

View File

@ -107,7 +107,7 @@ QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
if(fi.exists() && fi.isFile()) { if(fi.exists() && fi.isFile()) {
QString cpath = fi.canonicalFilePath(); QString cpath = fi.canonicalFilePath();
if (cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive) if (cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive)
|| cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive)) || cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive))
return QTextBrowser::loadResource(type, name); return QTextBrowser::loadResource(type, name);
}} }}

View File

@ -29,11 +29,12 @@
#include <iostream> #include <iostream>
#include <retroshare/rsbanlist.h> #include "retroshare/rsbanlist.h"
#include <retroshare/rsconfig.h> #include "retroshare/rsconfig.h"
#include <retroshare/rsdht.h> #include "retroshare/rsdht.h"
#include <retroshare/rspeers.h> #include "retroshare/rspeers.h"
#include <retroshare/rsturtle.h> #include "retroshare/rsturtle.h"
#include "retroshare/rsinit.h"
#include <QCheckBox> #include <QCheckBox>
#include <QMovie> #include <QMovie>
@ -62,23 +63,14 @@
/// ///
// Tabs numbers *after* non relevant tabs are removed. So do not use them to add/remove tabs!! // Tabs numbers *after* non relevant tabs are removed. So do not use them to add/remove tabs!!
#ifdef RETROTOR
static const uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0;
static const uint32_t TAB_HIDDEN_SERVICE_INCOMING = 1;
static const uint32_t TAB_NETWORK = 0;
static const uint32_t TAB_HIDDEN_SERVICE = 1;
static const uint32_t TAB_IP_FILTERS = 99; // This is a trick: these tabs do not exist, so enabling/disabling them has no effect
static const uint32_t TAB_RELAYS = 99;
#else
const static uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0; const static uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0;
const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 2; const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 1;
const static uint32_t TAB_HIDDEN_SERVICE_I2P_BOB = 2;
const static uint32_t TAB_NETWORK = 0; const static uint32_t TAB_NETWORK = 0;
const static uint32_t TAB_IP_FILTERS = 1; const static uint32_t TAB_HIDDEN_SERVICE = 1;
const static uint32_t TAB_HIDDEN_SERVICE = 2; const static uint32_t TAB_IP_FILTERS = 2;
const static uint32_t TAB_RELAYS = 3; const static uint32_t TAB_RELAYS = 3;
#endif
//#define SERVER_DEBUG 1 //#define SERVER_DEBUG 1
@ -90,13 +82,15 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
manager = NULL ; manager = NULL ;
#ifdef RETROTOR if(RsAccounts::isTorAuto())
{
// Here we use absolute numbers instead of consts defined above, because the consts correspond to the tab number *after* this tab removal. // Here we use absolute numbers instead of consts defined above, because the consts correspond to the tab number *after* this tab removal.
ui.tabWidget->removeTab(3) ; // remove relays. Not useful in Tor mode. ui.tabWidget->removeTab(TAB_RELAYS) ; // remove relays. Not useful in Tor mode.
ui.tabWidget->removeTab(1) ; // remove IP filters. Not useful in Tor mode. ui.tabWidget->removeTab(TAB_IP_FILTERS) ; // remove IP filters. Not useful in Tor mode.
ui.hiddenServiceTab->removeTab(TAB_HIDDEN_SERVICE_I2P_BOB) ; // remove the Automatic I2P/BOB tab
ui.hiddenServiceTab->removeTab(1) ; // remove the Automatic I2P/BOB tab
ui.hiddenpage_proxyAddress_i2p->hide() ; ui.hiddenpage_proxyAddress_i2p->hide() ;
ui.hiddenpage_proxyLabel_i2p->hide() ; ui.hiddenpage_proxyLabel_i2p->hide() ;
ui.hiddenpage_proxyPort_i2p->hide() ; ui.hiddenpage_proxyPort_i2p->hide() ;
@ -109,7 +103,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
ui.hiddenpage_outHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ; ui.hiddenpage_outHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ;
ui.hiddenpage_inHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ; ui.hiddenpage_inHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ;
#endif }
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ; ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ;
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_STATUS,new QTableWidgetItem(tr("Status"))) ; ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_STATUS,new QTableWidgetItem(tr("Status"))) ;
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_ORIGIN,new QTableWidgetItem(tr("Origin"))) ; ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_ORIGIN,new QTableWidgetItem(tr("Origin"))) ;
@ -137,7 +132,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it) for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
ui.IPServersLV->addItem(QString::fromStdString(*it)) ; ui.IPServersLV->addItem(QString::fromStdString(*it)) ;
ui.hiddenServiceTab->setTabEnabled(TAB_HIDDEN_SERVICE_INCOMING, false);
ui.gbBob->setEnabled(false); ui.gbBob->setEnabled(false);
ui.swBobAdvanced->setCurrentIndex(0); ui.swBobAdvanced->setCurrentIndex(0);
@ -340,8 +334,8 @@ void ServerPage::load()
if (mIsHiddenNode) if (mIsHiddenNode)
{ {
mHiddenType = detail.hiddenType; mHiddenType = detail.hiddenType;
ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter //ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter
ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay //ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay
loadHiddenNode(); loadHiddenNode();
return; return;
} }

View File

@ -26,7 +26,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabNetConf"> <widget class="QWidget" name="tabNetConf">
<attribute name="title"> <attribute name="title">
@ -525,277 +525,6 @@ behind a firewall or a VPN.</string>
<zorder>IPServersLV</zorder> <zorder>IPServersLV</zorder>
<zorder>ipAddressList</zorder> <zorder>ipAddressList</zorder>
</widget> </widget>
<widget class="QWidget" name="tabIPFilters">
<attribute name="title">
<string>IP Filters</string>
</attribute>
<layout class="QVBoxLayout" name="tabIPFiltersVLayout">
<item>
<widget class="QCheckBox" name="denyAll_CB">
<property name="text">
<string>Activate IP filtering</string>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="ipTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="ipBlackListTabWidget">
<attribute name="title">
<string>IP blacklist</string>
</attribute>
<layout class="QVBoxLayout" name="ipBlackListTabWidgetVLayout">
<item>
<widget class="QTableWidget" name="filteredIpsTable">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This list gets automatically filled with information gathered at multiple sources: masquerading peers reported by the DHT, IP ranges entered by you, and IP ranges reported by your friends. Default settings should protect you against large scale traffic relaying.&lt;/p&gt;&lt;p&gt;Automatically guessing masquerading IPs can put your friends IPs in the blacklist. In this case, use the context menu to whitelist them.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>IP range</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Reason</string>
</property>
</column>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QCheckBox" name="includeFromFriends_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is very drastic, be careful. Since masquerading IPs might be actual real IPs, this option might cause disconnection, and will probably force you to add your friends' IPs into the whitelist.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ban every IP reported by your friends</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="includeFromDHT_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Another drastic option. If you use it, be prepared to add your friends' IPs into the whitelist when needed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ban every masquerading IP reported by your DHT</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="groupIPRangesHLayout">
<item>
<widget class="QCheckBox" name="groupIPRanges_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If used alone, this option protects you quite well from large scale IP masquerading.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Automatically ban ranges of DHT masquerading IPs starting at</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="groupIPRanges_SB">
<property name="suffix">
<string> IPs</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item>
<spacer name="groupIPRangesHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="ipWhiteListTabWidget">
<attribute name="title">
<string>IP whitelist</string>
</attribute>
<layout class="QGridLayout" name="ipWhiteListTabWidgetGLayout">
<item row="0" column="0">
<widget class="QTableWidget" name="whiteListIpsTable">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;White listed IPs are gathered from the following sources: IPs coming inside a manually exchanged certificate, IP ranges entered by you in this window, or in the security feed items.&lt;/p&gt;&lt;p&gt;The default behavior for Retroshare is to (1) always allow connection to peers with IP in the whitelist, even if that IP is also blacklisted; (2) optionally require IPs to be in the whitelist. You can change this behavior for each peer in the &amp;quot;Details&amp;quot; window of each Retroshare node. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>IP range</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Reason</string>
</property>
</column>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="manualInputGBox">
<property name="title">
<string>Manual input</string>
</property>
<layout class="QVBoxLayout" name="manualInputGBoxVLayout">
<item>
<layout class="QHBoxLayout" name="ipinputHLayout">
<item>
<widget class="QLineEdit" name="ipInput_LE">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter an IP range. Accepted formats:&lt;/p&gt;&lt;p&gt;193.190.209.15&lt;/p&gt;&lt;p&gt;193.190.209.15/24&lt;/p&gt;&lt;p&gt;193.190.209.15/16&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="ipInputRange_SB">
<property name="minimum">
<number>16</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="ipInputComment_LE">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter any comment you'd like&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ipInputAddBlackList_PB">
<property name="text">
<string>Add to blacklist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ipInputAddWhiteList_PB">
<property name="text">
<string>Add to whitelist</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="manualInputVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabHiddenConf"> <widget class="QWidget" name="tabHiddenConf">
<attribute name="title"> <attribute name="title">
<string>Hidden Service Configuration</string> <string>Hidden Service Configuration</string>
@ -810,7 +539,7 @@ behind a firewall or a VPN.</string>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="hiddenServiceTabManual"> <widget class="QWidget" name="hiddenServiceTabManual">
<attribute name="title"> <attribute name="title">
@ -981,6 +710,204 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="hiddenServiceTabIncoming">
<attribute name="title">
<string>Incoming</string>
</attribute>
<layout class="QVBoxLayout" name="hiddenServiceTabIncomingVLayout">
<item>
<widget class="QLabel" name="hiddenpage_inHeader">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Setup your hidden address (and port if needed)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="incomingAddressGLayout">
<item row="0" column="2">
<widget class="QSpinBox" name="hiddenpage_localPort">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="0" column="3">
<layout class="QHBoxLayout" name="testIncomingHLayout">
<item>
<widget class="QPushButton" name="testIncoming_PB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &amp;quot;security warning&amp;quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it, which you should interpret as a sign of good communication.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="hiddenpage_servicePort">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="l_serviceAddress">
<property name="text">
<string>Service Address</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="l_localAddress">
<property name="text">
<string>Local Address</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="hiddenpage_serviceAddress">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is your hidden address. It should look like &lt;span style=&quot; font-weight:600;&quot;&gt;[something].onion&lt;/span&gt; or &lt;span style=&quot; font-weight:600;&quot;&gt;[something].b32.i2p. &lt;/span&gt;If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. &lt;span style=&quot; font-weight:600;&quot;&gt;/var/lib/tor/[service name]/hostname&lt;/span&gt;. For I2P: Setup a server tunnel ( http://127.0.0.1:7657/i2ptunnelmgr ) and copy it's base32 address when it is started (should end with .b32.i2p)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hiddenpage_localAddress">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the local address to which the hidden service points at your localhost. Most of the time, &lt;span style=&quot; font-weight:600;&quot;&gt;127.0.0.1&lt;/span&gt; is the right answer.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="serviceIncomingHLayout">
<item>
<widget class="QLabel" name="iconlabel_service_incoming">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_incomingTestResult">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led turns green only if you launch an active test using the above button. &lt;/p&gt;&lt;p&gt;When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) &lt;/p&gt;&lt;p&gt;network. Congratulations!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>incoming ok</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="hiddenpage_configurationVLayout">
<item>
<widget class="QLabel" name="l_hiddenpage_configuration">
<property name="text">
<string>Expected Configuration:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="hiddenpage_configuration">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="plainText">
<string>Please fill in a service address</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPlainTextEdit" name="hiddenpageInHelpPlainTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="plainText">
<string>To Receive Connections, you must first setup a Tor/I2P Hidden Service.
For Tor: See torrc and documentation for HOWTO details.
For I2P: See http://127.0.0.1:7657/i2ptunnelmgr for setting up a server tunnel:
Tunnel Wizard -&gt; Server Tunnel -&gt; Standard -&gt; enter a name -&gt; enter the address and port your RS is using (see Local Address above) -&gt; check 'Auto Start' -&gt; finish!
Once this is done, paste the Onion/I2P (Base32) Address in the box above.
This is your external address on the Tor/I2P network.
Finally make sure that the Ports match the configuration.
If you have issues connecting over Tor check the Tor logs too.</string>
</property>
</widget>
</item>
<item>
<spacer name="vspacerHiddenIn">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="hiddenServiceTabI2PBOB"> <widget class="QWidget" name="hiddenServiceTabI2PBOB">
<attribute name="title"> <attribute name="title">
<string>Automatic I2P/BOB</string> <string>Automatic I2P/BOB</string>
@ -1456,204 +1383,277 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="hiddenServiceTabIncoming"> </widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabIPFilters">
<attribute name="title">
<string>IP Filters</string>
</attribute>
<layout class="QVBoxLayout" name="tabIPFiltersVLayout">
<item>
<widget class="QCheckBox" name="denyAll_CB">
<property name="text">
<string>Activate IP filtering</string>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="ipTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="ipBlackListTabWidget">
<attribute name="title"> <attribute name="title">
<string>Incoming</string> <string>IP blacklist</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="hiddenServiceTabIncomingVLayout"> <layout class="QVBoxLayout" name="ipBlackListTabWidgetVLayout">
<item> <item>
<widget class="QLabel" name="hiddenpage_inHeader"> <widget class="QTableWidget" name="filteredIpsTable">
<property name="text"> <property name="contextMenuPolicy">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Setup your hidden address (and port if needed)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <enum>Qt::CustomContextMenu</enum>
</property> </property>
</widget> <property name="toolTip">
</item> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This list gets automatically filled with information gathered at multiple sources: masquerading peers reported by the DHT, IP ranges entered by you, and IP ranges reported by your friends. Default settings should protect you against large scale traffic relaying.&lt;/p&gt;&lt;p&gt;Automatically guessing masquerading IPs can put your friends IPs in the blacklist. In this case, use the context menu to whitelist them.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<item>
<layout class="QGridLayout" name="incomingAddressGLayout">
<item row="0" column="2">
<widget class="QSpinBox" name="hiddenpage_localPort">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="0" column="3">
<layout class="QHBoxLayout" name="testIncomingHLayout">
<item>
<widget class="QPushButton" name="testIncoming_PB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &amp;quot;security warning&amp;quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it, which you should interpret as a sign of good communication.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="hiddenpage_servicePort">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="l_serviceAddress">
<property name="text">
<string>Service Address</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="l_localAddress">
<property name="text">
<string>Local Address</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="hiddenpage_serviceAddress">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is your hidden address. It should look like &lt;span style=&quot; font-weight:600;&quot;&gt;[something].onion&lt;/span&gt; or &lt;span style=&quot; font-weight:600;&quot;&gt;[something].b32.i2p. &lt;/span&gt;If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. &lt;span style=&quot; font-weight:600;&quot;&gt;/var/lib/tor/[service name]/hostname&lt;/span&gt;. For I2P: Setup a server tunnel ( http://127.0.0.1:7657/i2ptunnelmgr ) and copy it's base32 address when it is started (should end with .b32.i2p)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hiddenpage_localAddress">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the local address to which the hidden service points at your localhost. Most of the time, &lt;span style=&quot; font-weight:600;&quot;&gt;127.0.0.1&lt;/span&gt; is the right answer.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="serviceIncomingHLayout">
<item>
<widget class="QLabel" name="iconlabel_service_incoming">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_incomingTestResult">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led turns green only if you launch an active test using the above button. &lt;/p&gt;&lt;p&gt;When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) &lt;/p&gt;&lt;p&gt;network. Congratulations!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>incoming ok</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="hiddenpage_configurationVLayout">
<item>
<widget class="QLabel" name="l_hiddenpage_configuration">
<property name="text">
<string>Expected Configuration:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="hiddenpage_configuration">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="plainText">
<string>Please fill in a service address</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPlainTextEdit" name="hiddenpageInHelpPlainTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="maximumSize"> <property name="alternatingRowColors">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="plainText"> <property name="selectionMode">
<string>To Receive Connections, you must first setup a Tor/I2P Hidden Service. <enum>QAbstractItemView::SingleSelection</enum>
</property>
For Tor: See torrc and documentation for HOWTO details. <property name="sortingEnabled">
<bool>false</bool>
For I2P: See http://127.0.0.1:7657/i2ptunnelmgr for setting up a server tunnel: </property>
Tunnel Wizard -&gt; Server Tunnel -&gt; Standard -&gt; enter a name -&gt; enter the address and port your RS is using (see Local Address above) -&gt; check 'Auto Start' -&gt; finish! <attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
Once this is done, paste the Onion/I2P (Base32) Address in the box above. </attribute>
This is your external address on the Tor/I2P network. <column>
Finally make sure that the Ports match the configuration. <property name="text">
<string>IP range</string>
If you have issues connecting over Tor check the Tor logs too.</string> </property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Reason</string>
</property>
</column>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QCheckBox" name="includeFromFriends_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is very drastic, be careful. Since masquerading IPs might be actual real IPs, this option might cause disconnection, and will probably force you to add your friends' IPs into the whitelist.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ban every IP reported by your friends</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="vspacerHiddenIn"> <widget class="QCheckBox" name="includeFromDHT_CB">
<property name="orientation"> <property name="toolTip">
<enum>Qt::Vertical</enum> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Another drastic option. If you use it, be prepared to add your friends' IPs into the whitelist when needed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="text">
<size> <string>Ban every masquerading IP reported by your DHT</string>
<width>20</width>
<height>40</height>
</size>
</property> </property>
</spacer> </widget>
</item>
<item>
<layout class="QHBoxLayout" name="groupIPRangesHLayout">
<item>
<widget class="QCheckBox" name="groupIPRanges_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If used alone, this option protects you quite well from large scale IP masquerading.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Automatically ban ranges of DHT masquerading IPs starting at</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="groupIPRanges_SB">
<property name="suffix">
<string> IPs</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item>
<spacer name="groupIPRangesHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="ipWhiteListTabWidget">
<attribute name="title">
<string>IP whitelist</string>
</attribute>
<layout class="QGridLayout" name="ipWhiteListTabWidgetGLayout">
<item row="0" column="0">
<widget class="QTableWidget" name="whiteListIpsTable">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;White listed IPs are gathered from the following sources: IPs coming inside a manually exchanged certificate, IP ranges entered by you in this window, or in the security feed items.&lt;/p&gt;&lt;p&gt;The default behavior for Retroshare is to (1) always allow connection to peers with IP in the whitelist, even if that IP is also blacklisted; (2) optionally require IPs to be in the whitelist. You can change this behavior for each peer in the &amp;quot;Details&amp;quot; window of each Retroshare node. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>IP range</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Reason</string>
</property>
</column>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="manualInputGBox">
<property name="title">
<string>Manual input</string>
</property>
<layout class="QVBoxLayout" name="manualInputGBoxVLayout">
<item>
<layout class="QHBoxLayout" name="ipinputHLayout">
<item>
<widget class="QLineEdit" name="ipInput_LE">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter an IP range. Accepted formats:&lt;/p&gt;&lt;p&gt;193.190.209.15&lt;/p&gt;&lt;p&gt;193.190.209.15/24&lt;/p&gt;&lt;p&gt;193.190.209.15/16&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="ipInputRange_SB">
<property name="minimum">
<number>16</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="ipInputComment_LE">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter any comment you'd like&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ipInputAddBlackList_PB">
<property name="text">
<string>Add to blacklist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ipInputAddWhiteList_PB">
<property name="text">
<string>Add to whitelist</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="manualInputVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -187,9 +187,7 @@ public:
/** Sets whether the bandwidth graph is always on top. */ /** Sets whether the bandwidth graph is always on top. */
void setBWGraphAlwaysOnTop(bool alwaysOnTop); void setBWGraphAlwaysOnTop(bool alwaysOnTop);
#ifdef RETROTOR
void setHiddenServiceKey() ; void setHiddenServiceKey() ;
#endif
uint getNewsFeedFlags(); uint getNewsFeedFlags();
void setNewsFeedFlags(uint flags); void setNewsFeedFlags(uint flags);

View File

@ -26,12 +26,11 @@
#include <QPixmap> #include <QPixmap>
#include "retroshare/rsconfig.h" #include "retroshare/rsconfig.h"
#include "retroshare/rsinit.h"
#include "util/misc.h" #include "util/misc.h"
#ifdef RETROTOR
#include "TorControl/TorManager.h" #include "TorControl/TorManager.h"
#include "TorControl/TorControl.h" #include "TorControl/TorControl.h"
#endif
#include <iomanip> #include <iomanip>
@ -86,53 +85,56 @@ void TorStatus::getTorStatus()
int S = QFontMetricsF(torstatusLabel->font()).height(); int S = QFontMetricsF(torstatusLabel->font()).height();
#ifdef RETROTOR if(RsAccounts::isTorAuto())
// get Tor status
int tor_control_status = Tor::TorManager::instance()->control()->status();
int torstatus = Tor::TorManager::instance()->control()->torStatus();
QString tor_control_status_str,torstatus_str ;
bool tor_control_ok ;
switch(tor_control_status)
{ {
default: // get Tor status
case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ; int tor_control_status = Tor::TorManager::instance()->control()->status();
case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ; int torstatus = Tor::TorManager::instance()->control()->torStatus();
case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ;
case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ;
case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ;
}
switch(torstatus) QString tor_control_status_str,torstatus_str ;
{ bool tor_control_ok ;
default:
case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ; switch(tor_control_status)
case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ; {
case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ; default:
} case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ;
case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ;
case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ;
case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ;
case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ;
}
switch(torstatus)
{
default:
case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ;
case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ;
case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ;
}
#define MIN_RS_NET_SIZE 10 #define MIN_RS_NET_SIZE 10
if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok) if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok)
{
// RED - some issue.
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
}
else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok)
{
torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is OK"));
}
else // torstatus == Tor::TorControl::TorUnknown
{
// GRAY.
torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("No tor configuration"));
}
}
else
{ {
// RED - some issue. torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation));
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is currently offline")); torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
} }
else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok)
{
torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is OK"));
}
else // torstatus == Tor::TorControl::TorUnknown
{
// GRAY.
torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("No tor configuration"));
}
#else
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
#endif
} }

View File

@ -31,7 +31,7 @@
static QMap<RsPlugin*, QTranslator*> translatorPlugins; static QMap<RsPlugin*, QTranslator*> translatorPlugins;
#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::DataDirectory().c_str()) #define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::systemDataDirectory().c_str())
/** Initializes the list of available languages. */ /** Initializes the list of available languages. */
QMap<QString, QString> QMap<QString, QString>

View File

@ -51,10 +51,8 @@
# include "gui/settings/WebuiPage.h" # include "gui/settings/WebuiPage.h"
#endif #endif
#ifdef RETROTOR #include "TorControl/TorManager.h"
# include "TorControl/TorManager.h" #include "TorControl/TorControlWindow.h"
# include "TorControl/TorControlWindow.h"
#endif
#include "retroshare/rsidentity.h" #include "retroshare/rsidentity.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
@ -349,51 +347,58 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
SoundManager::create(); SoundManager::create();
#ifdef RETROTOR bool is_hidden_node = false;
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service bool is_auto_tor = false ;
bool is_first_time = false ;
QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ; RsAccounts::getCurrentAccountOptions(is_hidden_node,is_auto_tor,is_first_time);
Tor::TorManager *torManager = Tor::TorManager::instance(); if(is_auto_tor)
torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/"));
torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
torManager->setupHiddenService();
if(! torManager->start() || torManager->hasError())
{ {
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ; // Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
return 1 ;
}
{ QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ;
TorControlDialog tcd(torManager) ;
QString error_msg ;
tcd.show();
while(tcd.checkForTor(error_msg) != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails. Tor::TorManager *torManager = Tor::TorManager::instance();
torManager->setTorDataDirectory(Rshare::dataDirectory() + QString("/tor/"));
torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
torManager->setupHiddenService();
if(! torManager->start() || torManager->hasError())
{ {
QCoreApplication::processEvents(); QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ;
rstime::rs_usleep(0.2*1000*1000) ;
if(!error_msg.isNull())
{
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor"),QObject::tr("Sorry but Tor cannot be started on your system!\n\nThe error reported is:\"")+error_msg+"\"") ;
return 1;
}
}
tcd.hide();
if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK)
{
QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ;
return 1 ; return 1 ;
} }
{
TorControlDialog tcd(torManager) ;
QString error_msg ;
tcd.show();
while(tcd.checkForTor(error_msg) != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
{
QCoreApplication::processEvents();
rstime::rs_usleep(0.2*1000*1000) ;
if(!error_msg.isNull())
{
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor"),QObject::tr("Sorry but Tor cannot be started on your system!\n\nThe error reported is:\"")+error_msg+"\"") ;
return 1;
}
}
tcd.hide();
if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK)
{
QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ;
return 1 ;
}
}
} }
#endif
QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/); QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/);
@ -409,33 +414,35 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
return 1; return 1;
} }
#ifdef RETROTOR if(is_auto_tor)
// Tor works with viable hidden service. Let's use it! {
// Tor works with viable hidden service. Let's use it!
QString service_id ; QString service_id ;
QString onion_address ; QString onion_address ;
uint16_t service_port ; uint16_t service_port ;
uint16_t service_target_port ; uint16_t service_target_port ;
uint16_t proxy_server_port ; uint16_t proxy_server_port ;
QHostAddress service_target_address ; QHostAddress service_target_address ;
QHostAddress proxy_server_address ; QHostAddress proxy_server_address ;
torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port); Tor::TorManager *torManager = Tor::TorManager::instance();
torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ; torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ;
std::cerr << "Got hidden service info: " << std::endl; std::cerr << "Got hidden service info: " << std::endl;
std::cerr << " onion address : " << onion_address.toStdString() << std::endl; std::cerr << " onion address : " << onion_address.toStdString() << std::endl;
std::cerr << " service_id : " << service_id.toStdString() << std::endl; std::cerr << " service_id : " << service_id.toStdString() << std::endl;
std::cerr << " service port : " << service_port << std::endl; std::cerr << " service port : " << service_port << std::endl;
std::cerr << " target port : " << service_target_port << std::endl; std::cerr << " target port : " << service_target_port << std::endl;
std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl; std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl;
std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl; std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl;
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port); rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port);
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port); rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port);
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ; rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ;
#endif }
Rshare::initPlugins(); Rshare::initPlugins();

View File

@ -19,11 +19,9 @@ libresapihttpserver {
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including") !include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
retrotor { FORMS += TorControl/TorControlWindow.ui
FORMS += TorControl/TorControlWindow.ui SOURCES += TorControl/TorControlWindow.cpp
SOURCES += TorControl/TorControlWindow.cpp HEADERS += TorControl/TorControlWindow.h
HEADERS += TorControl/TorControlWindow.h
}
#QMAKE_CFLAGS += -fmudflap #QMAKE_CFLAGS += -fmudflap
#LIBS *= /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflap.a /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflapth.a #LIBS *= /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflap.a /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflapth.a
@ -285,7 +283,8 @@ wikipoos {
LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
} }
retrotor { # Tor controller
HEADERS += TorControl/AddOnionCommand.h \ HEADERS += TorControl/AddOnionCommand.h \
TorControl/AuthenticateCommand.h \ TorControl/AuthenticateCommand.h \
TorControl/GetConfCommand.h \ TorControl/GetConfCommand.h \
@ -324,7 +323,6 @@ SOURCES += TorControl/AddOnionCommand.cpp \
TorControl/SecureRNG.cpp \ TorControl/SecureRNG.cpp \
TorControl/Settings.cpp \ TorControl/Settings.cpp \
TorControl/StrUtil.cpp TorControl/StrUtil.cpp
}
# Input # Input
HEADERS += rshare.h \ HEADERS += rshare.h \

View File

@ -748,7 +748,7 @@ void Rshare::loadStyleSheet(const QString &sheetName)
/* external stylesheet */ /* external stylesheet */
file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()), name, sheetName)); file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()), name, sheetName));
if (!file.exists()) { if (!file.exists()) {
file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::DataDirectory().c_str()), name, sheetName)); file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()), name, sheetName));
} }
} }
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
@ -787,7 +787,7 @@ void Rshare::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
styleSheets.insert(name, name); styleSheets.insert(name, name);
} }
} }
fileInfoList = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss")); fileInfoList = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
foreach (fileInfo, fileInfoList) { foreach (fileInfo, fileInfoList) {
if (fileInfo.isFile()) { if (fileInfo.isFile()) {
QString name = fileInfo.baseName(); QString name = fileInfo.baseName();

View File

@ -91,15 +91,6 @@ no_sqlcipher:CONFIG -= sqlcipher
CONFIG *= no_rs_autologin CONFIG *= no_rs_autologin
rs_autologin:CONFIG -= no_rs_autologin rs_autologin:CONFIG -= no_rs_autologin
# To build RetroShare Tor only version with automatic hidden node setup append
# the following assignation to qmake command line "CONFIG+=retrotor"
CONFIG *= no_retrotor
retrotor {
CONFIG -= no_retrotor
CONFIG *= rs_onlyhiddennode
DEFINES *= RETROTOR
}
# To have only hidden node generation append the following assignation # To have only hidden node generation append the following assignation
# to qmake command line "CONFIG+=rs_onlyhiddennode" # to qmake command line "CONFIG+=rs_onlyhiddennode"
CONFIG *= no_rs_onlyhiddennode CONFIG *= no_rs_onlyhiddennode
@ -144,7 +135,7 @@ rs_macos10.10:CONFIG -= rs_macos10.11
rs_macos10.12:CONFIG -= rs_macos10.11 rs_macos10.12:CONFIG -= rs_macos10.11
# To disable deep search append the following assignation to qmake command line # To disable deep search append the following assignation to qmake command line
# "CONFIG+=no_rs_deep_search" CONFIG+=no_rs_deep_search
CONFIG *= rs_deep_search CONFIG *= rs_deep_search
no_rs_deep_search:CONFIG -= rs_deep_search no_rs_deep_search:CONFIG -= rs_deep_search