-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MyPC
committed
Dec 13, 2023
0 parents
commit ba87ab9
Showing
11 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/sbin/sh | ||
|
||
################# | ||
# Initialization | ||
################# | ||
|
||
umask 022 | ||
|
||
# echo before loading util_functions | ||
ui_print() { echo "$1"; } | ||
|
||
require_new_magisk() { | ||
ui_print "*******************************" | ||
ui_print " Please install Magisk v20.4+! " | ||
ui_print "*******************************" | ||
exit 1 | ||
} | ||
|
||
######################### | ||
# Load util_functions.sh | ||
######################### | ||
|
||
OUTFD=$2 | ||
ZIPFILE=$3 | ||
|
||
mount /data 2>/dev/null | ||
|
||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk | ||
. /data/adb/magisk/util_functions.sh | ||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk | ||
|
||
install_module | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#MAGISK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Magisk Tailscaled | ||
|
||
This repository contains a Magisk module for running Tailscale on rooted Android devices. | ||
|
||
## Requirements | ||
|
||
- An Android device with Magisk root installed. | ||
- Currently only support for `arm` or `arm64` architecture. | ||
|
||
## Installation | ||
|
||
1. Download the latest zip file from the [Releases](https://github.com/anasfanani/Magisk-Tailscaled/releases/latest) page. | ||
2. Install the downloaded zip file using Magisk. | ||
3. Reboot your phone. | ||
|
||
After installation, the Tailscale daemon (`tailscaled`) will run automatically on boot. | ||
|
||
## Usage | ||
|
||
This module runs `tailscaled` with the `--tun=userspace-networking` option, which uses a userspace network stack instead of the kernel's network stack. This can be useful on devices where the kernel's network stack is not compatible with Tailscale. | ||
|
||
The state file for `tailscaled` is stored at `/data/local/tmp/tailscaled.state`, and the log output is written to `/data/local/tmp/tailscaled.log`. | ||
|
||
## Instructions | ||
|
||
1. Reboot your device. | ||
2. Open the Terminal. | ||
3. Run 'su' to gain root access. | ||
4. Run 'tailscale login' to login to your Tailscale account. | ||
5. Open the URL in a browser to authorize your device. | ||
6. Run 'tailscale status' to check the Tailscale connection. | ||
|
||
## Troubleshooting | ||
|
||
1. Check logs in `/data/local/tmp/tailscaled.log`. | ||
|
||
## Notice | ||
|
||
- Tailscale has some bugs. | ||
- To login to Tailscale, you need to go to the tmp directory. | ||
- You can use these commands: | ||
- `su && cd /data/local/tmp/ && tailscale login` | ||
|
||
## Links | ||
|
||
- [Tailscale Userspace Networking](https://tailscale.com/kb/1112/userspace-networking/) | ||
- [Termux Issue #10166](https://github.com/termux/termux-packages/issues/10166) | ||
- [Tailscale Static Packages](https://pkgs.tailscale.com/stable/#static) | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
case $ARCH in | ||
arm) F_ARCH=$ARCH;; | ||
arm64) F_ARCH=$ARCH;; | ||
*) ui_print "Unsupported architecture: $ARCH"; abort;; | ||
esac | ||
|
||
ui_print "- Detected architecture: $F_ARCH" | ||
ui_print "- Extracting module files" | ||
|
||
F_TARGETDIR="$MODPATH/system/bin" | ||
UNZIP="/data/adb/magisk/busybox unzip" | ||
|
||
mkdir -p "$F_TARGETDIR" | ||
$UNZIP -qq -o "$ZIPFILE" "files/tailscaled-$F_ARCH" -j -d "$F_TARGETDIR" | ||
$UNZIP -qq -o "$ZIPFILE" "files/tailscale-$F_ARCH" -j -d "$F_TARGETDIR" | ||
|
||
mv "$F_TARGETDIR/tailscaled-$F_ARCH" "$F_TARGETDIR/tailscaled" | ||
mv "$F_TARGETDIR/tailscale-$F_ARCH" "$F_TARGETDIR/tailscale" | ||
|
||
ui_print "- Extracted files to $F_TARGETDIR" | ||
|
||
ui_print "- Setting permissions" | ||
|
||
set_perm_recursive $MODPATH 0 0 0755 0644 | ||
set_perm_recursive $F_TARGETDIR 0 2000 0755 0755 | ||
set_perm $MODPATH/service.sh 0 0 0755 | ||
|
||
ui_print "- Cleaning up" | ||
|
||
rm -r "$F_TARGETDIR/files" # cleanup | ||
|
||
ui_print "*******************" | ||
ui_print " Instructions " | ||
ui_print "*******************" | ||
ui_print "1. Reboot your device." | ||
ui_print "2. Open the Teminal." | ||
ui_print "3. Run 'su' to gain root access." | ||
ui_print "4. Run 'tailscale login' to login to your Tailscale account." | ||
ui_print "5. Open url in browser to authorize your device." | ||
ui_print "6. Run 'tailscale status' to check Tailscale connection." | ||
ui_print "*******************" | ||
ui_print " Troubleshooting " | ||
ui_print "*******************" | ||
ui_print "1. Check logs in /data/local/tmp/tailscaled.log." | ||
ui_print "*******************" | ||
ui_print " Notice " | ||
ui_print "*******************" | ||
ui_print "- Tailscale has some bug." | ||
ui_print "- To login tailscale you need go to tmp directory." | ||
ui_print "- You can use this commands:" | ||
ui_print "$ su" | ||
ui_print "$ cd /data/local/tmp/" | ||
ui_print "$ tailscale login" | ||
ui_print "*******************" | ||
|
||
|
||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
id=magisk-tailscaled | ||
name=Magisk-Tailscaled | ||
version=0.1 | ||
versionCode=0.1 | ||
author=anasfanani | ||
description=Run Tailscaled with magisk. | ||
updateJson=https://raw.githubusercontent.com/anasfanani/Magisk-Tailscaled/master/update.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# wait for boot to complete | ||
while [ "$(getprop sys.boot_completed)" != 1 ]; do | ||
sleep 1 | ||
done | ||
# wait for network to be available | ||
echo "Waiting network to be available">/data/local/tmp/tailscaled.log | ||
while true; do | ||
ping -c 1 8.8.8.8 > /dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
break | ||
else | ||
sleep 1 | ||
fi | ||
done | ||
# ensure boot & network has actually completed | ||
sleep 5 | ||
# start tailscaled | ||
echo "Starting tailscaled">>/data/local/tmp/tailscaled.log | ||
while true;do | ||
# https://github.com/tailscale/tailscale/issues?q=no+safe+place+found+to+store+log+state | ||
cd /data/local/tmp/ && tailscaled -tun=userspace-networking -statedir=/data/local/tmp/ -state=/data/local/tmp/tailscaled.state --port=41641 >> /data/local/tmp/tailscaled.log 2>&1 | ||
sleep 5 | ||
echo "Tailscaled restarting">>/data/local/tmp/tailscaled.log | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": 0.1, | ||
"versionCode": 0.1, | ||
"zipUrl": "https://codeload.github.com/anasfanani/Magisk-Tailscaled/zip/refs/heads/master", | ||
"changelog": "https://github.com/anasfanani/Magisk-Tailscaled/releases/latest" | ||
} |