diff --git a/extras/peer_add_secret_pub.in b/extras/peer_add_secret_pub.in
index e3a9aa2a4..c9674af35 100644
--- a/extras/peer_add_secret_pub.in
+++ b/extras/peer_add_secret_pub.in
@@ -53,6 +53,13 @@ if [ ! -d $authorized_keys_file ]; then
     chown $user: $authorized_keys_file;
 fi
 
+# Restore SELinux security contexts. This is required
+# for passwdless SSH to work.
+
+if type restorecon >/dev/null 2>&1; then
+    restorecon -F $ssh_dir $authorized_keys_file;
+fi
+
 # Add to authorized_keys file only if not exists already
 while read line
 do