diff --git a/.gitignore b/.gitignore index c4ba37a..1c6d5b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ linsk linsk.exe *.qcow2 -bin/ \ No newline at end of file +bin/ +build/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9b96ed3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +Thank you for showing your interest in contributing! Contributions are the most welcome. Anything including small fixes is greatly appreciated. + +Please keep your new code consistent with the existing codebase and follow the industry's best practices. Before committing, please make sure that your code passes the linting & security scanning suite. + +To install linting tools, execute the following commands: +```sh +make lint-deps +make security-check-deps +``` + +After that, you will be able to run the linter and the security scanning tool. +```sh +make lint +make security-check +``` \ No newline at end of file diff --git a/INSTALL_MACOS.md b/INSTALL_MACOS.md index a207a89..6e05663 100644 --- a/INSTALL_MACOS.md +++ b/INSTALL_MACOS.md @@ -33,11 +33,11 @@ After that, you should be able to run `linsk`, or `~/go/bin/linsk` if you have n ## Package managers -//TODO. +TODO. ## Prebuilt binaries -//TODO. +You can find prebuilt binaries in [Linsk GitHub Releases](https://github.com/AlexSSD7/linsk/releases). ## Build from Source Clone the repository using `git` and run `go build` to build the Linsk binary. diff --git a/INSTALL_WINDOWS.md b/INSTALL_WINDOWS.md index 6949549..58480af 100644 --- a/INSTALL_WINDOWS.md +++ b/INSTALL_WINDOWS.md @@ -42,11 +42,11 @@ After that, you should be able to run `linsk`, or `%USERPROFILE%\go\bin\linsk.ex ## Package managers -//TODO. +TODO. ## Prebuilt binaries -//TODO. +You can find prebuilt binaries in [Linsk GitHub Releases](https://github.com/AlexSSD7/linsk/releases). ## Build from Source Clone the repository using `git` and run `go build` to build the Linsk binary. diff --git a/LINUX_DEV_ENV.md b/LINUX_DEV_ENV.md index ea49548..78514e9 100644 --- a/LINUX_DEV_ENV.md +++ b/LINUX_DEV_ENV.md @@ -6,7 +6,7 @@ Yes, you read that right. For development purposes, Linsk remains 100% supported ## QEMU -On Ubuntu (and probably on any other Debian-based distro) you can install the required `qemu-system-$(arch)` binary by running the following: +On Ubuntu (and probably on any other Debian-based distro), you can install the required `qemu-system-$(arch)` binary by running the following: ```sh apt install qemu-system ``` @@ -26,8 +26,4 @@ cd linsk go build ``` -After that is done, you will be able to find the `linsk` binary in the same directory you ran `go build` in. - -# The next steps - -That's it. You can follow the further usage instructions set in TODO just like with any other OS. \ No newline at end of file +After that is done, you will be able to find the `linsk` binary in the same directory you ran `go build` in. \ No newline at end of file diff --git a/README.md b/README.md index 60a33c1..8f938be 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,52 @@ # Linsk -Linsk is a utility that allows you to access Linux-native file system infrastructure, including LVM and LUKS on Windows and macOS. Unlike other solutions created to access Linux filesystems on unsupported operating systems, Linsk does not reimplement any file system. Instead, Linsk utilizes a lightweight Alpine Linux VM (~130 MB only) combined with network share technologies like SMB, AFP, and FTP. + + +**Linsk** is a utility that allows you to access Linux-native file system infrastructure, including LVM and LUKS on Windows and macOS. Unlike other solutions created to access Linux filesystems on unsupported operating systems, Linsk does not reimplement any file system. Instead, Linsk utilizes a lightweight Alpine Linux VM (~130 MB only) combined with network share technologies like SMB, AFP, and FTP. Because Linsk uses a native Linux VM, there are no limitations on what you can access. Anything that works on Linux will work under Linsk too (hence the Linux+Disk name). - +To show your thanks, please star this repository if you found it useful. -# Supported platforms +![Screenshot of Linsk running](./assets/screenshot.png) + +# 💻 Supported platforms ## CPU architectures -Linsk natively supports both amd64 (aka x86_64, Intel, AMD, etc.) and arm64 (aka aarch64, Apple M1/M2, and others). Although Linsk uses a virtual machine, CPU is never emulated but hardware accelerators like HVF (macOS), WHPX (Windows), and KVM (Linux) are used. +Linsk natively supports both **x86_64** (aka amd64, Intel, AMD, etc.) and **aarch64** (aka arm64, Apple M1/M2, and others). + +Although Linsk uses a virtual machine, the CPU is never emulated but the hardware accelerators like HVF (macOS), WHPX (Windows), and KVM (Linux) are used. ## Operating systems -* Windows -* macOS -* Linux (for development purposes, mostly) +* **Windows** +* **macOS** +* **Linux** (for development purposes, mostly) ## Network file share backends Linsk relies on network file shares to expose files to the host machine. Below are the types of network shares Linsk supports: -* SMB - The default for Windows. -* AFP - The default for macOS. -* FTP - An alternative backend. +* **SMB** - The default for Windows. +* **AFP** - The default for macOS. +* **FTP** - An alternative backend. -# Installation -//TODO +# 💿 Installation -# Contributing +- **Windows** - See [INSTALL_WINDOWS.md](INSTALL_WINDOWS.md). +- **macOS** - See [INSTALL_MACOS.md](INSTALL_MACOS.md). +- **Linux** - Refer to [LINUX_DEV_ENV.md](LINUX_DEV_ENV.md). -//TODO: Make it a separate .md file. +# 🔧 Usage -Contributions are the most welcome. Anything including small fixes is greatly appreciated. +- **Windows** - See [USAGE_WINDOWS.md](USAGE_WINDOWS.md). +- **macOS** - See [USAGE_MACOS.md](USAGE_MACOS.md). -Please keep your new code consistent with the existing and follow the best practices writing Go code. Before committing, please make sure that your code passes the linting & security scanning suite. +# 👨‍💻 Contributing -To install linting tools, execute the following commands: -```sh -make lint-deps -make security-check-deps -``` +Please see [CONTRIBUTING.md](CONTRIBUTING.md). -After that, you will be able to run the linter and the security scanning tool. -```sh -make lint -make security-check -``` - -# Copyright and License +# ©️ Copyright and License Copyright (c) 2023 The Linsk Authors. diff --git a/SHELL.md b/SHELL.md new file mode 100644 index 0000000..90a3c1c --- /dev/null +++ b/SHELL.md @@ -0,0 +1,13 @@ +# Linsk shell + +`linsk shell` will start a VM and open a full-fledged Linux shell for you. Linsk will not mount nor configure any file server. + +Linsk's VM runs Alpine Linux, a lightweight busybox-based Linux distribution. Upon the startup, you will find little to no preinstalled tools. This is intentional as the goal is to have the lightest VM possible. There is no default text editor preinstalled either. However, Linsk's Alpine Linux is supplied with `apk` package manager. You can use it to install packages of any kind. An installation of `vim`, for example, would mean running `apk add vim`. + +Linsk's shell can be used to format disks with tools like `mkfs` and run diagnostics with tools like `fsck`. Please note that you will need to install these separately using Alpine Linux's `apk` package manager. The other important purpose of Linsk's shell is to assist with troubleshooting. + +# Access the shell within `linsk run` + +In addition to `linsk shell` that can be used to help investigate disk-related issues, Linsk also provides a `--debug-shell` CLI flag for the `run` command. Unlike `linsk shell` , `linsk run --debug-shell` will start the shell *after* starting a network share. This is useful for investigating file share issues. + +Please note that by default, networking is restricted when `linsk run --debug-shell` is run. You will need to add `--vm-unrestricted-networking` flag in order to be able to access the outside network, which is commonly needed to install packages with `apk`. \ No newline at end of file diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md new file mode 100644 index 0000000..a36ad16 --- /dev/null +++ b/TROUBLESHOOTING.md @@ -0,0 +1,21 @@ +# Linsk troubleshooting tools + +To aid with debugging/troubleshooting, Linsk is bundled with a few tools aimed to give you access to the virtual machine's internals. + +### Error messages + +By far, error messages is the single most helpful tool to help with problems of any kind. Before referring to anything, please analyze the errors and logs in detail. + +**A great effort was put into ensuring that errors in Linsk are self-contained and provide enough information to understand what went wrong.** Please use them to your advantage. + +### Shell + +Linsk's shell is a powerful tool to assist with investigating issues inside the VM. Please refer to [SHELL.md](SHELL.md). + +### `--vm-debug` flag + +This flag is applicable in any `linsk` subcommand that starts a VM. Provided `--vm-debug`, Linsk will not start QEMU in headless mode and instead open a window with the virtual machine's display. **This is useful for investigating boot issues.** + +# Common issues + +TBD. \ No newline at end of file diff --git a/USAGE_MACOS.md b/USAGE_MACOS.md index 1f1a958..133f306 100644 --- a/USAGE_MACOS.md +++ b/USAGE_MACOS.md @@ -5,7 +5,7 @@ In this document, you will find instructions on how to get started using Linsk o # How Linsk works As you probably have realized from the initial README, Linsk takes use of a lightweight Alpine Linux virtual machine to tap into the rich world of Linux filesystems. -Linsk will pass through the disk as a raw block device to an ephemeral virtual machine, set up a file share and then expose it to your host computer, along with logging the file share connection details. It's as simple as that. +Linsk will pass through the disk as a raw block device to an ephemeral virtual machine, set up a file share, and then expose it to your host computer, along with logging the file share connection details. It's as simple as that. # Use Linsk @@ -34,7 +34,7 @@ time=2023-09-03T10:33:31.718+01:00 level=INFO msg="Removed base image" caller=st time=2023-09-03T10:33:31.718+01:00 level=INFO msg="VM image built successfully" path=/Users/Alex/.linsk/3.18.3-x86_64-linsk1.qcow2 ``` -**NOTE:** Building a VM image requires internet connection. After the initial image build is done, you can use Linsk offline. +**NOTE:** Building a VM image requires an internet connection. After the initial image build is done, you can use Linsk offline. ## Step 1. Select the drive you want to pass through @@ -43,7 +43,9 @@ Find the `/dev/` path of the drive you want to pass through by executing the fol diskutil list ``` -Find your disk, and take a note of the disk path that looks like `/dev/diskX` (where X is a number). We will need this in the next step. +Find your disk, and take note of the disk path that looks like `/dev/diskX` (where X is a number). We will need this in the next step. + +**IMPORTANT NOTE:** Please ensure that the physical device you are trying to pass through is not mounted anywhere else on the host machine. Otherwise, you run serious risks. No further warnings will be issued. ## Step 2. Use `linsk ls` to see what partitions are available in the VM @@ -105,9 +107,9 @@ sudo linsk run dev:/dev/diskX vdb2 ext4 ``` Explanation of the command above: -- `dev:dev/diskX` - Tell Linsk to pass through the drive path you obtained from the step 1. -- `vdb2` - Tell Linsk to mount `/dev/vdb2` inside the filesystem. This was gathered from from the step 2. -- `ext4` - Tell Linsk to use the Ext4 file system. As with the `vdb2`, this was acquired from the step 2. **NOTE:** Specifying the file system is **REQUIRED**—you need to explicitly tell Linsk what filesystem you want to use. +- `dev:dev/diskX` - Tell Linsk to pass through the drive path you obtained from step 1. +- `vdb2` - Tell Linsk to mount `/dev/vdb2` inside the filesystem. This was gathered from step 2. +- `ext4` - Tell Linsk to use the Ext4 file system. As with the `vdb2`, this was acquired from step 2. **NOTE:** Specifying the file system is **REQUIRED**—you need to explicitly tell Linsk what filesystem you want to use. Upon running, you will see logs similar to this in your terminal: ``` @@ -129,7 +131,7 @@ Password: =========================== ``` -At this point, you can start Finder, hit Command+K and put in the server URL copied from the output above, along with a static `linsk` username and a randomly-generated password. If you need help, you can find more information on this here: https://support.apple.com/guide/mac-help/mchlp1140/mac. +At this point, you can start Finder, hit Command+K and put in the server URL copied from the output above, along with a static `linsk` username and a randomly generated password. If you need help, you can find more information on this here: https://support.apple.com/guide/mac-help/mchlp1140/mac. **That's it!** After that, you should see the network share mounted successfully. That means that you can now access the files on the `vdb2` Ext4 volume right from your Mac. @@ -137,7 +139,7 @@ The network share will remain open until you close Linsk, which you can do at an # The advanced use of Linsk -The example provided above is just a mere preview of the endless power the Linsk's native Linux VM has. +The example provided above is just a mere preview of the endless power Linsk's native Linux VM has. ## Use LVM @@ -179,6 +181,12 @@ Password: This example showed how you can use LUKS with LVM2 volumes, but that doesn't mean that you can't use volumes without LVM. You can specify plain device paths like `vdb3` without any issue. -# How to investigate in case something goes wrong +# FAQ - \ No newline at end of file +### How do I format disks with Linsk? + +Use `linsk shell`. Please see [SHELL.md](SHELL.md). + +# Troubleshooting + +Please refer to [TROUBLESHOOTING.md](TROUBLESHOOTING.md). \ No newline at end of file diff --git a/USAGE_WINDOWS.md b/USAGE_WINDOWS.md index 5187a82..e49874b 100644 --- a/USAGE_WINDOWS.md +++ b/USAGE_WINDOWS.md @@ -5,7 +5,7 @@ In this document, you will find instructions on how to get started using Linsk o # How Linsk works As you probably have realized from the initial README, Linsk takes use of a lightweight Alpine Linux virtual machine to tap into the rich world of Linux filesystems. -Linsk will pass through the disk as a raw block device to an ephemeral virtual machine, set up a file share and then expose it to your host computer, along with logging the file share connection details. It's as simple as that. +Linsk will pass through the disk as a raw block device to an ephemeral virtual machine, set up a file share, and then expose it to your host computer, along with logging the file share connection details. It's as simple as that. # Use Linsk @@ -34,7 +34,7 @@ time=2023-09-03T10:33:31.718+01:00 level=INFO msg="Removed base image" caller=st time=2023-09-03T10:33:31.718+01:00 level=INFO msg="VM image built successfully" path=C:\Users\Alex\Linsk\3.18.3-x86_64-linsk1.qcow2 ``` -**NOTE:** Building a VM image requires internet connection. After the initial image build is done, you can use Linsk offline. +**NOTE:** Building a VM image requires an internet connection. After the initial image build is done, you can use Linsk offline. ## Step 1. Select the drive you want to pass through @@ -43,7 +43,9 @@ Find the path of the physical drive you want to pass through by executing the fo wmic diskdrive list brief ``` -Find your disk, and take a note of the disk path that looks like `\\.\PhysicalDriveX` (where X is a number). We will need this in the next step. +Find your disk, and take note of the disk path that looks like `\\.\PhysicalDriveX` (where X is a number). We will need this in the next step. + +**IMPORTANT NOTE:** Please ensure that the physical device you are trying to pass through is not mounted anywhere else on the host machine. Otherwise, you run serious risks. No further warnings will be issued. ## Step 2. Use `linsk ls` to see what partitions are available in the VM @@ -107,9 +109,9 @@ linsk run dev:\\.\PhysicalDriveX vdb2 ext4 ``` Explanation of the command above: -- `dev:\\.\PhysicalDriveX` - Tell Linsk to pass through the drive path you obtained from the step 1. -- `vdb2` - Tell Linsk to mount `/dev/vdb2` inside the filesystem. This was gathered from from the step 2. -- `ext4` - Tell Linsk to use the Ext4 file system. As with the `vdb2`, this was acquired from the step 2. **NOTE:** Specifying the file system is **REQUIRED**—you need to explicitly tell Linsk what filesystem you want to use. +- `dev:\\.\PhysicalDriveX` - Tell Linsk to pass through the drive path you obtained from step 1. +- `vdb2` - Tell Linsk to mount `/dev/vdb2` inside the filesystem. This was gathered from step 2. +- `ext4` - Tell Linsk to use the Ext4 file system. As with the `vdb2`, this was acquired from step 2. **NOTE:** Specifying the file system is **REQUIRED**—you need to explicitly tell Linsk what filesystem you want to use. Upon running, you will see logs similar to this in your terminal: ``` @@ -131,7 +133,7 @@ Password: =========================== ``` -At this point, you can open the file explorer -> Right-click "This PC" -> Show more options (if you're on Windows 11) -> Map network drive. Afterward, you should specify the share URL (the one that starts with `\\`), the static `linsk` username, and a randomly-generated password. +At this point, you can open the file explorer -> Right-click "This PC" -> Show more options (if you're on Windows 11) -> Map network drive. Afterward, you should specify the share URL (the one that starts with `\\`), the static `linsk` username, and a randomly generated password. **That's it!** After that, you should see the network share mounted successfully. That means that you can now access the files on the `vdb2` Ext4 volume right from your Mac. @@ -139,7 +141,7 @@ The network share will remain open until you close Linsk, which you can do at an # The advanced use of Linsk -The example provided above is just a mere preview of the endless power the Linsk's native Linux VM has. +The example provided above is just a mere preview of the endless power Linsk's native Linux VM has. ## Use LVM @@ -183,6 +185,12 @@ Password: This example showed how you can use LUKS with LVM2 volumes, but that doesn't mean that you can't use volumes without LVM. You can specify plain device paths like `vdb3` without any issue. -# How to investigate in case something goes wrong +# FAQ - \ No newline at end of file +### How do I format disks with Linsk? + +Use `linsk shell`. Please see [SHELL.md](SHELL.md). + +# Troubleshooting + +Please refer to [TROUBLESHOOTING.md](TROUBLESHOOTING.md). \ No newline at end of file diff --git a/assets/screenshot.png b/assets/screenshot.png new file mode 100644 index 0000000..9ca85ba Binary files /dev/null and b/assets/screenshot.png differ diff --git a/build-binaries.sh b/build-binaries.sh new file mode 100644 index 0000000..dceb268 --- /dev/null +++ b/build-binaries.sh @@ -0,0 +1,37 @@ +rm -rf build +mkdir build + +trimpath=$PWD +echo "Trimming path $trimpath" + +version=$1 + +if [ -z "$version" ]; then + echo "Version is not specified (first positional argument)" + exit 1 +fi + +function build() { + name="linsk_${1}_${2}_${version}" + binary_name="$name" + if [ $1 == "windows" ]; then + binary_name="$binary_name.exe" + fi + + CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -trimpath -o build/$binary_name + cd build + zip $name.zip $binary_name + rm $binary_name + cd .. +} + +build windows amd64 +build darwin amd64 +build darwin arm64 + +cd build + +hashes_file="linsk_sha256_$version.txt" + +sha256sum * > $hashes_file +gpg --output ${hashes_file}.sig --detach-sign --armor $hashes_file \ No newline at end of file diff --git a/keys/AlexSSD7.key b/keys/AlexSSD7.key new file mode 100644 index 0000000..6ef4ec7 --- /dev/null +++ b/keys/AlexSSD7.key @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGT1lT0BEACv05yqyQhyrT4xi1xvby/RM0gtsMWt5g+u4gE8s7YcY+Orw9du +xUwf6ECEiYoKS9TagjSVq70UM0cB4vQtbv6A86PcxP/hazsNmyw1bGEeaW9XVIO/ +26XCmv0j4OHEN2gTqLevRfbLC65bVb1qdooLrtpYLKVI2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EQEAAYkCOwQYAQoAJhYhBPcjHf0zM6J/cdFxODti +fFl9Nye9BQJk9ZU9AhsMBQkDwmcAAAoJEDtifFl9Nye91LcP91QDrAkK3MHQYjes +lS10//CAJxQKVYzANjI6OPFih0yWRg77RlbUK7hYpjt+lFc916Ay+M7m353zW/PT +wljouAgiA5eN3OcGHsKb6fYb91uwoHqw0Oatzx46NuJ2bgnHW56HaZgiOMAj4aeo +sed0PrDTlaNUG1ADQLLufehF8NqTDZY78WcrVdzSmN2QhrSBiGpyMZ2ZfuskU34E +BCt2aEosrMjL8tZ2eGl/x8teudEHGaLo+aIXO90Raabz07D5giUQ76toU5bifhv5 +zbc6s7wG9jzb3uhzaxW/7kHz3TMrZmfO5pBbmJiPIA2zjlJDIjE5RzY9o49Z57y2 +RLL1ju25X+KYT8KoK7lLNmOOS6qPKcUVAEyVsO9Z/K/P2WQ35Y4pgLElDrbdowgT +zmWjXGmqaMWgG7izwvV6iOekAig7OUN25QGy/1qTzjoxUW/kYpakRfdHaiP07xzz +hJMcfdIuOb4Jf7Z6tJKPLFtBQZ7ytXfgu2UeJBXX1pMRIBn/RwSEAhmGlWHFSEDu +SzyQjabJOuLGAt7Vay2G95lOtHNTjpriQw663U5Gah3nmJzoC+7KWnOGNgZRCEsO +eGZjh2opaxXqu6Fv7eqJ0E2MsmOIawPBr8fWpXIQshdGEN//3+I5ytmK9B3vgAe+ +BNbvvcRjpJJjv01pCTBeaPWgXPk= +=fhOb +-----END PGP PUBLIC KEY BLOCK----- diff --git a/qemucli/args.go b/qemucli/args.go index edb2af4..4280bb9 100644 --- a/qemucli/args.go +++ b/qemucli/args.go @@ -42,10 +42,11 @@ var safeArgs = map[string]ArgAcceptedValue{ "netdev": ArgAcceptedValueKeyValue, "serial": ArgAcceptedValueString, "cdrom": ArgAcceptedValueString, - "machine": ArgAcceptedValueString, + "machine": ArgAcceptedValueKeyValue, "cpu": ArgAcceptedValueString, "display": ArgAcceptedValueString, "drive": ArgAcceptedValueKeyValue, + "bios": ArgAcceptedValueString, } type Arg interface { diff --git a/sshutil/ssh.go b/sshutil/ssh.go index b9af2ec..7b87c1e 100644 --- a/sshutil/ssh.go +++ b/sshutil/ssh.go @@ -99,7 +99,9 @@ func NewSSHSessionWithDelayedTimeout(ctx context.Context, timeout time.Duration, go func() { select { case <-time.After(timeout): - preTimeout() + if preTimeout != nil { + preTimeout() + } timedOut = true _ = sc.Close() case <-done: diff --git a/vm/cfg.go b/vm/cfg.go index 74f5872..264e713 100644 --- a/vm/cfg.go +++ b/vm/cfg.go @@ -67,10 +67,6 @@ func configureBaseVMCmd(logger *slog.Logger, cfg Config) (string, []qemucli.Arg, var accel []qemucli.KeyValueArgItem switch { case osspecifics.IsWindows(): - // TODO: To document: For Windows, we need to install QEMU using an installer and add it to PATH. - // Then, we should enable Windows Hypervisor Platform in "Turn Windows features on or off". - // IMPORTANT: We should also install libusbK drivers for USB devices we want to pass through. - // This can be easily done with a program called Zadiag by Akeo. accel = []qemucli.KeyValueArgItem{ {Key: "whpx"}, {Key: "kernel-irqchip", Value: "off"}, diff --git a/vm/filemanager.go b/vm/filemanager.go index e69998b..0eb147a 100644 --- a/vm/filemanager.go +++ b/vm/filemanager.go @@ -113,7 +113,7 @@ func (fm *FileManager) luksOpen(sc *ssh.Client, fullDevPath string) error { return errors.Wrap(err, "write prompt to stderr") } - pwd, err := term.ReadPassword(int(syscall.Stdin)) + pwd, err := term.ReadPassword(int(syscall.Stdin)) //nolint:unconvert // On Windows it's a different non-int type. if err != nil { return errors.Wrap(err, "read luks password") }