forked from clan/clan-core
improve output of installer iso
Now it also includes local addresses.
This commit is contained in:
parent
79e707b044
commit
04836fa9e8
@ -37,7 +37,7 @@
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
# ${pkgs.tor}/bin/torify
|
# ${pkgs.tor}/bin/torify
|
||||||
ExecStart = pkgs.writers.writeDash "announce-hidden-service" ''
|
ExecStart = pkgs.writeShellScript "announce-hidden-service" ''
|
||||||
set -efu
|
set -efu
|
||||||
until test -e ${config.services.tor.settings.DataDirectory}/onion/hidden-ssh/hostname; do
|
until test -e ${config.services.tor.settings.DataDirectory}/onion/hidden-ssh/hostname; do
|
||||||
echo "still waiting for ${config.services.tor.settings.DataDirectory}/onion/hidden-ssh/hostname"
|
echo "still waiting for ${config.services.tor.settings.DataDirectory}/onion/hidden-ssh/hostname"
|
||||||
|
@ -19,26 +19,32 @@
|
|||||||
'';
|
'';
|
||||||
hidden-ssh-announce = {
|
hidden-ssh-announce = {
|
||||||
enable = true;
|
enable = true;
|
||||||
script = pkgs.writers.writeDash "write-hostname" ''
|
script = pkgs.writeShellScript "write-hostname" ''
|
||||||
set -efu
|
set -efu
|
||||||
|
export PATH=${lib.makeBinPath (with pkgs; [ iproute2 coreutils jq qrencode ])}
|
||||||
|
|
||||||
mkdir -p /var/shared
|
mkdir -p /var/shared
|
||||||
echo "$1" > /var/shared/onion-hostname
|
echo "$1" > /var/shared/onion-hostname
|
||||||
${pkgs.jq}/bin/jq -nc \
|
local_addrs=$(ip -json addr | jq '[map(.addr_info) | flatten | .[] | select(.scope == "global") | .local]')
|
||||||
|
jq -nc \
|
||||||
--arg password "$(cat /var/shared/root-password)" \
|
--arg password "$(cat /var/shared/root-password)" \
|
||||||
--arg address "$(cat /var/shared/onion-hostname)" '{
|
--arg onion_address "$(cat /var/shared/onion-hostname)" \
|
||||||
password: $password, address: $address
|
--argjson local_addrs "$local_addrs" \
|
||||||
}' > /var/shared/login.info
|
'{ password: $password, onion_address: $onion_address, local_addresses: $local_addrs }' \
|
||||||
cat /var/shared/login.info |
|
> /var/shared/login.json
|
||||||
${pkgs.qrencode}/bin/qrencode -t utf8 -o /var/shared/qrcode.utf8
|
cat /var/shared/login.json | qrencode -t utf8 -o /var/shared/qrcode.utf8
|
||||||
cat /var/shared/login.info |
|
|
||||||
${pkgs.qrencode}/bin/qrencode -t png -o /var/shared/qrcode.png
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
services.getty.autologinUser = lib.mkForce "root";
|
services.getty.autologinUser = lib.mkForce "root";
|
||||||
programs.bash.interactiveShellInit = ''
|
programs.bash.interactiveShellInit = ''
|
||||||
if [ "$(tty)" = "/dev/tty1" ]; then
|
if [ "$(tty)" = "/dev/tty1" ]; then
|
||||||
echo 'waiting for tor to generate the hidden service'
|
echo -n 'waiting for tor to generate the hidden service'
|
||||||
until test -e /var/shared/qrcode.utf8; do echo .; sleep 1; done
|
until test -e /var/shared/qrcode.utf8; do echo -n .; sleep 1; done
|
||||||
|
echo
|
||||||
|
echo "Root password: $(cat /var/shared/root-password)"
|
||||||
|
echo "Onion address: $(cat /var/shared/onion-hostname)"
|
||||||
|
echo "Local network addresses:"
|
||||||
|
${pkgs.iproute}/bin/ip -brief -color addr | grep -v 127.0.0.1
|
||||||
cat /var/shared/qrcode.utf8
|
cat /var/shared/qrcode.utf8
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user