-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
installer: Don't run as root #66338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
installer: Don't run as root #66338
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,6 +42,12 @@ | |||||
| set up binfmt interpreters for each of those listed systems. | ||||||
| </para> | ||||||
| </listitem> | ||||||
| <listitem> | ||||||
| <para> | ||||||
| The installer now uses a less privileged <literal>nixos</literal> user whereas before we logged in as root. | ||||||
|
||||||
| The installer now uses a less privileged <literal>nixos</literal> user whereas before we logged in as root. | |
| The installer now uses the <literal>nixos</literal> user instead of <literal>root</literal>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I drop "less privileged" because they're not actually less privileged., and saying it is might lead to questions about well how do I do the thing then.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,16 +8,30 @@ with lib; | |
| { | ||
| imports = [ ./installation-cd-base.nix ]; | ||
|
|
||
| # Whitelist wheel users to do anything | ||
| # This is useful for things like pkexec | ||
worldofpeace marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # | ||
| # WARNING: this is dangerous for systems | ||
| # outside the installation-cd and shouldn't | ||
| # be used anywhere else. | ||
| security.polkit.extraConfig = '' | ||
| polkit.addRule(function(action, subject) { | ||
| if (subject.isInGroup("wheel")) { | ||
| return polkit.Result.YES; | ||
| } | ||
| }); | ||
| ''; | ||
|
|
||
| services.xserver = { | ||
| enable = true; | ||
|
|
||
| # Don't start the X server by default. | ||
| autorun = mkForce false; | ||
|
|
||
| # Automatically login as root. | ||
| # Automatically login as nixos. | ||
| displayManager.slim = { | ||
|
||
| enable = true; | ||
| defaultUser = "root"; | ||
| defaultUser = "nixos"; | ||
| autoLogin = true; | ||
| }; | ||
|
|
||
|
|
@@ -33,7 +47,6 @@ with lib; | |
|
|
||
| # Enable sound in graphical iso's. | ||
| hardware.pulseaudio.enable = true; | ||
| hardware.pulseaudio.systemWide = true; # Needed since we run plasma as root. | ||
|
|
||
| environment.systemPackages = [ | ||
| # Include gparted for partitioning disks. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # This module defines a NixOS installation CD that contains X11 and | ||
| # Plasma5. | ||
| # Plasma 5. | ||
|
|
||
| { config, lib, pkgs, ... }: | ||
|
|
||
|
|
@@ -30,15 +30,20 @@ with lib; | |
| Version=1.0 | ||
| Type=Application | ||
| Name=NixOS Manual | ||
| Exec=firefox ${config.system.build.manual.manualHTMLIndex} | ||
|
||
| Exec=firefox ${config.system.build.manual.manual}/share/doc/nixos/index.html | ||
| Icon=text-html | ||
| ''; | ||
|
|
||
| homeDir = "/home/nixos/"; | ||
| desktopDir = homeDir + "Desktop/"; | ||
|
|
||
| in '' | ||
| mkdir -p /root/Desktop | ||
| ln -sfT ${manualDesktopFile} /root/Desktop/nixos-manual.desktop | ||
| ln -sfT ${pkgs.konsole}/share/applications/org.kde.konsole.desktop /root/Desktop/org.kde.konsole.desktop | ||
| ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop | ||
| mkdir -p ${desktopDir} | ||
| chown nixos ${homeDir} ${desktopDir} | ||
|
|
||
| ln -sfT ${manualDesktopFile} ${desktopDir + "nixos-manual.desktop"} | ||
| ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop ${desktopDir + "gparted.desktop"} | ||
| ln -sfT ${pkgs.konsole}/share/applications/org.kde.konsole.desktop ${desktopDir + "org.kde.konsole.desktop"} | ||
| ''; | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| diff -ru old/gparted-1.0.0/configure gparted-1.0.0/configure | ||
| --- old/gparted-1.0.0/configure 2019-05-29 12:02:13.000000000 -0400 | ||
| +++ gparted-1.0.0/configure 2019-08-08 18:09:52.792795781 -0400 | ||
| @@ -16145,7 +16145,7 @@ | ||
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkexec >= $PKEXEC_REQUIRED_VERSION" >&5 | ||
| $as_echo_n "checking for pkexec >= $PKEXEC_REQUIRED_VERSION... " >&6; } | ||
| PKEXEC_REQUIRED_INT=`echo "$PKEXEC_REQUIRED_VERSION" | $AWK -F. '{print $1 * 10000 + $2}'` | ||
| -PKEXEC_VERSION_OUTPUT=`pkexec --version 2> /dev/null` || | ||
| +PKEXEC_VERSION_OUTPUT='pkexec version @polkit_version@' || | ||
| { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 | ||
| $as_echo "not found" >&6; } | ||
| if test "x$PKEXEC_VERSION_OUTPUT" != 'x'; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.