diff options
| author | orbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542> | 2008-05-20 09:29:01 +0000 |
|---|---|---|
| committer | orbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542> | 2008-05-20 09:29:01 +0000 |
| commit | 4229cd275c187ac13bff249bbec8c27b11d58562 (patch) | |
| tree | 5bf63629ae02375c391b6ff3b4bb4537e72d93da /htroot | |
| parent | d9d1c8de705ad2e001a002ff72f2499796ea7b59 (diff) | |
fixed several details about network switching, default password, random password and localhost authentification
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4830 6c8d7289-2bf4-0310-a012-ef5d649a1542
Diffstat (limited to 'htroot')
| -rw-r--r-- | htroot/ConfigAccounts_p.html | 4 | ||||
| -rw-r--r-- | htroot/ConfigAccounts_p.java | 38 | ||||
| -rw-r--r-- | htroot/ConfigNetwork_p.html | 1 | ||||
| -rw-r--r-- | htroot/ConfigNetwork_p.java | 24 |
4 files changed, 39 insertions, 28 deletions
diff --git a/htroot/ConfigAccounts_p.html b/htroot/ConfigAccounts_p.html index 52c4feef0..65365f1e1 100644 --- a/htroot/ConfigAccounts_p.html +++ b/htroot/ConfigAccounts_p.html @@ -24,7 +24,9 @@ ::
<p class="error">Username too short. Username must be >= 4 Characters.</p>
#(/error)# - + #(commitIntranetWarning)#::<div class="error">With an intranet indexing configuration it is not allowed to authentify automatically from localhost!</div>#(/commitIntranetWarning)# + #(passwordNotSetWarning)#::<div class="error">No password is set for the administration account. Please define a password for the admin account.</div>#(/passwordNotSetWarning)# + <fieldset><legend>Admin Account</legend> <form action="ConfigAccounts_p.html" method="post"> <fieldset> diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.java index 7a2ff7201..cc6855c0e 100644 --- a/htroot/ConfigAccounts_p.java +++ b/htroot/ConfigAccounts_p.java @@ -73,21 +73,43 @@ public class ConfigAccounts_p { String user = (post == null) ? "" : (String) post.get("adminuser", "");
String pw1 = (post == null) ? "" : (String) post.get("adminpw1", "");
String pw2 = (post == null) ? "" : (String) post.get("adminpw2", "");
- sb.setConfig("adminAccountForLocalhost", localhostAccess);
- // if an localhost access is configured, check if a local password is given
- // if not, set a random password
- if (post != null && localhostAccess && env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
- // make a 'random' password
- env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "0000" + serverCodings.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis()));
- env.setConfig("adminAccount", "");
- }
+
// may be overwritten if new password is given
if ((user.length() > 0) && (pw1.length() > 3) && (pw1.equals(pw2))) {
// check passed. set account:
env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(user + ":" + pw1)));
env.setConfig("adminAccount", "");
}
+
+ if (localhostAccess) {
+ if (sb.acceptLocalURLs) {
+ // in this case it is not allowed to use a localhostAccess option
+ prop.put("commitIntranetWarning", 1);
+ localhostAccess = false;
+ sb.setConfig("adminAccountForLocalhost", false);
+ } else {
+ sb.setConfig("adminAccountForLocalhost", true);
+ // if an localhost access is configured, check if a local password is given
+ // if not, set a random password
+ if (post != null && env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
+ // make a 'random' password
+ env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "0000" + serverCodings.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis()));
+ env.setConfig("adminAccount", "");
+ }
+ }
+ } else {
+ sb.setConfig("adminAccountForLocalhost", false);
+ if (env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").startsWith("0000")) {
+ // make shure that the user can still use the interface after a random password was set
+ env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "");
+ }
+ }
}
+
+ if (env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0 && !env.getConfigBool("adminAccountForLocalhost", false)) {
+ prop.put("passwordNotSetWarning", 1);
+ }
+
prop.put("localhost.checked", (localhostAccess) ? 1 : 0);
prop.put("account.checked", (localhostAccess) ? 0 : 1);
prop.put("statusPassword", localhostAccess ? "0" : "1");
diff --git a/htroot/ConfigNetwork_p.html b/htroot/ConfigNetwork_p.html index 9f2ec9624..35f112d68 100644 --- a/htroot/ConfigNetwork_p.html +++ b/htroot/ConfigNetwork_p.html @@ -50,6 +50,7 @@ #(commitRobinson)#::<div class="commit">For Robinson Mode, index distribution and receive is switched off.</div>#(/commitRobinson)# #(commitRobinsonWithRemoteIndexing)#::<div class="commit">This Robinson Mode switches remote indexing on, but limits targets to peers within the same cluster. Remote indexing requests from peers within the same cluster are accepted.</div>#(/commitRobinsonWithRemoteIndexing)# #(commitRobinsonWithoutRemoteIndexing)#::<div class="commit">This Robinson Mode does not allow any remote indexing (neither requests remote indexing, nor accepts it).</div>#(/commitRobinsonWithoutRemoteIndexing)# + #(commitPasswordWarning)#::<div class="error">With this configuration it is not allowed to authentify automatically from localhost! Please open the <a href="ConfigAccounts_p.html">Account Configuration</a> and set a new password.</div>#(/commitPasswordWarning)# <form name="NetworkForm" method="post" action="ConfigNetwork_p.html" enctype="multipart/form-data" accept-charset="UTF-8"> <fieldset> <legend> diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java index ed467b660..f3049be7e 100644 --- a/htroot/ConfigNetwork_p.java +++ b/htroot/ConfigNetwork_p.java @@ -29,8 +29,8 @@ import java.io.File; import java.util.HashSet; import de.anomic.http.httpHeader; +import de.anomic.http.httpd; import de.anomic.plasma.plasmaSwitchboard; -import de.anomic.plasma.plasmaWordIndex; import de.anomic.server.serverBusyThread; import de.anomic.server.serverCodings; import de.anomic.server.serverFileUtils; @@ -60,25 +60,11 @@ public class ConfigNetwork_p { } else { // shut down old network and index, start up new network and index commit = 1; - // pause crawls - boolean lcp = sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); - if (!lcp) sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); - boolean rcp = sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); - if (!rcp) sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); - // trigger online caution - sb.proxyLastAccess = System.currentTimeMillis() + 60000; // at least 1 minute online caution to prevent unnecessary action on database meanwhile - // switch the networks - synchronized (sb.webIndex) { - sb.webIndex.close(); - sb.setConfig("network.unit.definition", networkDefinition); - plasmaSwitchboard.overwriteNetworkDefinition(sb); - File indexPrimaryPath = sb.getConfigPath(plasmaSwitchboard.INDEX_PRIMARY_PATH, plasmaSwitchboard.INDEX_PATH_DEFAULT); - File indexSecondaryPath = (sb.getConfig(plasmaSwitchboard.INDEX_SECONDARY_PATH, "").length() == 0) ? indexPrimaryPath : new File(sb.getConfig(plasmaSwitchboard.INDEX_SECONDARY_PATH, "")); - sb.webIndex = new plasmaWordIndex(sb.getConfig("network.unit.name", ""), sb.getLog(), indexPrimaryPath, indexSecondaryPath); + sb.switchNetwork(networkDefinition); + // check if the password is given + if (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) { + prop.put("commitPasswordWarning", "1"); } - // start up crawl jobs again - if (lcp) sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); - if (rcp) sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); } } |
