Skip to content
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

Command Line Interface #365

Merged
merged 31 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a7fa49e
Command Line Interface
moubctez Dec 9, 2024
2c5e694
Use workspace
moubctez Dec 10, 2024
09a208d
Basic CLI functionality
moubctez Dec 11, 2024
22cc2aa
Change subcommands
moubctez Dec 11, 2024
c9d4cc7
Handle UNIX signals
moubctez Dec 12, 2024
9fa5274
Refactor device_config_to_location()
moubctez Dec 15, 2024
b01c6ac
Polling
moubctez Dec 15, 2024
e6f5c62
Needs another trigger
moubctez Dec 15, 2024
3f5a082
Workflow for dg
moubctez Dec 16, 2024
25f24b3
Fix workflow on X64
moubctez Dec 16, 2024
792abc6
Set working directory
moubctez Dec 16, 2024
01efe71
Set working directory
moubctez Dec 16, 2024
fd21283
Change workflows
moubctez Dec 16, 2024
08eb401
Workflow: fix typo
moubctez Dec 16, 2024
736a3be
Test on dummy version
moubctez Dec 16, 2024
b4faf80
Test on dummy version
moubctez Dec 16, 2024
3541d23
Test on dummy version, take 3
moubctez Dec 16, 2024
e97be70
Test on dummy version, take 4
moubctez Dec 16, 2024
a3a56ec
Test on dummy version, take 5
moubctez Dec 16, 2024
077e70b
CLI: not for Windows
moubctez Dec 17, 2024
1291e3e
Update node packages
moubctez Dec 18, 2024
e140da8
Refactor build for non-UNIX machines
moubctez Dec 18, 2024
d675e41
Fix windows code
moubctez Dec 18, 2024
0228726
Remove test worklow
moubctez Dec 18, 2024
3fd2e3d
Robust configutarion path handling
moubctez Dec 20, 2024
5aaefc0
Verbose reconfiguration
moubctez Dec 20, 2024
6607a8f
Update dg.rs
t-aleksander Dec 20, 2024
31ddca6
Update proto and fix for multi-address
moubctez Jan 6, 2025
db970f1
Update defguard-ui
moubctez Jan 6, 2025
4178d18
Update defguard-ui
moubctez Jan 6, 2025
a4b8f3d
fix after ui upgrade
filipslezaklab Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/make-binary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build DG

on:
workflow_call:
inputs:
name:
description: 'Name of binary to archive and upload'
required: true
type: string
binary_arch:
description: 'Architecture name'
required: true
type: string
system:
description: 'Operating system name'
required: true
type: string
runner:
description: 'Runner to run this job on'
required: true
type: string

