changed log-in text for all servlets with authentication:

- added hint how to set the password using a shell script
- added a shell script to change the password
pull/1/head
Michael Peter Christen 13 years ago
parent 16b21f7a5b
commit 8b974905ee

@ -0,0 +1,4 @@
#!/bin/bash
cd "`dirname $0`"
./apicall.sh "/ConfigAccounts_p.html?setAdmin=&adminuser=admin&adminpw1=$1&adminpw2=$1&access=" > /dev/null
echo "Password for User Name 'admin' set to '$1'"

@ -95,7 +95,7 @@ public class Blog {
hasRights=true;
} else if (post.containsKey("login")) {
//opens login window if login link is clicked
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
}

@ -76,7 +76,7 @@ public class BlogComments {
hasRights = true;
} else if (post.containsKey("login")) {
//opens login window if login link is clicked
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
}

@ -126,7 +126,7 @@ public class Bookmarks {
if (post != null) {
if (!isAdmin) {
if(post.containsKey("login")){
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
} else if (post.containsKey("mode")) {
final String mode=post.get("mode");

@ -67,7 +67,7 @@ public class ConfigBasic {
final int authentication = sb.adminAuthenticated(header);
if (authentication < 2) {
// must authenticate
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop;
}

@ -45,7 +45,7 @@ public class ConfigParser {
if (post != null) {
if (!sb.verifyAuthentication(header)) {
// force log-in
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop;
}

@ -44,7 +44,7 @@ public class ConfigPortal {
// AUTHENTICATE
if (!sb.verifyAuthentication(header)) {
// force log-in
prop.putHTML("AUTHENTICATE","log-in");
prop.authenticationRequired();
return prop;
}

@ -94,12 +94,12 @@ public class CrawlResults {
if (authorization.length() != 0) {
if (! sb.verifyAuthentication(header)){
// force log-in (again, because wrong password was given)
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop;
}
} else {
// force log-in
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop;
}
}

@ -190,7 +190,7 @@ public class Network {
// AUTHENTICATE
if (!requestHeader.containsKey(RequestHeader.AUTHORIZATION)) {
prop.putHTML("AUTHENTICATE","log-in");
prop.authenticationRequired();
return prop;
}

@ -52,7 +52,7 @@ public class News {
if ((post.containsKey("deletespecific")) && (tableID >= 0)) {
if (sb.adminAuthenticated(header) < 2) {
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop; // this button needs authentication, force log-in
}
final Iterator<String> e = post.keySet().iterator();
@ -71,7 +71,7 @@ public class News {
if ((post.containsKey("deleteall")) && (tableID >= 0)) {
if (sb.adminAuthenticated(header) < 2) {
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop; // this button needs authentication, force log-in
}
try {

@ -74,7 +74,7 @@ public class Status
if ( post != null && post.size() > 0 ) {
if ( sb.adminAuthenticated(header) < 2 ) {
prop.put("AUTHENTICATE", "admin log-in");
prop.authenticationRequired();
return prop;
}
boolean redirect = false;

@ -51,7 +51,7 @@ public class Steering {
// handle access rights
if (!sb.verifyAuthentication(header)) {
Log.logInfo("STEERING", "log-in attempt for steering from " + requestIP);
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}

@ -72,7 +72,7 @@ public class Supporter {
String hash;
if ((post != null) && ((hash = post.get("voteNegative", null)) != null)) {
if (!sb.verifyAuthentication(header)) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
// make new news message with voting
@ -86,7 +86,7 @@ public class Supporter {
}
if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {
if (!sb.verifyAuthentication(header)) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
// make new news message with voting

@ -66,7 +66,7 @@ public class Surftips {
final boolean authorizedAccess = sb.verifyAuthentication(header);
if ((post != null) && (post.containsKey("publicPage"))) {
if (!authorizedAccess) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
publicPage = post.get("publicPage", "0").equals("1");
@ -79,7 +79,7 @@ public class Surftips {
String hash;
if ((post != null) && ((hash = post.get("voteNegative", null)) != null)) {
if (!sb.verifyAuthentication(header)) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
// make new news message with voting
@ -93,7 +93,7 @@ public class Surftips {
}
if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {
if (!sb.verifyAuthentication(header)) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
// make new news message with voting

@ -157,7 +157,7 @@ public class User{
}
//XXX: This should not be needed anymore, because of isLoggedout
if(! (requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
if(post.containsKey("returnto")){
prop.put("LOCATION", post.get("returnto"));

@ -139,7 +139,7 @@ public class ViewFile {
// it is therefore protected by the admin password
if (!sb.verifyAuthentication(header)) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}

@ -86,7 +86,7 @@ public class Wiki {
// only the administrator may change the access right
if (!sb.verifyAuthentication(header)) {
// check access right for admin
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
@ -105,7 +105,7 @@ public class Wiki {
if ((access.equals("admin") && (!sb.verifyAuthentication(header)))) {
// check access right for admin
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
@ -129,7 +129,7 @@ public class Wiki {
if (post != null && post.containsKey("edit")) {
if ((access.equals("admin") && (!sb.verifyAuthentication(header)))) {
// check access right for admin
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}

@ -36,7 +36,7 @@ public class add_p {
if (!isAdmin) {
// force authentication if desired
if(post.containsKey("login")){
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
return prop;
}

@ -18,7 +18,7 @@ public class delete_p {
if(!isAdmin){
// force authentication if desired
if(post.containsKey("login")){
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
return prop;
}

@ -27,7 +27,7 @@ public class getTag {
if (!isAdmin) {
// force authentication if desired
if(post.containsKey("login")){
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
}

@ -32,7 +32,7 @@ public class xbel {
if(post != null) {
if(!isAdmin) {
if(post.containsKey("login")) {
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
}
if(post.containsKey("tag")) {

@ -85,7 +85,7 @@ public class add_ymark {
prop.put("status", "0");
}
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -44,7 +44,7 @@ public class delete_ymark {
Log.logException(e);
}
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -84,7 +84,7 @@ public class get_metadata {
prop.put("status", "error");
}
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -256,7 +256,7 @@ public class get_treeview {
}
}
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -175,7 +175,7 @@ public class get_xbel {
prop.put("xbel", count);
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -91,7 +91,7 @@ public class get_ymark {
putProp(bookmarks, rp, page);
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -151,7 +151,7 @@ public class import_ymark {
}
} else if(post.containsKey("importer") && post.get("importer").equals("crawls")) {
if(!isAdmin) {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.ADMIN_AUTHENTICATE_MSG);
prop.authenticationRequired();
return prop;
}
try {
@ -178,7 +178,7 @@ public class import_ymark {
}
} else if(post.containsKey("importer") && post.get("importer").equals("bmks")) {
if(!isAdmin) {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.ADMIN_AUTHENTICATE_MSG);
prop.authenticationRequired();
return prop;
}
final Iterator<String> bit=sb.bookmarksDB.getBookmarksIterator(isAdmin);
@ -221,7 +221,7 @@ public class import_ymark {
}
}
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -80,7 +80,7 @@ public class manage_tags {
Log.logException(e);
}
} else {
prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);
prop.put(serverObjects.ACTION_AUTHENTICATE, YMarkTables.USER_AUTHENTICATE_MSG);
}
// return rewrite properties
return prop;

@ -23,7 +23,7 @@ public class ynetSearch {
if(!isAdmin){
// force authentication if desired
if(post.containsKey("login")){
prop.put("AUTHENTICATE","admin log-in");
prop.authenticationRequired();
}
return prop;
} else {

@ -55,7 +55,7 @@ public class index {
final boolean authorizedAccess = sb.verifyAuthentication(header);
if ((post != null) && (post.containsKey("publicPage"))) {
if (!authorizedAccess) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
}

@ -612,7 +612,7 @@ public class yacysearch {
if ( post != null && post.containsKey("deleteref") ) {
try {
if ( !sb.verifyAuthentication(header) ) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
@ -642,7 +642,7 @@ public class yacysearch {
// if a plus-button was hit, create new voting message
if ( post != null && post.containsKey("recommendref") ) {
if ( !sb.verifyAuthentication(header) ) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
final String recommendHash = post.get("recommendref", ""); // urlhash
@ -679,7 +679,7 @@ public class yacysearch {
// if a bookmarks-button was hit, create new bookmark entry
if ( post != null && post.containsKey("bookmarkref") ) {
if ( !sb.verifyAuthentication(header) ) {
prop.put("AUTHENTICATE", "admin log-in"); // force log-in
prop.authenticationRequired();
return prop;
}
final String bookmarkHash = post.get("bookmarkref", ""); // urlhash

@ -87,9 +87,7 @@ public class YMarkTables {
public final static String FOLDERS_ROOT = "/";
public final static String BOOKMARKS_LOG = "BOOKMARKS";
public final static String USER_ADMIN = "admin";
public final static String USER_AUTHENTICATE = "AUTHENTICATE";
public final static String USER_AUTHENTICATE_MSG = "Bookmark user authentication required!";
public final static String ADMIN_AUTHENTICATE_MSG = "Admin authentication required!";
public final static String p1 = "(?:^|.*,)";
public final static String p4 = "(?:,.*|$)";

@ -342,7 +342,7 @@ public final class HTTPDFileHandler {
serverCore.bfHost.put(clientIP, Integer.valueOf(attempts.intValue() + 1));
final ResponseHeader responseHeader = getDefaultHeaders(path);
responseHeader.put(RequestHeader.WWW_AUTHENTICATE,"Basic realm=\"admin log-in\"");
responseHeader.put(RequestHeader.WWW_AUTHENTICATE, "Basic realm=\"" + serverObjects.ADMIN_AUTHENTICATE_MSG + "\"");
final servletProperties tp=new servletProperties();
tp.put("returnto", path);
HTTPDemon.sendRespondError(conProp, out, 5, 401, "Wrong Authentication", "", new File("proxymsg/authfail.inc"), tp, null, responseHeader);

@ -66,6 +66,10 @@ import net.yacy.search.Switchboard;
public class serverObjects extends HashMap<String, String> implements Cloneable {
public static final String ACTION_AUTHENTICATE = "AUTHENTICATE";
public static final String ACTION_LOCATION = "LOCATION";
public final static String ADMIN_AUTHENTICATE_MSG = "admin log-in. If you don't know the password, set it with {yacyhome}/bin/passwd.sh {newpassword}";
private final static Pattern patternNewline = Pattern.compile("\n");
private final static Pattern patternDoublequote = Pattern.compile("\"");
private final static Pattern patternSlash = Pattern.compile("/");
@ -91,6 +95,10 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
super(input);
}
public void authenticationRequired() {
this.put(ACTION_AUTHENTICATE, ADMIN_AUTHENTICATE_MSG);
}
private static final String removeByteOrderMark(final String s) {
if (s == null || s.length() == 0) return s;
if (s.charAt(0) == BOM) return s.substring(1);

@ -27,9 +27,6 @@ public class servletProperties extends serverObjects {
private static final long serialVersionUID = 1L;
public static final String ACTION_AUTHENTICATE = "AUTHENTICATE";
public static final String ACTION_LOCATION = "LOCATION";
public static final String PEER_STAT_VERSION = "version";
public static final String PEER_STAT_UPTIME = "uptime";
public static final String PEER_STAT_MYTIME = "mytime";

Loading…
Cancel
Save