1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 02:43:24 +03:00
mobile-nixos/modules/initrd-ssh.nix
2018-07-08 21:14:16 -04:00

42 lines
976 B
Nix

{ config, lib, pkgs, ... }:
with lib;
with import ./initrd-order.nix;
let
device_name = config.mobile.device.name;
cfg = config.mobile.boot.stage-1.ssh;
in
{
options.mobile.boot.stage-1.ssh = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enables ssh.
CURRENT CONFIGURATION ALSO OPENS ACCESS TO ALL WITHOUT A PASSWORD NOR SSH KEY.
'';
};
};
config.mobile.boot.stage-1 = lib.mkIf cfg.enable {
init = lib.mkOrder SERVICES_INIT ''
#
# Oh boy, that's insecure!
#
passwd -u root
passwd -d root
echo "From a mobile-nixos device ${device_name}" >> /etc/banner
mkdir -p /etc/dropbear/
# THIS IS HIGHLY INSECURE
# This allows blank login passwords.
dropbear -ERB -b /etc/banner
'';
extraUtils = with pkgs; [
{ package = dropbear; extraCommand = "cp -fpv ${glibc.out}/lib/libnss_files.so.* $out/lib"; }
];
};
}