mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	Merge pull request 'Tor: update to 0.4.5.5-rc, build fixes' (#332) from tobtoht/feather:docker_tor_openssl into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/332
This commit is contained in:
		
						commit
						0efce33634
					
				
					 7 changed files with 117 additions and 35 deletions
				
			
		
							
								
								
									
										10
									
								
								BUILDING.md
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								BUILDING.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -37,19 +37,13 @@ Building the base image takes a while. You only need to build the base image onc
 | 
			
		|||
##### Standalone binary
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
docker run --rm -it -v $PWD:/feather --env OPENSSL_ROOT_DIR=/usr/local/openssl/ -w /feather feather:linux sh -c 'TOR_BIN="/usr/local/tor/bin/tor" make release-static -j4'
 | 
			
		||||
docker run --rm -it -v $PWD:/feather -w /feather feather:linux sh -c 'make release-static -j4'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you're re-running a build make sure to `rm -rf build/` first.
 | 
			
		||||
 | 
			
		||||
The resulting binary can be found in `build/bin/feather`.
 | 
			
		||||
 | 
			
		||||
Hashes for tagged commits should match:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
beta-1: d1a52e3bac1abbae4adda1fc88cb2a7a06fbd61085868421897c6a4f3f4eb091  feather
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
##### AppImage
 | 
			
		||||
 | 
			
		||||
First create the standalone binary using the Docker command in the previous step.
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +75,7 @@ Building the base image takes a while. You only need to build the base image onc
 | 
			
		|||
#### 3. Build
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
docker run --rm -it -v $PWD:/feather -w /feather feather:win sh -c 'TOR_BIN="/usr/local/tor/bin/tor.exe" make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j4'
 | 
			
		||||
docker run --rm -it -v $PWD:/feather -w /feather feather:win sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j4'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you're re-running a build make sure to `rm -rf build/` first.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -188,9 +188,16 @@ if(TOR_BIN)
 | 
			
		|||
        execute_process(COMMAND bash -c "touch ${CMAKE_CURRENT_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    execute_process(COMMAND bash -c "${TOR_BIN} --version --quiet" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret)
 | 
			
		||||
    if (ret EQUAL "0")
 | 
			
		||||
        set(TOR_VERSION "${out}")
 | 
			
		||||
    endif()
 | 
			
		||||
    message(STATUS "${TOR_VERSION}")
 | 
			
		||||
    configure_file("cmake/config-feather.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-feather.h")
 | 
			
		||||
 | 
			
		||||
    # on the buildbot Tor is baked into the image
 | 
			
		||||
    # - linux: See `Dockerfile`
 | 
			
		||||
    # - windows: https://github.com/mxe/mxe/blob/1024dc7d2db5eb7d5d3c64a2c12b5f592572f1ce/plugins/apps/tor.mk
 | 
			
		||||
    # - windows: See `Dockerfile.windows`
 | 
			
		||||
    # - macos: taken from Tor Browser official release
 | 
			
		||||
    set(TOR_COPY_CMD "cp -u ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor")
 | 
			
		||||
    message(STATUS "${TOR_COPY_CMD}")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								Dockerfile
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -42,9 +42,9 @@ RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \
 | 
			
		|||
    make -j$THREADS install && \
 | 
			
		||||
    rm -rf $(pwd)
 | 
			
		||||
 | 
			
		||||
RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git && \
 | 
			
		||||
RUN git clone -b tor-0.4.5.5-rc --depth 1 https://git.torproject.org/tor.git && \
 | 
			
		||||
    cd tor && \
 | 
			
		||||
    git reset --hard 9e26a9399fe2422475406d6ee3cb29b2924f3274 && \
 | 
			
		||||
    git reset --hard b36a00e9a9d3eb4b2949951afaa72e45fb7e68cd && \
 | 
			
		||||
    ./autogen.sh && \
 | 
			
		||||
    ./configure \
 | 
			
		||||
    --disable-asciidoc \
 | 
			
		||||
| 
						 | 
				
			
			@ -56,14 +56,15 @@ RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git &&
 | 
			
		|||
    --disable-zstd \
 | 
			
		||||
    --enable-static-tor \
 | 
			
		||||
    --with-libevent-dir=/usr/local/libevent \
 | 
			
		||||
    --with-openssl-dir=/usr/local/openssl-1.0.2u \
 | 
			
		||||
    --with-openssl-dir=/usr/local/openssl \
 | 
			
		||||
    --with-zlib-dir=/usr/local/zlib \
 | 
			
		||||
    --disable-tool-name-check \
 | 
			
		||||
    --enable-fatal-warnings \
 | 
			
		||||
    --prefix=/usr/local/tor && \
 | 
			
		||||
    make -j$THREADS && \
 | 
			
		||||
    make -j$THREADS install && \
 | 
			
		||||
    rm -rf $(pwd)
 | 
			
		||||
    rm -rf $(pwd) && \
 | 
			
		||||
    strip -s -D /usr/local/tor/bin/tor
 | 
			
		||||
 | 
			
		||||
FROM ubuntu:16.04
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +76,10 @@ ENV CPPFLAGS="-fPIC"
 | 
			
		|||
ENV CXXFLAGS="-fPIC"
 | 
			
		||||
ENV SOURCE_DATE_EPOCH=1397818193
 | 
			
		||||
 | 
			
		||||
COPY --from=tor /usr/local/tor/bin/tor /usr/local/tor/bin/tor
 | 
			
		||||
ENV OPENSSL_ROOT_DIR=/usr/local/openssl/
 | 
			
		||||
ENV TOR_BIN=/usr/local/tor/bin/tor
 | 
			
		||||
 | 
			
		||||
COPY --from=tor ${TOR_BIN} /usr/local/tor/bin/tor
 | 
			
		||||
 | 
			
		||||
RUN apt-get update && \
 | 
			
		||||
    apt-get install -y \
 | 
			
		||||
| 
						 | 
				
			
			@ -375,7 +379,7 @@ RUN git clone -b v3.10.0 --depth 1 https://github.com/protocolbuffers/protobuf &
 | 
			
		|||
RUN git clone -b v3.18.4 --depth 1 https://github.com/Kitware/CMake && \
 | 
			
		||||
    cd CMake && \
 | 
			
		||||
    git reset --hard 3cc3d42aba879fff5e85b363ae8f21386a3f9f9b && \
 | 
			
		||||
    OPENSSL_ROOT_DIR=/usr/local/openssl ./bootstrap && \
 | 
			
		||||
    ./bootstrap && \
 | 
			
		||||
    make -j$THREADS && \
 | 
			
		||||
    make -j$THREADS install && \
 | 
			
		||||
    rm -rf $(pwd)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,9 @@ ARG THREADS=1
 | 
			
		|||
ARG QT_VERSION=5.15.2
 | 
			
		||||
ENV SOURCE_DATE_EPOCH=1397818193
 | 
			
		||||
 | 
			
		||||
ENV OPENSSL_ROOT_DIR=/usr/local/openssl/
 | 
			
		||||
ENV TOR_BIN=/usr/local/tor/bin/tor.exe
 | 
			
		||||
 | 
			
		||||
RUN apt update && \
 | 
			
		||||
    DEBIAN_FRONTEND=noninteractive apt install -y curl wget zip automake build-essential cmake gcc-mingw-w64 g++-mingw-w64 gettext git libtool pkg-config \
 | 
			
		||||
    python && \
 | 
			
		||||
| 
						 | 
				
			
			@ -119,15 +122,14 @@ RUN wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz && \
 | 
			
		|||
    rm -rf $(pwd)
 | 
			
		||||
 | 
			
		||||
# OpenSSL -> Tor
 | 
			
		||||
# TODO: Tor will not cross-compile with 1.1.1i
 | 
			
		||||
RUN wget https://www.openssl.org/source/openssl-1.0.2u.tar.gz && \
 | 
			
		||||
    echo "ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 openssl-1.0.2u.tar.gz" | sha256sum -c && \
 | 
			
		||||
    tar -xzf openssl-1.0.2u.tar.gz && \
 | 
			
		||||
    rm openssl-1.0.2u.tar.gz && \
 | 
			
		||||
    cd openssl-1.0.2u && \
 | 
			
		||||
RUN wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz && \
 | 
			
		||||
    echo "e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242 openssl-1.1.1i.tar.gz" | sha256sum -c && \
 | 
			
		||||
    tar -xzf openssl-1.1.1i.tar.gz && \
 | 
			
		||||
    rm openssl-1.1.1i.tar.gz && \
 | 
			
		||||
    cd openssl-1.1.1i && \
 | 
			
		||||
    ./Configure mingw64 no-shared no-dso --cross-compile-prefix=x86_64-w64-mingw32- --prefix=/usr/local/openssl && \
 | 
			
		||||
    make -j$THREADS && \
 | 
			
		||||
    make install_sw && \
 | 
			
		||||
    make -j$THREADS install_sw && \
 | 
			
		||||
    rm -rf $(pwd)
 | 
			
		||||
 | 
			
		||||
# libevent -> Tor
 | 
			
		||||
| 
						 | 
				
			
			@ -144,9 +146,10 @@ RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.11-s
 | 
			
		|||
    make -j$THREADS install && \
 | 
			
		||||
    rm -rf $(pwd)
 | 
			
		||||
 | 
			
		||||
RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git && \
 | 
			
		||||
ENV TOR_VERSION=0.4.5.5-rc
 | 
			
		||||
RUN git clone -b tor-0.4.5.5-rc --depth 1 https://git.torproject.org/tor.git && \
 | 
			
		||||
    cd tor  && \
 | 
			
		||||
    git reset --hard 9e26a9399fe2422475406d6ee3cb29b2924f3274 && \
 | 
			
		||||
    git reset --hard b36a00e9a9d3eb4b2949951afaa72e45fb7e68cd && \
 | 
			
		||||
    ./autogen.sh && \
 | 
			
		||||
    ./configure --host=x86_64-w64-mingw32 \
 | 
			
		||||
    --disable-asciidoc \
 | 
			
		||||
| 
						 | 
				
			
			@ -166,7 +169,8 @@ RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git &&
 | 
			
		|||
    LIBS=-lcrypt32 && \
 | 
			
		||||
    make -j$THREADS && \
 | 
			
		||||
    make -j$THREADS install && \
 | 
			
		||||
    rm -rf $(pwd)
 | 
			
		||||
    rm -rf $(pwd) && \
 | 
			
		||||
    strip -s -D /usr/local/tor/bin/tor.exe
 | 
			
		||||
 | 
			
		||||
RUN git clone https://git.wownero.com/feather/monero-seed.git && \
 | 
			
		||||
    cd monero-seed && \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,4 +7,6 @@
 | 
			
		|||
#define MONERO_VERSION "@MONERO_VERSION@"
 | 
			
		||||
#define MONERO_BRANCH "@MONERO_BRANCH@"
 | 
			
		||||
 | 
			
		||||
#define TOR_VERSION "@TOR_VERSION@"
 | 
			
		||||
 | 
			
		||||
#endif //FEATHER_VERSION_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,9 +4,11 @@
 | 
			
		|||
#include <QScreen>
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QDesktopServices>
 | 
			
		||||
#include <QRegularExpression>
 | 
			
		||||
#include "utils/utils.h"
 | 
			
		||||
#include "utils/tor.h"
 | 
			
		||||
#include "appcontext.h"
 | 
			
		||||
#include "config-feather.h"
 | 
			
		||||
 | 
			
		||||
QString Tor::torHost = "127.0.0.1";
 | 
			
		||||
quint16 Tor::torPort = 9050;
 | 
			
		||||
| 
						 | 
				
			
			@ -200,10 +202,19 @@ bool Tor::unpackBins() {
 | 
			
		|||
    QFile f(torFile);
 | 
			
		||||
    QFileInfo fileInfo(f);
 | 
			
		||||
    this->torPath = QDir(this->torDir).filePath(fileInfo.fileName());
 | 
			
		||||
 | 
			
		||||
#if defined(Q_OS_WIN)
 | 
			
		||||
    if(!this->torPath.endsWith(".exe"))
 | 
			
		||||
        this->torPath += ".exe";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    TorVersion embeddedVersion = this->stringToVersion(QString(TOR_VERSION));
 | 
			
		||||
    TorVersion filesystemVersion = this->getVersion(torPath);
 | 
			
		||||
    qDebug() << QString("Tor versions: embedded %1, filesystem %2").arg(embeddedVersion.toString(), filesystemVersion.toString());
 | 
			
		||||
    if (embeddedVersion > filesystemVersion) {
 | 
			
		||||
        QFile::remove(torPath);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug() << "Writing Tor executable to " << this->torPath;
 | 
			
		||||
    f.copy(torPath);
 | 
			
		||||
    f.close();
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +226,7 @@ bool Tor::unpackBins() {
 | 
			
		|||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString Tor::getVersion() {
 | 
			
		||||
TorVersion Tor::getVersion(const QString &fileName) {
 | 
			
		||||
    QProcess process;
 | 
			
		||||
    process.setProcessChannelMode(QProcess::MergedChannels);
 | 
			
		||||
    process.start(this->torPath, QStringList() << "--version");
 | 
			
		||||
| 
						 | 
				
			
			@ -224,13 +235,23 @@ QString Tor::getVersion() {
 | 
			
		|||
 | 
			
		||||
    if(output.isEmpty()) {
 | 
			
		||||
        qWarning() << "Could not grab Tor version";
 | 
			
		||||
        return "";
 | 
			
		||||
        return TorVersion();
 | 
			
		||||
    }
 | 
			
		||||
    QString version = output.split('\n').at(0);
 | 
			
		||||
    if(version.startsWith("Tor version")){
 | 
			
		||||
        return version;
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
    return this->stringToVersion(output);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TorVersion Tor::stringToVersion(const QString &version) {
 | 
			
		||||
    QRegularExpression re("(?<major>\\d)\\.(?<minor>\\d)\\.(?<patch>\\d)\\.(?<release>\\d)");
 | 
			
		||||
    QRegularExpressionMatch match = re.match(version);
 | 
			
		||||
 | 
			
		||||
    if (!match.hasMatch()) {
 | 
			
		||||
        qWarning() << "Could not parse Tor version";
 | 
			
		||||
        return "";
 | 
			
		||||
        return TorVersion();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return TorVersion(match.captured("major").toInt(),
 | 
			
		||||
                      match.captured("minor").toInt(),
 | 
			
		||||
                      match.captured("patch").toInt(),
 | 
			
		||||
                      match.captured("release").toInt());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -11,6 +11,55 @@
 | 
			
		|||
#include <QtNetwork>
 | 
			
		||||
#include "utils/childproc.h"
 | 
			
		||||
 | 
			
		||||
struct TorVersion
 | 
			
		||||
{
 | 
			
		||||
    explicit TorVersion(int major=0, int minor=0, int patch=0, int release=0)
 | 
			
		||||
        : patch(patch), release(release)
 | 
			
		||||
    {
 | 
			
		||||
        this->major = major;
 | 
			
		||||
        this->minor = minor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    friend bool operator== (const TorVersion &v1, const TorVersion &v2) {
 | 
			
		||||
        return (v1.major == v2.major &&
 | 
			
		||||
                v1.minor == v2.minor &&
 | 
			
		||||
                v1.patch == v2.patch &&
 | 
			
		||||
                v1.release == v2.release);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    friend bool operator!= (const TorVersion &v1, const TorVersion &v2) {
 | 
			
		||||
        return !(v1 == v2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    friend bool operator> (const TorVersion &v1, const TorVersion &v2) {
 | 
			
		||||
        if (v1.major != v2.major)
 | 
			
		||||
            return v1.major > v2.major;
 | 
			
		||||
        if (v1.minor != v2.minor)
 | 
			
		||||
            return v1.minor > v2.minor;
 | 
			
		||||
        if (v1.patch != v2.patch)
 | 
			
		||||
            return v1.patch > v2.patch;
 | 
			
		||||
        if (v1.release != v2.release)
 | 
			
		||||
            return v1.release > v2.release;
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    friend bool operator< (const TorVersion &v1, const TorVersion &v2) {
 | 
			
		||||
        if (v1 == v2)
 | 
			
		||||
            return false;
 | 
			
		||||
        return !(v1 > v2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QString toString() {
 | 
			
		||||
        return QString("%1.%2.%3.%4").arg(QString::number(major), QString::number(minor),
 | 
			
		||||
                                          QString::number(patch), QString::number(release));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int major;
 | 
			
		||||
    int minor;
 | 
			
		||||
    int patch;
 | 
			
		||||
    int release;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class Tor : public QObject
 | 
			
		||||
{
 | 
			
		||||
Q_OBJECT
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +70,8 @@ public:
 | 
			
		|||
    void start();
 | 
			
		||||
    void stop();
 | 
			
		||||
    bool unpackBins();
 | 
			
		||||
    QString getVersion();
 | 
			
		||||
    TorVersion getVersion(const QString &fileName);
 | 
			
		||||
    TorVersion stringToVersion(const QString &version);
 | 
			
		||||
 | 
			
		||||
    bool torConnected = false;
 | 
			
		||||
    bool localTor = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue