From 0b577d8ce5677406b749632e02931315c6dfbc77 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Fri, 22 Nov 2019 04:04:12 +0300 Subject: [PATCH] add yggdrasil package Signed-off-by: R4SAS --- yggdrasil/tools/chocolateyinstall.ps1 | 77 +++++++++++++++++++++++++ yggdrasil/tools/chocolateyuninstall.ps1 | 23 ++++++++ yggdrasil/tools/service-install.bat | 40 +++++++++++++ yggdrasil/tools/service-restart.bat | 31 ++++++++++ yggdrasil/tools/service-uninstall.bat | 31 ++++++++++ yggdrasil/yggdrasil.nuspec | 40 +++++++++++++ 6 files changed, 242 insertions(+) create mode 100644 yggdrasil/tools/chocolateyinstall.ps1 create mode 100644 yggdrasil/tools/chocolateyuninstall.ps1 create mode 100644 yggdrasil/tools/service-install.bat create mode 100644 yggdrasil/tools/service-restart.bat create mode 100644 yggdrasil/tools/service-uninstall.bat create mode 100644 yggdrasil/yggdrasil.nuspec diff --git a/yggdrasil/tools/chocolateyinstall.ps1 b/yggdrasil/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000..f57a5fe --- /dev/null +++ b/yggdrasil/tools/chocolateyinstall.ps1 @@ -0,0 +1,77 @@ +$ErrorActionPreference = 'Stop'; + +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$appDir = "$([Environment]::GetFolderPath('ProgramFiles'))\Yggdrasil" +$startMenuDir = "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\Yggdrasil" + +$url = 'https://2203-115685026-gh.circle-artifacts.com/0/yggdrasil-0.3.11-windows-i386.exe' +$url64 = 'https://2203-115685026-gh.circle-artifacts.com/0/yggdrasil-0.3.11-windows-amd64.exe' +$ctlUrl = 'https://2203-115685026-gh.circle-artifacts.com/0/yggdrasil-0.3.11-yggdrasilctl-windows-i386.exe' +$ctlUrl64 = 'https://2203-115685026-gh.circle-artifacts.com/0/yggdrasil-0.3.11-yggdrasilctl-windows-amd64.exe' + +$packageArgs = @{ + packageName = 'yggdrasil' + url = $url + url64bit = $url64 + fileFullPath = "$appDir\yggdrasil.exe" + + checksum = '496239325ED34ADAEDE10A71D678BE6B4FA13273BAEE6A924D20EE5EC58B8C28' + checksumType = 'sha256' + checksum64 = 'BC89CDBA3E5FF4D455805990BEEC3C0D29A88751B1F1E01687A10F71F320E522' + checksumType64 = 'sha256' +} + +$ctlPackageArgs = @{ + packageName = 'yggdrasilctl' + url = $ctlurl + url64bit = $ctlurl64 + fileFullPath = "$appDir\yggdrasilctl.exe" + + checksum = 'F21B510D95ED7463BAF493F3530A3C7B5A1B72DB0110A160433A8ECB4C7584B3' + checksumType = 'sha256' + checksum64 = 'FCD3859F8C8546D1A46EBB6EB1227173C1A4D3AB168A3821BEA6E91356A662B3' + checksumType64 = 'sha256' +} + +# Installing executables +if (-not (Test-Path -Path $appDir)) { + New-Item -Path $appDir -ItemType Directory +} + +Get-ChocolateyWebFile @packageArgs +Get-ChocolateyWebFile @ctlPackageArgs + +Install-BinFile "yggdrasil" "$appDir\yggdrasil.exe" +Install-BinFile "yggdrasilctl" "$appDir\yggdrasilctl.exe" + +# Generating new configuration, or updating existent +if (Test-Path "$appDir\yggdrasil.conf" -PathType Leaf) { + $date = Get-Date -format "yyyyMMdd" + Write-Host "Backing up configuration file to yggdrasil.conf.$date" + Copy-Item $appDir\yggdrasil.conf -Destination $appDir\yggdrasil.conf.$date + Write-Host "Normalizing and updating yggdrasil.conf" + $args = @( + "-useconffile","$appDir\yggdrasil.conf.$date", + "-normaliseconf" + ) + & "$appDir\yggdrasil.exe" $args > "$appDir\yggdrasil.conf" +} else { + Write-Host "Generating initial configuration file yggdrasil.conf" + Write-Host "Please familiarise yourself with this file before starting Yggdrasil" + $args = @( + "-genconf" + ) + & "$appDir\yggdrasil.exe" $args > "$appDir\yggdrasil.conf" +} + +# Creating shortcuts in Start Menu +if (-not (Test-Path -Path $startMenuDir)) { + New-Item -Path $startMenuDir -ItemType Directory +} + +Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Install service.lnk" ` + -targetPath "$toolsDir\service-install.bat" -workDirectory "$appDir" -description "Install yggdrasil service" -RunAsAdmin +Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Restart service.lnk" ` + -targetPath "$toolsDir\service-restart.bat" -workDirectory "$appDir" -description "Restart yggdrasil service" -RunAsAdmin +Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Uninstall service.lnk" ` + -targetPath "$toolsDir\service-uninstall.bat" -workDirectory "$appDir" -description "Uninstall yggdrasil service" -RunAsAdmin diff --git a/yggdrasil/tools/chocolateyuninstall.ps1 b/yggdrasil/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000..1195697 --- /dev/null +++ b/yggdrasil/tools/chocolateyuninstall.ps1 @@ -0,0 +1,23 @@ +$ErrorActionPreference = 'Stop'; # stop on all errors + +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$appDir = "$([Environment]::GetFolderPath('ProgramFiles'))\Yggdrasil" +$startMenuDir = "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\Yggdrasil" + +# Remove shims +Uninstall-BinFile "yggdrasil" +Uninstall-BinFile "yggdrasilctl" + +# Remove shortcuts from Start Menu +Remove-Item $startMenuDir -Recurse + +# Stop and remove service if it was installed +if (Get-WmiObject -Class Win32_Service -Filter "Name='Yggdrasil'") { + & sc stop "Yggdrasil" + & sc delete "Yggdrasil" +} + +# Remove binaries, but don't touch configs +Write-Host "We removing binaries, but doesn't touch your configs. You can still find them in '$appDir' directory" +Remove-Item "$appDir\yggdrasil.exe" +Remove-Item "$appDir\yggdrasilctl.exe" diff --git a/yggdrasil/tools/service-install.bat b/yggdrasil/tools/service-install.bat new file mode 100644 index 0000000..a307ffb --- /dev/null +++ b/yggdrasil/tools/service-install.bat @@ -0,0 +1,40 @@ +@set @_cmd=1 /* +@echo off +setlocal EnableExtensions +title Yggdrasil + +whoami /groups | findstr "S-1-16-12288" >nul && goto :admin +if "%~1"=="RunAsAdmin" goto :error + +echo Requesting privileges elevation for managing the dnscrypt-proxy service . . . +cscript /nologo /e:javascript "%~f0" || goto :error +exit /b + +:error +echo. +echo Error: Administrator privileges elevation failed, +echo please manually run this script as administrator. +echo. +goto :end + +:admin +pushd "%ProgramFiles%\Yggdrasil" +sc stop "Yggdrasil" >NUL 2>&1 +sc delete "Yggdrasil" >NUL 2>&1 + +REM add delay before re-creation +timeout 1 /nobreak >NUL + +sc create "Yggdrasil" binPath= "\"%CD%\yggdrasil.exe\" -useconffile \"%CD%\yggdrasil.conf\"" start= "auto" +sc description "Yggdrasil" "An experiment in scalable routing as an encrypted IPv6 overlay network" +sc start "Yggdrasil" +popd + +:end +set /p =Press [Enter] to exit . . . +exit /b */ + +// JScript, restart batch script as administrator +var objShell = WScript.CreateObject('Shell.Application'); +var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%'); +objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1); diff --git a/yggdrasil/tools/service-restart.bat b/yggdrasil/tools/service-restart.bat new file mode 100644 index 0000000..d76384f --- /dev/null +++ b/yggdrasil/tools/service-restart.bat @@ -0,0 +1,31 @@ +@set @_cmd=1 /* +@echo off +setlocal EnableExtensions +title Yggdrasil + +whoami /groups | findstr "S-1-16-12288" >nul && goto :admin +if "%~1"=="RunAsAdmin" goto :error + +echo Requesting privileges elevation for managing the dnscrypt-proxy service . . . +cscript /nologo /e:javascript "%~f0" || goto :error +exit /b + +:error +echo. +echo Error: Administrator privileges elevation failed, +echo please manually run this script as administrator. +echo. +goto :end + +:admin +sc stop "Yggdrasil" +sc start "Yggdrasil" + +:end +set /p =Press [Enter] to exit . . . +exit /b */ + +// JScript, restart batch script as administrator +var objShell = WScript.CreateObject('Shell.Application'); +var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%'); +objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1); diff --git a/yggdrasil/tools/service-uninstall.bat b/yggdrasil/tools/service-uninstall.bat new file mode 100644 index 0000000..44350e5 --- /dev/null +++ b/yggdrasil/tools/service-uninstall.bat @@ -0,0 +1,31 @@ +@set @_cmd=1 /* +@echo off +setlocal EnableExtensions +title Yggdrasil + +whoami /groups | findstr "S-1-16-12288" >nul && goto :admin +if "%~1"=="RunAsAdmin" goto :error + +echo Requesting privileges elevation for managing the dnscrypt-proxy service . . . +cscript /nologo /e:javascript "%~f0" || goto :error +exit /b + +:error +echo. +echo Error: Administrator privileges elevation failed, +echo please manually run this script as administrator. +echo. +goto :end + +:admin +sc stop "Yggdrasil" +sc delete "Yggdrasil" + +:end +set /p =Press [Enter] to exit . . . +exit /b */ + +// JScript, restart batch script as administrator +var objShell = WScript.CreateObject('Shell.Application'); +var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%'); +objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1); diff --git a/yggdrasil/yggdrasil.nuspec b/yggdrasil/yggdrasil.nuspec new file mode 100644 index 0000000..253ceb6 --- /dev/null +++ b/yggdrasil/yggdrasil.nuspec @@ -0,0 +1,40 @@ + + + + + yggdrasil + 0.3.11 + https://github.com/r4sas/chocolatey-packages/tree/master/yggdrasil/ + r4sas + + Yggdrasil network + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + https://yggdrasil-network.github.io/ + + + https://github.com/yggdrasil-network/yggdrasil-go/blob/master/LICENSE + true + https://github.com/yggdrasil-network/yggdrasil-go + https://yggdrasil-network.github.io/ + https://github.com/yggdrasil-network/yggdrasil-go/issues + yggdrasil admin network encryption security mesh ipv6 decentralized + An experiment in scalable routing as an encrypted IPv6 overlay network + # Yggdrasil + +Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6 +network. It is lightweight, self-arranging, supported on multiple platforms and +allows pretty much any IPv6-capable application to communicate securely with +other Yggdrasil nodes. Yggdrasil does not require you to have IPv6 Internet +connectivity - it also works over IPv4. + +Although Yggdrasil shares many similarities with +[cjdns](https://github.com/cjdelisle/cjdns), it employs a different routing +algorithm based on a globally-agreed spanning tree and greedy routing in a +metric space, and aims to implement some novel local backpressure routing +techniques. In theory, Yggdrasil should scale well on networks with +internet-like topologies. + + + + +