Skip to content

Commit 41fb458

Browse files
committed
Updated to v2.6
1 parent 7e844aa commit 41fb458

File tree

1,806 files changed

+126496
-89184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,806 files changed

+126496
-89184
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
build-*
22
*.user
33
release/
4+
release64/
5+
release_x64/
46
debug/
57
temp/
68
.vs/
@@ -20,7 +22,7 @@ tools/.idea/
2022

2123
# secrets
2224
tools/notarize.yml
23-
common/utils/hardcodedsecrets.ini
25+
client/common/utils/hardcodedsecrets.ini
2426
common/keys/linux/key.pem
2527
common/keys/linux/key.pub
2628
common/keys/linux/key_pub.txt

.gitlab-ci.yml

Lines changed: 385 additions & 302 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Windscribe Desktop App Contributor's Guide
2+
3+
Please follow this guide for instructions / best practices when reporting issues, proposing new features, and submitting contributions via Pull Requests (PRs).
4+
5+
## Filing an Issue
6+
7+
1. Look for a similar issue that may already exist, including closed issues.
8+
9+
1. If none exists, create a new issue and provide as much description and context as possible.
10+
11+
1. Apply any relevant labels to the issue.
12+
13+
### How to notify the Windscribe devs of an interesting thing to consider for inclusion in the app
14+
15+
Upvote the original issue by clicking its [+😊] button and hitting 👍 (+1) icon or a different one. This allows us to measure how impactful different issues are compared to others. Commenting an issue with "+1", "me too", etc. makes it harder to have a conversation and prioritize requests.
16+
17+
## Contributing Fixes or Enhancements
18+
19+
If you are interested in helping to fix an issue and/or implement new features, we'd love your contribution!
20+
21+
When contributing to the Windscribe Desktop App repository, please first discuss the change you wish to make with the Windscribe development team via an issue. This repository is a mirror of our internal development repository, and is updated only when we make a public release. Therefore it is possible the development team is already working on, or has completed, this change. Further, we want to avoid you investing your time in a change that we may not be able to approve for integration into the app.

README.md

Lines changed: 139 additions & 151 deletions
Large diffs are not rendered by default.

backend/linux/helper/execute_cmd.cpp

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <boost/thread.hpp>
33
#include <syslog.h>
44

5-
unsigned long ExecuteCmd::execute(const char *cmd)
5+
unsigned long ExecuteCmd::execute(const std::string &cmd, const std::string &cwd)
66
{
77
mutex_.lock();
88
curCmdId_++;
@@ -12,25 +12,25 @@ unsigned long ExecuteCmd::execute(const char *cmd)
1212
cmdDescr->cmdId = curCmdId_;
1313
executingCmds_.push_back(cmdDescr);
1414
mutex_.unlock();
15-
16-
std::string str = cmd;
17-
boost::thread(runCmd, curCmdId_, str);
15+
16+
if (!cwd.empty()) {
17+
boost::thread(runCmd, curCmdId_, "cd \"" + cwd + "\" && " + cmd);
18+
} else {
19+
boost::thread(runCmd, curCmdId_, cmd);
20+
}
1821

1922
return curCmdId_;
2023
}
2124

