diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index 0d695055ea..3bb00e7e4e 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -187,8 +187,8 @@ function local_user_set(& $user) {
$user_group = "nobody";
/* configure shell type */
- if (!hasPrivilegeShell($user)) {
- if (!hasPrivilegeCopyFiles($user))
+ if (!userHasPrivilege($user, "user-shell-access")) {
+ if (!userHasPrivilege($user, "user-copy-files"))
$user_shell = "/sbin/nologin";
else
$user_shell = "/usr/local/bin/scponly";
@@ -227,14 +227,17 @@ function local_user_set(& $user) {
/* create user directory if required */
if (!is_dir($user_home))
- mkdir($user_home, 0755);
+ mkdir($user_home, 0700);
chown($user_home, $user_name);
chgrp($user_home, $user_group);
- chmod($user_home, 0700);
- /* FIXME : ssh keys should be per-admin user */
- if(isset($config['system']['ssh']['sshdkeyonly']) && hasPrivilegeShell($user))
- create_authorized_keys($user_name, $user_home);
+ /* write out ssh authorized key file */
+ if($user['authorizedkeys']) {
+ if (!is_dir("{$user_home}/.ssh"))
+ mkdir("{$user_home}/.ssh", 0700);
+ $keys = base64_decode($user['authorizedkeys']);
+ file_put_contents("{$user_home}/.ssh/authorized_keys", $keys);
+ }
}
function local_user_del($user) {
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index da5bea6cdc..62a6a89130 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -1926,6 +1926,42 @@ endif;
$config['version'] = "5.2";
}
+ /* Convert 5.2 -> 5.3 */
+ if ($config['version'] <= 5.2) {
+
+ if (!is_array($config['system']['ca']))
+ $config['system']['ca'] = array();
+ if (!is_array($config['system']['cert']))
+ $config['system']['cert'] = array();
+
+ /* migrate advanced admin page webui ssl to certifcate mngr */
+ if ($config['system']['webgui']['certificate'] &&
+ $config['system']['webgui']['private-key']) {
+
+ /* create cert entry */
+ $cert = array();
+ $cert['refid'] = uniqid();
+ $cert['name'] = "webConfigurator SSL Certificate";
+ $cert['crt'] = $config['system']['webgui']['certificate'];
+ $cert['prv'] = $config['system']['webgui']['private-key'];
+ $config['system']['cert'][] = $cert;
+
+ /* create cert reference */
+ unset($config['system']['webgui']['certificate']);
+ unset($config['system']['webgui']['private-key']);
+ $config['system']['webgui']['ssl-certref'] = $cert['refid'];
+ }
+
+ /* migrate advanced admin page ssh keys to user manager */
+ if ($config['system']['ssh']['authorizedkeys']) {
+ $admin_user =& getUserEntryByUID(0);
+ $admin_user['authorizedkeys'] = $config['system']['ssh']['authorizedkeys'];
+ unset($config['system']['ssh']['authorizedkeys']);
+ }
+
+ $config['version'] = "5.3";
+ }
+
$now = date("H:i:s");
log_error("Ended Configuration upgrade at $now");
diff --git a/etc/inc/priv.inc b/etc/inc/priv.inc
index 89701aa099..824ea7bd55 100644
--- a/etc/inc/priv.inc
+++ b/etc/inc/priv.inc
@@ -279,20 +279,4 @@ function userHasPrivilege($userent, $privid = false) {
return true;
}
-function hasPrivilegeLock($userent) {
- return userHasPrivilege($userent, "user-lock-webcfg");
-}
-
-function hasPrivilegeLockPages($userent) {
- return userHasPrivilege($userent, "user-lock-ipages");
-}
-
-function hasPrivilegeShell($userent) {
- return userHasPrivilege($userent, "user-shell-access");
-}
-
-function hasPrivilegeCopyFiles($userent) {
- return userHasPrivilege($userent, "user-copy-files");
-}
-
?>
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 3b19b48da3..0a4c5d1f4a 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -496,72 +496,30 @@ function system_webgui_start() {
chdir($g['www_path']);
+ /* defaults */
+ $portarg = "80";
+ $crt = "";
+ $key = "";
+
/* non-standard port? */
if ($config['system']['webgui']['port'])
$portarg = "{$config['system']['webgui']['port']}";
- else
- $portarg = "";
if ($config['system']['webgui']['protocol'] == "https") {
- if(!$config['system']['webgui']['port'])
- $portarg = "443";
-
- if ($config['system']['webgui']['certificate'] && $config['system']['webgui']['private-key']) {
- $cert = base64_decode($config['system']['webgui']['certificate']);
- $key = base64_decode($config['system']['webgui']['private-key']);
- } else {
- /* default certificate/key */
- $cert = <<
One moment...redirecting to {$url} in 10 seconds.";
}
}
@@ -294,20 +272,6 @@ include("head.inc");
the DNS forwarder). They will not be assigned to DHCP and
PPTP VPN clients, though.