-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: no snooping rvd build + windows build configuration #596
Changes from all commits
8e8d1a1
2a0cff2
21138bd
06812bc
4e9e0c5
b40254f
9641ca0
046cba5
fa200b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,23 +24,33 @@ jobs: | |
include: | ||
- os: ubuntu-latest | ||
output-name: sshnp-linux-x64 | ||
ext: '' | ||
- os: macOS-latest | ||
output-name: sshnp-macos-x64 | ||
ext: '' | ||
- os: windows-latest | ||
output-name: sshnp-windows-x64 | ||
ext: '.exe' | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # v1.6.0 | ||
- run: mkdir sshnp | ||
- run: mkdir tarball | ||
- if: ${{ matrix.os != 'windows-latest' }} | ||
run: mkdir sshnp/debug | ||
- run: dart pub get | ||
- run: dart run build_runner build --delete-conflicting-outputs | ||
- run: dart compile exe bin/activate_cli.dart -v -o sshnp/at_activate | ||
- run: dart compile exe bin/sshnp.dart -v -o sshnp/sshnp | ||
- run: dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd | ||
- run: dart compile exe bin/sshrv.dart -v -o sshnp/sshrv | ||
- run: dart compile exe bin/sshrvd.dart -v -o sshnp/sshrvd | ||
- run: dart compile exe bin/activate_cli.dart -v -o sshnp/at_activate${{ matrix.ext }} | ||
- run: dart compile exe bin/sshnp.dart -v -o sshnp/sshnp${{ matrix.ext }} | ||
- if: ${{ matrix.os != 'windows-latest' }} | ||
run: dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd${{ matrix.ext }} | ||
- if: ${{ matrix.os != 'windows-latest' }} | ||
run: dart compile exe bin/sshrv.dart -v -o sshnp/sshrv${{ matrix.ext }} | ||
- if: ${{ matrix.os != 'windows-latest' }} | ||
run: dart compile exe bin/sshrvd.dart -v -o sshnp/sshrvd${{ matrix.ext }} | ||
- if: ${{ matrix.os != 'windows-latest' }} | ||
run: dart compile exe bin/sshrvd.dart -D ENABLE_SNOOP=true -v -o sshnp/debug/sshrvd${{ matrix.ext }} | ||
- run: cp -r templates sshnp/templates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disable certain binaries on windows and add their file extension |
||
- run: cp LICENSE sshnp | ||
- run: tar -cvzf tarball/${{ matrix.output-name }}.tgz sshnp | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class BuildEnv { | ||
static final bool enableSnoop = | ||
bool.fromEnvironment('ENABLE_SNOOP', defaultValue: false); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import 'package:at_client/at_client.dart'; | |
import 'package:at_utils/at_logger.dart'; | ||
import 'package:logging/logging.dart'; | ||
import 'package:meta/meta.dart'; | ||
import 'package:noports_core/src/sshrvd/build_env.dart'; | ||
import 'package:noports_core/src/sshrvd/socket_connector.dart'; | ||
import 'package:noports_core/src/sshrvd/sshrvd.dart'; | ||
import 'package:noports_core/src/sshrvd/sshrvd_params.dart'; | ||
|
@@ -168,8 +169,14 @@ class SshrvdImpl implements Sshrvd { | |
/// Spawn an isolate and wait for it to send back the issued port numbers | ||
ReceivePort receivePort = ReceivePort(session); | ||
|
||
ConnectorParams parameters = | ||
(receivePort.sendPort, portA, portB, session, forAtsign, snoop); | ||
ConnectorParams parameters = ( | ||
receivePort.sendPort, | ||
portA, | ||
portB, | ||
session, | ||
forAtsign, | ||
BuildEnv.enableSnoop && snoop, | ||
); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disable snooping at the point of passing it to the socket connector |
||
logger | ||
.info("Spawning socket connector isolate with parameters $parameters"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import 'package:args/args.dart'; | ||
import 'package:noports_core/src/common/file_system_utils.dart'; | ||
import 'package:noports_core/src/sshrvd/build_env.dart'; | ||
|
||
class SshrvdParams { | ||
final String username; | ||
|
@@ -43,7 +44,7 @@ class SshrvdParams { | |
managerAtsign: r['manager'], | ||
ipAddress: r['ip'], | ||
verbose: r['verbose'], | ||
snoop: r['snoop'], | ||
snoop: BuildEnv.enableSnoop && r['snoop'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Block the boolean condition from trying to call r['snoop'] (which will be null since we didn't add the parser flag - see the other comment in this file) |
||
rootDomain: r['root-domain'], | ||
); | ||
} | ||
|
@@ -84,12 +85,14 @@ class SshrvdParams { | |
abbr: 'v', | ||
help: 'More logging', | ||
); | ||
parser.addFlag( | ||
'snoop', | ||
abbr: 's', | ||
defaultsTo: false, | ||
help: 'Snoop on traffic passing through service', | ||
); | ||
if (BuildEnv.enableSnoop) { | ||
parser.addFlag( | ||
'snoop', | ||
abbr: 's', | ||
defaultsTo: false, | ||
help: 'Snoop on traffic passing through service', | ||
); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disable the flag in the parser / usage |
||
parser.addOption( | ||
'root-domain', | ||
mandatory: false, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ RUN set -eux; \ | |
arm64) ARCH="arm64";; \ | ||
riscv64) ARCH="riscv64";; \ | ||
esac; \ | ||
mkdir sshnp; \ | ||
mkdir -p sshnp/debug; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mkdir -p is okay here since Dockerfile.package is linux only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (The output folder name is hard-coded to linux in this file as well) |
||
mkdir tarball; \ | ||
dart pub get; \ | ||
dart run build_runner build --delete-conflicting-outputs; \ | ||
|
@@ -18,6 +18,7 @@ RUN set -eux; \ | |
dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd; \ | ||
dart compile exe bin/sshrv.dart -v -o sshnp/sshrv; \ | ||
dart compile exe bin/sshrvd.dart -v -o sshnp/sshrvd; \ | ||
dart compile exe bin/sshrvd.dart -D ENABLE_SNOOP=true -v -o sshnp/debug/sshrvd; \ | ||
cp -r templates sshnp/templates; \ | ||
cp LICENSE sshnp/; \ | ||
tar -cvzf tarball/sshnp-linux-${ARCH}.tgz sshnp | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did a separate mkdir instead of mkdir -p because I'm fairly confident that the powershell mkdir doesn't support that flag.