jobs:
make-binary:
runs-on:
- self-hosted
- Linux
- ${{ inputs.runner }}
steps:
- name: Rename client binary
run: mv src-tauri/target/release/${{ inputs.flavor }} ${{ inputs.flavor }}-${{ inputs.system }}-${{ inputs.binary_arch }}-${{ github.ref_name }}
- name: Tar client binary
uses: a7ul/[email protected]
with:
command: c
files: |
${{ inputs.flavor }}-${{ inputs.system }}-${{ inputs.binary_arch }}-${{ github.ref_name }}
outPath: ${{ inputs.flavor }}-${{ inputs.system }}-${{ inputs.binary_arch }}-${{ github.ref_name }}.tar.gz
- name: Upload client archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ inputs.flavor }}-${{ inputs.system }}-${{ inputs.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_name: ${{ inputs.flavor }}-${{ inputs.system }}-${{ inputs.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream
55 changes: 35 additions & 20 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
steps:
- name: Create GitHub release
id: release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
run: |
rpmbuild --build-in-place --define "_topdir $(pwd)" --define "version ${{ env.VERSION }}" -bb resources-linux/defguard-client.spec
- name: Upload RPM
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -119,7 +119,7 @@ jobs:
asset_name: defguard-client-${{ env.VERSION }}-1.${{ matrix.binary_arch }}.rpm
asset_content_type: application/octet-stream
- name: Upload DEB
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -130,14 +130,14 @@ jobs:
- name: Rename client binary
run: mv src-tauri/target/release/defguard-client defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
- name: Tar client binary
uses: a7ul/tar-action@v1.1.0
uses: a7ul/tar-action@v1.2.0
with:
command: c
files: |
defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
outPath: defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
- name: Upload client archive
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -148,21 +148,41 @@ jobs:
- name: Rename daemon binary
run: mv src-tauri/target/release/defguard-service defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
- name: Tar daemon binary
uses: a7ul/tar-action@v1.1.0
uses: a7ul/tar-action@v1.2.0
with:
command: c
files: |
defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
outPath: defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
- name: Upload daemon archive
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_name: defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream

- name: Rename dg binary
run: mv src-tauri/target/release/dg dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
- name: Tar dg binary
uses: a7ul/[email protected]
with:
command: c
files: |
dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
outPath: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
- name: Upload dg archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_name: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream

build-macos:
needs:
- create-release
Expand Down Expand Up @@ -232,7 +252,7 @@ jobs:
xcrun notarytool submit --wait --apple-id [email protected] --password ${{ secrets.NOTARYTOOL_APP_SPECIFIC_PASSWORD }} --team-id 6WD6W6WQNV src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
xcrun stapler staple src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
- name: Upload installation package
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -241,13 +261,13 @@ jobs:
asset_name: defguard-${{ matrix.target }}-${{ env.VERSION }}.pkg
asset_content_type: application/octet-stream

# Building signed windows bundle involves a few steps as described here:
# Building signed Windows bundle involves a few steps as described here:
# https://wixtoolset.org/docs/tools/signing/#signing-bundles-at-the-command-line
# 1. Build defguard & bundle the binaries (defguard & wireguard) using wix (windows)
# 2. Detach the burn engine from the bundle so that it can be signed (also windows)
# 3. Sign the burn engine (linux)
# 4. Reattach the burn engine back to the bundle (windows again)
# 5. Sign the whole bundle (linux)
# 1. Build Defguard and bundle the binaries (Defguard and WireGuard) using Wix (Windows)
# 2. Detach the burn engine from the bundle so that it can be signed (also Windows)
# 3. Sign the burn engine (Linux)
# 4. Reattach the burn engine back to the bundle (Windows again)
# 5. Sign the whole bundle (Linux)
build-windows:
needs:
- create-release
Expand Down Expand Up @@ -294,12 +314,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bundle application
run: |
# prepare wix extension
dotnet tool install --global wix --version 4.0.5
wix extension add WixToolset.Bal.wixext/4
# bundle defguard & wireguard binaries together
wix build .\src-tauri\resources-windows\defguard-client.wxs -ext .\.wix\extensions\WixToolset.Bal.wixext\4\wixext4\WixToolset.Bal.wixext.dll
# detach burn engine from the bundle to be signed
wix burn detach .\src-tauri\resources-windows\defguard-client.exe -engine .\src-tauri\resources-windows\burnengine.exe
- name: Upload unsigned bundle and burn-engine
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -345,10 +362,8 @@ jobs:
name: unsigned-bundle-and-signed-burnengine
- name: Reattach burn-engine
run: |
# prepare wix extension
dotnet tool install --global wix --version 4.0.5
wix extension add WixToolset.Bal.wixext/4
# reattach burn engine to the bundle
wix burn reattach defguard-client.exe -engine burnengine-signed.exe -o defguard-client-reattached.exe
- name: Upload bundle with reattached burn-engine
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -376,7 +391,7 @@ jobs:
- name: Sign bundle
run: osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in defguard-client-reattached.exe -out defguard-client-signed.exe
- name: Upload installer asset
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
94 changes: 49 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "defguard-client",
"private": false,
"version": "1.1.0",
"version": "1.1.1",
"type": "module",
"scripts": {
"dev": "npm-run-all --parallel vite typesafe-i18n",
Expand Down Expand Up @@ -40,80 +40,84 @@
}
},
"dependencies": {
"@floating-ui/react": "^0.26.3",
"@hookform/resolvers": "^3.3.2",
"@ladle/react": "^4.1.1",
"@floating-ui/react": "^0.26.28",
"@hookform/resolvers": "^3.9.1",
"@ladle/react": "^4.1.2",
"@react-hook/resize-observer": "^2.0.2",
"@stablelib/base64": "^1.0.1",
"@stablelib/x25519": "^1.0.3",
"@tanstack/query-core": "^5.12.1",
"@tanstack/query-core": "^5.62.8",
"@tanstack/react-virtual": "3.0.0-beta.54",
"@tauri-apps/api": "^1.6.0",
"@types/byte-size": "^8.1.2",
"byte-size": "^8.1.1",
"classnames": "^2.3.2",
"compare-versions": "^6.1.0",
"byte-size": "^8.2.1",
"classnames": "^2.5.1",
"clsx": "^2.1.1",
"compare-versions": "^6.1.1",
"dayjs": "^1.11.13",
"detect-browser": "^5.3.0",
"fast-deep-equal": "^3.1.3",
"file-saver": "^2.0.5",
"framer-motion": "^10.16.12",
"html-react-parser": "^5.0.7",
"itertools": "^2.1.2",
"framer-motion": "^10.18.0",
"get-text-width": "^1.0.3",
"html-react-parser": "^5.2.1",
"itertools": "^2.3.2",
"lodash-es": "^4.17.21",
"p-timeout": "^6.1.2",
"merge-refs": "^1.3.0",
"p-timeout": "^6.1.3",
"prop-types": "^15.8.1",
"radash": "^11.0.0",
"react": "^18.2.0",
"react": "^18.3.1",
"react-auth-code-input": "^3.2.1",
"react-click-away-listener": "^2.2.3",
"react-dom": "^18.2.0",
"react-hook-form": "^7.48.2",
"react-loading-skeleton": "^3.3.1",
"react-click-away-listener": "^2.2.4",
"react-dom": "^18.3.1",
"react-hook-form": "^7.54.1",
"react-loading-skeleton": "^3.5.0",
"react-markdown": "^9.0.1",
"react-qr-code": "^2.0.15",
"react-router-dom": "^6.20.1",
"react-virtualized-auto-sizer": "^1.0.24",
"recharts": "^2.10.3",
"react-router-dom": "^6.28.0",
"react-virtualized-auto-sizer": "^1.0.25",
"recharts": "^2.15.0",
"rehype-sanitize": "^6.0.0",
"rxjs": "^7.8.1",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log",
"tauri-plugin-window-state-api": "github:tauri-apps/tauri-plugin-window-state#v1",
"use-breakpoint": "^4.0.1",
"zod": "^3.22.4",
"zustand": "^4.4.7"
"use-breakpoint": "^4.0.5",
"zod": "^3.24.1",
"zustand": "^5.0.2"
},
"devDependencies": {
"@hookform/devtools": "^4.3.1",
"@hookform/devtools": "^4.3.3",
"@svgr/cli": "^8.1.0",
"@tanstack/react-query": "^5.12.2",
"@tanstack/react-query-devtools": "^5.12.2",
"@tauri-apps/cli": "^1.6.2",
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tauri-apps/cli": "^1.6.3",
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.10.3",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"@vitejs/plugin-react": "^4.2.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"@types/node": "^20.17.10",
"@types/react": "^18.3.17",
"@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react": "^4.3.4",
"@vitejs/plugin-react-swc": "^3.7.2",
"autoprefixer": "^10.4.20",
"eslint": "^8.55.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.16",
"eslint-plugin-simple-import-sort": "^10.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.32",
"sass": "^1.69.5",
"typedoc": "^0.25.4",
"postcss": "^8.4.49",
"sass": "^1.83.0",
"typedoc": "^0.25.13",
"typesafe-i18n": "^5.26.2",
"typescript": "^5.3.2",
"typescript": "^5.2.2",
"typescript-eslint-language-service": "^5.0.5",
"vite": "^4.5.3"
"vite": "^4.5.5"
},
"volta": {
"node": "20.5.1"
Expand Down
Loading