2225
void ExecuteCmd::getStatus(unsigned long cmdId, bool &bFinished, std::string &log)
2326
{
2427
mutex_.lock();
25-
for (auto it = executingCmds_.begin(); it != executingCmds_.end(); ++it)
26-
{
27-
if ((*it)->cmdId == cmdId)
28-
{
28+
for (auto it = executingCmds_.begin(); it != executingCmds_.end(); ++it) {
29+
if ((*it)->cmdId == cmdId) {
2930
bFinished = (*it)->bFinished;
3031
log = (*it)->log;
3132

32-
if ((*it)->bFinished)
33-
{
33+
if ((*it)->bFinished) {
3434
delete (*it);
3535
executingCmds_.erase(it);
3636
}
@@ -43,8 +43,7 @@ void ExecuteCmd::getStatus(unsigned long cmdId, bool &bFinished, std::string &lo
4343
void ExecuteCmd::clearCmds()
4444
{
4545
mutex_.lock();
46-
for (auto it = executingCmds_.begin(); it != executingCmds_.end(); ++it)
47-
{
46+
for (auto it = executingCmds_.begin(); it != executingCmds_.end(); ++it) {
4847
delete (*it);
4948
}
5049
executingCmds_.clear();
@@ -54,7 +53,6 @@ void ExecuteCmd::clearCmds()
5453

5554
ExecuteCmd::ExecuteCmd() : curCmdId_(0)
5655
{
57-
5856
}
5957

6058
void ExecuteCmd::runCmd(unsigned long cmdId, std::string cmd)
@@ -63,32 +61,25 @@ void ExecuteCmd::runCmd(unsigned long cmdId, std::string cmd)
6361

6462
// run openvpn command
6563
FILE *file = popen(cmd.c_str(), "r");
66-
if (file)
67-
{
64+
if (file) {
6865
char szLine[4096];
69-
while(fgets(szLine, sizeof(szLine), file) != 0)
70-
{
71-
if (instance().isCmdExist(cmdId))
72-
{
66+
while(fgets(szLine, sizeof(szLine), file) != 0) {
67+
if (instance().isCmdExist(cmdId)) {
7368
strReply += szLine;
7469
}
7570
}
7671
pclose(file);
7772
instance().cmdFinished(cmdId, true, strReply);
78-
}
79-
else
80-
{
73+
} else {
8174
instance().cmdFinished(cmdId, false, std::string());
8275
}
8376
}
8477

8578
void ExecuteCmd::cmdFinished(unsigned long cmdId, bool bSuccess, std::string log)
8679
{
8780
mutex_.lock();
88-
for (auto it = executingCmds_.begin(); it != executingCmds_.end(); ++it)
89-
{
90-
if ((*it)->cmdId == cmdId)
91-
{
81+
for (auto it = executingCmds_.begin(); it != executingCmds_.end(); ++it) {
82+
if ((*it)->cmdId == cmdId) {
9283
(*it)->bFinished = true;
9384
(*it)->bSuccess = bSuccess;
9485
(*it)->log = log;

backend/linux/helper/execute_cmd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ExecuteCmd
1515
return i;
1616
}
1717

18-
unsigned long execute(const char *cmd);
18+
unsigned long execute(const std::string &cmd, const std::string &cwd = "");
1919
void getStatus(unsigned long cmdId, bool &bFinished, std::string &log);
2020
void clearCmds();
2121

backend/linux/helper/helper.pro

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,42 @@ contains(CONFIG, use_signature_check) {
2828
}
2929

3030
SOURCES += \
31-
../../../common/utils/executable_signature/executable_signature.cpp \
32-
../../../common/utils/executable_signature/executablesignature_linux.cpp \
31+
../../../client/common/utils/executable_signature/executable_signature.cpp \
32+
../../../client/common/utils/executable_signature/executablesignature_linux.cpp \
3333
execute_cmd.cpp \
3434
ipc/helper_security.cpp \
3535
logger.cpp \
3636
main.cpp \
37+
ovpn.cpp \
3738
server.cpp \
3839
utils.cpp \
40+
routes_manager/routes.cpp \
41+
routes_manager/routes_manager.cpp \
42+
wireguard/defaultroutemonitor.cpp \
3943
wireguard/wireguardadapter.cpp \
40-
wireguard/wireguardcommunicator.cpp \
44+
wireguard/userspace/wireguardgocommunicator.cpp \
45+
wireguard/kernelmodule/kernelmodulecommunicator.cpp \
46+
wireguard/kernelmodule/wireguard.c \
4147
wireguard/wireguardcontroller.cpp
4248

4349
HEADERS += \
44-
../../../common/utils/executable_signature/executable_signature.h \
45-
../../../common/utils/executable_signature/executablesignature_linux.h \
50+
../../../client/common/utils/executable_signature/executable_signature.h \
51+
../../../client/common/utils/executable_signature/executablesignature_linux.h \
4652
../../posix_common/helper_commands.h \
4753
../../posix_common/helper_commands_serialize.h \
4854
3rdparty/pstream.h \
4955
execute_cmd.h \
5056
ipc/helper_security.h \
5157
logger.h \
58+
ovpn.h \
5259
server.h \
5360
utils.h \
61+
routes_manager/routes.h \
62+
routes_manager/routes_manager.h \
63+
wireguard/defaultroutemonitor.h \
5464
wireguard/wireguardadapter.h \
55-
wireguard/wireguardcommunicator.h \
65+
wireguard/iwireguardcommunicator.h \
66+
wireguard/userspace/wireguardgocommunicator.h \
67+
wireguard/kernelmodule/kernelmodulecommunicator.h \
68+
wireguard/kernelmodule/wireguard.h \
5669
wireguard/wireguardcontroller.h

backend/linux/helper/ipc/helper_security.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "logger.h"
1111

12-
#include "../../../common/utils/executable_signature/executable_signature.h"
12+
#include "../../../client/common/utils/executable_signature/executable_signature.h"
1313

1414
// Expects symLink to reference /path/*/exe, where * can be 'self', or a pid, or
1515
// an exe name.

backend/linux/helper/logger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void Logger::out(const char *str, ...)
2828
if ((bytesOut > 0) && (bytesOut < sizeof(buf)))
2929
{
3030
mutex_.lock();
31-
FILE* logFile = fopen("/usr/local/windscribe/helper_log.txt", "a");
31+
FILE* logFile = fopen("/opt/windscribe/helper_log.txt", "a");
3232
if (logFile != NULL)
3333
{
3434
fprintf(logFile, "%s\n", buf);

backend/linux/helper/ovpn.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#include "ovpn.h"
2+
#include "logger.h"
3+
#include <fcntl.h>
4+
#include <sstream>
5+
#include <string>
6+
#include <unistd.h>
7+
8+
namespace OVPN
9+
{
10+
11+
bool writeOVPNFile(const std::string &dnsScript, const std::string &config, bool isCustomConfig)
12+
{
13+
std::istringstream stream(config);
14+
std::string line;
15+
int bytes;
16+
17+
int fd = open("/etc/windscribe/config.ovpn", O_CREAT | O_WRONLY | O_TRUNC, S_IRWXU | S_IRGRP | S_IROTH);
18+
if (fd < 0) {
19+
Logger::instance().out("Could not open firewall rules for writing");
20+
return false;
21+
}
22+
23+
while(getline(stream, line)) {
24+
// trim whitespace
25+
line.erase(0, line.find_first_not_of(" \n\r\t"));
26+
line.erase(line.find_last_not_of(" \n\r\t") + 1);
27+
28+
// filter anything that runs an external script
29+
// check for up to offset of 2 in case the command starts with '--'
30+
if (line.rfind("up", 2) != std::string::npos ||
31+
line.rfind("tls-verify", 2) != std::string::npos ||
32+
line.rfind("ipchange", 2) != std::string::npos ||
33+
line.rfind("client-connect", 2) != std::string::npos ||
34+
line.rfind("route-up", 2) != std::string::npos ||
35+
line.rfind("route-pre-down", 2) != std::string::npos ||
36+
line.rfind("client-disconnect", 2) != std::string::npos ||
37+
line.rfind("down", 2) != std::string::npos ||
38+
line.rfind("learn-address", 2) != std::string::npos ||
39+
line.rfind("auth-user-pass-verify", 2) != std::string::npos)
40+
{
41+
continue;
42+
}
43+
44+
bytes = write(fd, (line + "\n").c_str(), line.length() + 1);
45+
if (bytes <= 0) {
46+
Logger::instance().out("Could not write openvpn config");
47+
close(fd);
48+
return false;
49+
}
50+
51+
}
52+
53+
// add our own up/down scripts
54+
if (!isCustomConfig) {
55+
const std::string upScript = \
56+
"--script-security 2\n" \
57+
"up " + dnsScript + "\n" \
58+
"down " + dnsScript + "\n" \
59+
"down-pre\n" \
60+
"dhcp-option DOMAIN-ROUTE .\n"; // prevent DNS leakage and without it doesn't work update-systemd-resolved script
61+
bytes = write(fd, upScript.c_str(), upScript.length());
62+
if (bytes <= 0) {
63+
Logger::instance().out("Could not write openvpn config");
64+
close(fd);
65+
return false;
66+
}
67+
}
68+
close(fd);
69+
return true;
70+
}
71+
72+
} // namespace OVPN

0 commit comments

Comments
 (0)