vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jan F. Chadima ca05b3
diff -up openssh-5.2p1/contrib/ssh-copy-id.selabel openssh-5.2p1/contrib/ssh-copy-id
Jan F. Chadima 3d6b00
--- openssh-5.2p1/contrib/ssh-copy-id.selabel	2009-01-21 10:29:21.000000000 +0100
Jan F. Chadima 3d6b00
+++ openssh-5.2p1/contrib/ssh-copy-id	2009-07-08 14:28:27.000000000 +0200
Jan F. Chadima ca05b3
@@ -38,7 +38,7 @@ if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || 
Jan F. Chadima ca05b3
   exit 1
Jan F. Chadima ca05b3
 fi
Jan F. Chadima ca05b3
 
Jan F. Chadima ca05b3
-{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1
Jan F. Chadima ca05b3
+{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys; test -x /sbin/restorecon && /sbin/restorecon .ssh .ssh/authorized_keys" || exit 1
Jan F. Chadima ca05b3
 
Jan F. Chadima ca05b3
 cat <
Jan F. Chadima ca05b3
 Now try logging into the machine, with "ssh '$1'", and check in:
Jan F. Chadima ca05b3
diff -up openssh-5.2p1/Makefile.in.selabel openssh-5.2p1/Makefile.in
Jan F. Chadima 3d6b00
--- openssh-5.2p1/Makefile.in.selabel	2009-07-08 14:28:25.000000000 +0200
Jan F. Chadima 3d6b00
+++ openssh-5.2p1/Makefile.in	2009-07-08 14:28:27.000000000 +0200
Jan F. Chadima ca05b3
@@ -134,7 +134,7 @@ libssh.a: $(LIBSSH_OBJS)
Jan F. Chadima ca05b3
 	$(RANLIB) $@
Jan F. Chadima ca05b3
 
Jan F. Chadima ca05b3
 ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
Jan F. Chadima ca05b3
-	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck $(LIBS)
Jan F. Chadima ca05b3
+	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat -lfipscheck -lselinux $(LIBS)
Jan F. Chadima ca05b3
 
Jan F. Chadima ca05b3
 sshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
Jan F. Chadima ca05b3
 	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) -lfipscheck $(LIBS)
Jan F. Chadima ca05b3
diff -up openssh-5.2p1/ssh.c.selabel openssh-5.2p1/ssh.c
Jan F. Chadima 3d6b00
--- openssh-5.2p1/ssh.c.selabel	2009-07-08 14:28:27.000000000 +0200
Jan F. Chadima 3d6b00
+++ openssh-5.2p1/ssh.c	2009-07-08 14:34:00.000000000 +0200
Jan F. Chadima ca05b3
@@ -74,6 +74,7 @@
Jan F. Chadima ca05b3
 #include <openssl/err.h>
Jan F. Chadima ca05b3
 #include <openssl/fips.h>
Jan F. Chadima ca05b3
 #include <fipscheck.h>
Jan F. Chadima ca05b3
+#include <selinux/selinux.h>
Jan F. Chadima ca05b3
 #include "openbsd-compat/openssl-compat.h"
Jan F. Chadima ca05b3
 #include "openbsd-compat/sys-queue.h"
Jan F. Chadima ca05b3
 
Jan F. Chadima 3d6b00
@@ -791,10 +792,15 @@ main(int ac, char **av)
Jan F. Chadima ca05b3
 	 */
Jan F. Chadima 3d6b00
 	r = snprintf(buf, sizeof buf, "%s%s%s", pw->pw_dir,
Jan F. Chadima ca05b3
 	    strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR);
Jan F. Chadima 3d6b00
-	if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0)
Jan F. Chadima 3d6b00
+	if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) {
Jan F. Chadima ca05b3
+		char *scon;
Jan F. Chadima ca05b3
+
Jan F. Chadima ca05b3
+		matchpathcon(buf, 0700, &scon);
Jan F. Chadima ca05b3
+		setfscreatecon(scon);
Jan F. Chadima ca05b3
 		if (mkdir(buf, 0700) < 0)
Jan F. Chadima ca05b3
 			error("Could not create directory '%.200s'.", buf);
Jan F. Chadima ca05b3
-
Jan F. Chadima ca05b3
+		setfscreatecon(NULL);
Jan F. Chadima ca05b3
+	}
Jan F. Chadima ca05b3
 	/* load options.identity_files */
Jan F. Chadima ca05b3
 	load_public_identity_files();
Jan F. Chadima ca05b3