diff --git a/htroot/Network.html b/htroot/Network.html index c2cc72be1..75c1bb988 100644 --- a/htroot/Network.html +++ b/htroot/Network.html @@ -28,6 +28,8 @@

Passive Peers

::

Potential Peers

+:: +

Manually contacting Peer

#(/page)#

#(table)# @@ -173,6 +175,28 @@ To do this, press this button: #(/comment)#

+:: +

+#(comment)# +:: +#[status]# +:: +#[status]# +

+

+#[details]# +

+#(/comment)# +

+
+ + + + + + +
Peer Hash
Peer IP
Peer Port
 
+
#(/table)# #[footer]# diff --git a/htroot/Network.java b/htroot/Network.java index b95364419..331530dd2 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -44,11 +44,13 @@ // if the shell's current path is HTROOT import java.util.Enumeration; +import java.util.HashMap; import de.anomic.http.httpHeader; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.server.serverDate; +import de.anomic.yacy.yacyClient; import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacySeed; @@ -141,7 +143,47 @@ public class Network { } prop.put("table", 2); // triggers overview prop.put("page", 0); - } else { + } else if (Integer.parseInt(post.get("page", "1")) == 4) { + prop.put("table", 4); // triggers overview + prop.put("page", 4); + + if (post.containsKey("addPeer")) { + + // AUTHENTICATE + if (!header.containsKey(httpHeader.AUTHORIZATION)) { + prop.put("AUTHENTICATE","log-in"); + return prop; + } + + + HashMap map = new HashMap(); + map.put("IP",(String) post.get("peerIP")); + map.put("Port",(String) post.get("peerPort")); + yacySeed peer = new yacySeed((String) post.get("peerHash"),map); + + int added = yacyClient.publishMySeed(peer.getAddress(), peer.hash); + + if (added < 0) { + prop.put("table_comment",1); + prop.put("table_comment_status","publish: disconnected peer '" + peer.getName() + "/" + post.get("peerHash") + "' from " + peer.getAddress()); + } else { + peer = yacyCore.seedDB.getConnected(peer.hash); + prop.put("table_comment",2); + prop.put("table_comment_status","publish: handshaked " + peer.get("PeerType", "senior") + " peer '" + peer.getName() + "' at " + peer.getAddress()); + prop.put("table_comment_details",peer.toString()); + } + + prop.put("table_peerHash",(String) post.get("peerHash")); + prop.put("table_peerIP",(String)post.get("peerIP")); + prop.put("table_peerPort",(String) post.get("peerPort")); + } else { + prop.put("table_peerHash",""); + prop.put("table_peerIP",""); + prop.put("table_peerPort",""); + + prop.put("table_comment",0); + } + }else { // generate table int page = Integer.parseInt(post.get("page", "1")); int conCount = 0; diff --git a/htroot/SettingsAck_p.html b/htroot/SettingsAck_p.html index 2a747f607..5d3d9fa47 100644 --- a/htroot/SettingsAck_p.html +++ b/htroot/SettingsAck_p.html @@ -31,16 +31,14 @@ Your new administration account name is #[user]#. The password has been accepted Your proxy access setting has been changed.
Your proxy account check has been disabled, since you did not supply a password.

The new proxy IP filter is set to #[filter]#
-The proxy port is: #[port]#
-Port Forwarding is: #[portForwardingEnabled]#

+The proxy port is: #[port]#

if you changed the Port or Port Forwarding Settings, you need to restart YaCy. :: Your proxy access setting has been changed.
Your new proxy account name is #[user]#. The password has been accepted.
If you open any public web page through the proxy, you must log-in then.

The new proxy IP filter is set to #[filter]#.
-The proxy port is: #[port]#
-Port Forwarding is: #[portForwardingEnabled]#

+The proxy port is: #[port]#

if you changed the Port or Port Forwarding Settings, you need to restart YaCy. :: Your server access filter is now set to #[filter]#
@@ -116,6 +114,31 @@ Seed Upload method was changed successfully. #[msgForwardingTo]# +:: +

Your port forwarding settings have been changed.

+ + + + + + + + + + + + + + + + + +
Port Forwarding Support is:#[portForwardingEnabled]#
Port Forwarding Port:#[portForwardingPort]#
Port Forwarding Host:#[portForwardingHostUser]#@#[portForwardingHost]#:#[portForwardingHostPort]#
Port Forwarding uses proxy:#[portForwardingUseProxy]#
+:: +

Port Forwarding Settings changed, but something is wrong.

+

#[errormsg]#

+Port Forwarding was deactivated automatically.
+Please return to the settings page and modify the data.
#(/info)#

You can now go back to the Settings page if you want to make more changes.

diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java index 62aa87a5b..171b67fdf 100644 --- a/htroot/SettingsAck_p.java +++ b/htroot/SettingsAck_p.java @@ -53,13 +53,17 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import org.apache.commons.pool.impl.GenericObjectPool; + import de.anomic.http.httpHeader; import de.anomic.http.httpd; import de.anomic.http.httpdProxyHandler; import de.anomic.plasma.plasmaSwitchboard; import de.anomic.server.serverCodings; +import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; +import de.anomic.server.serverThread; import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacySeed; import de.anomic.yacy.yacySeedUploader; @@ -131,14 +135,6 @@ public class SettingsAck_p { env.setConfig("port", port); prop.put("info_port", port); - // port forwarding configuration - env.setConfig("portForwardingEnabled", post.containsKey("portForwardingEnabled")?"true":"false"); - env.setConfig("portForwardingHost", (String)post.get("portForwardingHost")); - env.setConfig("portForwardingPort", (String)post.get("portForwardingPort")); - env.setConfig("portForwardingUser", (String)post.get("portForwardingUser")); - env.setConfig("portForwardingPwd", (String)post.get("portForwardingPwd")); - prop.put("info_portForwardingEnabled",post.containsKey("portForwardingEnabled")?"on":"off"); - // read and process data String filter = (String) post.get("proxyfilter"); String user = (String) post.get("proxyuser"); @@ -194,6 +190,48 @@ public class SettingsAck_p { return prop; } + // port forwarding configuration + if (post.containsKey("portForwarding")) { + env.setConfig("portForwardingEnabled", post.containsKey("portForwardingEnabled")?"true":"false"); + env.setConfig("portForwardingUseProxy",post.containsKey("portForwardingUseProxy")?"true":"false"); + env.setConfig("portForwardingPort", (String)post.get("portForwardingPort")); + + env.setConfig("portForwardingHost", (String)post.get("portForwardingHost")); + env.setConfig("portForwardingHostPort",(String)post.get("portForwardingHostPort")); + env.setConfig("portForwardingHostUser",(String)post.get("portForwardingHostUser")); + env.setConfig("portForwardingHostPwd", (String)post.get("portForwardingHostPwd")); + + // trying to reconnect the port forwarding channel + try { + serverCore httpd = (serverCore) env.getThread("10_httpd"); + if ((serverCore.portForwardingEnabled) && (serverCore.portForwarding != null)) { + // trying to shutdown the current port forwarding channel + serverCore.portForwarding.disconnect(); + } + // trying to reinitialize the port forwarding + httpd.initPortForwarding(); + + // notifying publishSeed Thread + serverThread peerPing = env.getThread("30_peerping"); + peerPing.notifyThread(); + } catch (Exception e) { + prop.put("info", 23); + prop.put("info_errormsg",(e.getMessage() == null) ? "unknown" : e.getMessage().replaceAll("\n","
")); + return prop; + } + + prop.put("info", 22); + prop.put("info_portForwardingEnabled", post.containsKey("portForwardingEnabled")?"on":"off"); + prop.put("info_portForwardingUseProxy",post.containsKey("portForwardingUseProxy")?"on":"off"); + prop.put("info_portForwardingPort", (String)post.get("portForwardingPort")); + prop.put("info_portForwardingHost", (String)post.get("portForwardingHost")); + prop.put("info_portForwardingHostPort",(String)post.get("portForwardingHostPort")); + prop.put("info_portForwardingHostUser",(String)post.get("portForwardingHostUser")); + prop.put("info_portForwardingHostPwd", (String)post.get("portForwardingHostPwd")); + return prop; + } + + // server password if (post.containsKey("serveraccount")) { // read and process data diff --git a/htroot/Settings_p.html b/htroot/Settings_p.html index 7462df4db..12ee04ed8 100644 --- a/htroot/Settings_p.html +++ b/htroot/Settings_p.html @@ -30,12 +30,16 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold downHTTP Networking - downMessage Forwarding + downMessage Forwarding (optional) downRemote Proxy (optional) downContent Parser Settings + + downPort Forwarding (optional) +   +

@@ -64,7 +68,7 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold

- +
Peer Name:Peer Name: Your peer name defines also a new '.yacy' - domain, which can be accessed from every peer running this proxy. Using your 'Home Page' and 'File Share' - zones you also have a platform to provide content to your new domain.
@@ -97,40 +101,6 @@ All traffic is routed throug one single port, for both proxy and server.
- -

Port Forwarding

-You can use a remote server running a ssh demon to forward your server/proxy port. -This is useful if you want to tunnel throug a NAT/router. -Alternatively, you can simply set a virtual server port on your NAT/Server to enable connections from outside. - - - - - - - - - - - - - - - - - - - - - - - - - - -
Enable port forwarding:Feature currently not available. 
Forwarding host: 
Forwarding port: 
Remote host user: 
Remote host password: 
-

-

Server Access Restrictions

You can restrict the access to this proxy/server using a two-stage security barrier: