-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openssh: only allow root login if sshd is started as root
- Loading branch information
Showing
5 changed files
with
33 additions
and
8 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
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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
diff -uNr openssh-portable-V_9_5_P1/auth.c openssh-portable-V_9_5_P1.mod/auth.c | ||
--- openssh-portable-V_9_5_P1/auth.c 2023-10-04 07:34:10.000000000 +0300 | ||
+++ openssh-portable-V_9_5_P1.mod/auth.c 2023-11-23 16:29:34.257875879 +0200 | ||
@@ -485,7 +485,13 @@ | ||
@@ -485,7 +485,12 @@ | ||
aix_setauthdb(user); | ||
#endif | ||
|
||
+#ifdef __ANDROID__ | ||
+ /* Effectively a single-user system, use current user no matter supplied user */ | ||
+ pw = getpwuid(getuid()); | ||
+ /* Effectively a single-user system, use current user no matter supplied user */ | ||
+ pw = getpwuid(getuid()); | ||
+#else | ||
pw = getpwnam(user); | ||
+#endif | ||
+ | ||
|
||
#if defined(_AIX) && defined(HAVE_SETAUTHDB) | ||
aix_restoreauthdb(); |
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
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,21 @@ | ||
--- a/sshd-session.c | ||
+++ b/sshd-session.c | ||
@@ -1074,7 +1074,18 @@ | ||
|
||
/* Store privilege separation user for later use if required. */ | ||
privsep_chroot = (getuid() == 0 || geteuid() == 0); | ||
+#ifdef __ANDROID__ | ||
+ /* Let the privilege separation user be Termux on Android */ | ||
+ do { | ||
+ struct stat st; | ||
+ if (stat("@TERMUX_PREFIX@", &st) != -1) { | ||
+ privsep_pw = getpwuid(st.st_uid); | ||
+ } | ||
+ } while (0); | ||
+ if (privsep_pw == NULL) { | ||
+#else | ||
if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { | ||
+#endif | ||
if (privsep_chroot || options.kerberos_authentication) | ||
fatal("Privilege separation user %s does not exist", | ||
SSH_PRIVSEP_USER); |
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