Remote port forwarding inside Docker containers

I’m trying to setup a docker container that I use to bypass firewalls/NAT’s to allow SSH access to the computers behind these routing barriers. In essence, I have an SSH service listening inside of a docker container, that my other computers connect to, opening a reverse-SSH port forwarding, and then if I want to connect to a computer behind a firewall, I instead connect to my dockerized proxy server on the reverse port. Example:

Firewalled computer “Bob” connects to proxy server:

ssh -R 2024:localhost:22 -N remote.server

Next, I connect to the remote server on port 2024 so as to follow the tunnel back down and connect to localhost:22 on bob:

ssh -p 2024 remote.server

This all works great when it’s not dockerized, however when I tried to move this to a dockerized service, I found that my sshd server within the docker container stubbornly refuses to open remote port forwards. Connecting with ssh -vvv in the first step above gives:

...
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 4
debug1: Remote: Server has disabled port forwarding.
debug3: receive packet: type 82
debug1: remote forward failure for: listen 2024, connect localhost:22
Warning: remote port forwarding failed for listen port 2024
debug1: All remote forwarding requests processed

Which sounds a lot like my sshd isn’t setup to allow remote port forwarding. However, my sshd_config seems to think it is:

# tail /etc/ssh/sshd_config -n 5
GatewayPorts yes
AllowTcpForwarding yes
AllowStreamLocalForwarding yes
PermitTunnel yes
UsePrivilegeSeparation no

Indeed, running with ssh -ddd inside the docker container, then connecting with the line above shows first:

debug3: /etc/ssh/sshd_config:91 setting GatewayPorts yes
debug3: /etc/ssh/sshd_config:92 setting AllowTcpForwarding yes
debug3: /etc/ssh/sshd_config:93 setting AllowStreamLocalForwarding yes
debug3: /etc/ssh/sshd_config:94 setting PermitTunnel yes
debug3: /etc/ssh/sshd_config:95 setting UsePrivilegeSeparation no

Followed by:

debug1: server_input_global_request: rtype tcpip-forward want_reply 1
debug1: server_input_global_request: tcpip-forward listen localhost port 2024
debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0

So clearly my configuration is being set correctly, but it seems that the client still thinks the server cannot do port forwarding. How can I convince the openssh server to perform remote forwarding? What could cause this failure?

The client is running OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, the server is running OpenSSH_6.7p1 Debian-5+deb8u4, the docker version is 17.09.1-ce on Amazon Linux 2017.09.

Thanks!

Can I embed fonts inside a document in Microsoft Word for Mac?

I want to save my Word doc so that all of the fonts are embedded.

This is so that it will look somewhat similar across when accessed on someone else’s machine.

(I would prefer to use a PDF, but the people I’m supplying documents to wish to only use Word.)

I know that there’s an option in Word for Windows to Embed TrueType Fonts (inside Tools > Options > Save).

But there doesn’t seem to be an equivalent in Word for Mac. (I’ve tried looking in Word > Preferences > Save.)

Is it possible to do this at all in Word for Mac?

Selecting lines with start and end points inside polygons but do not cross them with PostGIS

After trying several ways of selecting those lines, I can’t seem to find any kind of solution. So, I have two tables

  1. network : lines forming a network containing source (id of node) and target (id of node).
  2. nodes : the network nodes.
  3. cities : well, cities… contains also the id of the closest node.

For now, the query I’m building calculate the shortest way between each cities of a certain importance. But I want to get rid of the ways that are passing near other cities. A picture will probably be clearer (sorry, paint, you know…) :

enter image description here

Black dots are nodes affected to a city, and red is a buffer of x metres.
Basically, I need a way to keep the blue one and the orange one and get rid of the green one. The blue and orange lines connects two city nodes, the green one connects two city nodes as well but also cross the buffer of an other city.

I’ve tried several ways but it just won’t return the right results.
dijkstra temp table contains merged lines according to source and target nodes.
citynodesbuffer contains buffers around nodes that are associated with a city.

CREATE TABLE graphtest AS (
WITH dijkstra AS (SELECT DISTINCT start_vid, end_vid, (ST_Dump(ST_LineMerge(ST_Collect(net.geom)))).geom
    FROM pgr_dijkstra('SELECT id, source, target, cost FROM network',
        array(SELECT id_node FROM network_cities WHERE importance < 2),
        array(SELECT id_node FROM network_cities WHERE importance < 2), FALSE) as dij
    INNER JOIN network net
        ON dij.edge = net.id
    GROUP BY start_vid, end_vid),
citynodesbuffer AS (SELECT ST_Buffer(nd.geom, 0.020) as geom
    FROM network_nodes nd, network_cities ct
    WHERE nd.id = ct.id_node)
SELECT DISTINCT dij.start_vid, dij.end_vid, ST_Difference(dij.geom, cn.geom) FROM dijkstra dij, citynodesbuffer cn
WHERE GeometryType(ST_Difference(dij.geom, cn.geom)) = 'LINESTRING');

This query, apart from being a waste of resources, returns all input lines, just like if ST_Difference didn't make any... differences.

An other.

CREATE TABLE graphtest AS (
WITH dijkstra AS (SELECT DISTINCT start_vid, end_vid, (ST_Dump(ST_LineMerge(ST_Collect(net.geom)))).geom
    FROM pgr_dijkstra('SELECT id, source, target, cost FROM network',
        array(SELECT id_node FROM network_cities WHERE importance < 2),
        array(SELECT id_node FROM network_cities WHERE importance < 2), FALSE) as dij
    INNER JOIN network net
        ON dij.edge = net.id
    GROUP BY start_vid, end_vid),
citynodesbuffer AS (SELECT ST_Buffer(nd.geom, 0.020) as geom
    FROM network_nodes nd, network_cities ct
    WHERE nd.id = ct.id_node)
SELECT DISTINCT dij.start_vid, dij.end_vid, ST_Difference(dij.geom, cn.geom) FROM dijkstra dij, citynodesbuffer cn
WHERE (ST_Intersects(ST_StartPoint(dij.geom), cn.geom) AND ST_Intersects(ST_EndPoint(dij.geom), cn.geom))
--the line above is not really useful
AND NOT EXISTS (SELECT FROM citynodesbuffer cn2 WHERE ST_Crosses(dij.geom, cn2.geom)));

Worst, this one returns nothing, I guess this is because of ST_Crosses which eliminate every lines but I had hope concerning this function.

Make commas not italicized inside a macro using textit

I’m trying to set up a shortcut for writing semantic types. These are usually written inside $langle$ and $rangle$ delimiters, with italicized letters standing for each type and commas separating these. They should look something like this:

enter image description here

I’ve come up with a macro like the following:

newcommand{type}[1]{%
    $langle$textit{#1}$rangle$%
}

However, this of course results in the commas being italicized, too, which is not usually done in this context:

enter image description here

Is there a way to exclude commas from being italicized when using this command?

MWE:

documentclass{article}

newcommand{type}[1]{%
    $langle$textit{#1}$rangle$%
}

begin{document}
    type{e, t}
end{document}

Force on a charge kept inside a Conducting hollow sphere

A thin, metallic spherical shell contains a charge Q on it. A point charge q is placed at the centre of the shell and another charge q’ is placed outside it. All the three charges are positive. The net force on the charge at the centre and the force due to shell on this charge is?
According to me the force on the central charge will be due to outside charge q’ plus the force due to the shell. Now the force due to outside charge is 0 due to electrostatic shielding. Besides, the force due to shell can be seen in a two tier way. In accordance with gauss law the inner surface of the shell must have been induced with – q charge and the charge remaining on outer surface would be Q+q.This Q+q charge would be distributed non uniformly due to presence of q’. So force on q due to the shell can be Seen as force due to two shells with charge – q distributed uniformly on one and Q+q distributed non uniformly on the other. The field due to these shells in the interior is 0 as can be explained by gauss law.So the final answer I arrive on is 0 in both the cases. But this is only correct for the first part as force on q due to shell is towards right if the centre of the shell is positioned at (0,0,0).
I have explained my approach at length and think that I have got a problem with my concepts with regards to conductors. Any help would greatly be appreciated.

aura:if inside aura:iteration

I want to conditionally render each item in an iterating list. It has to check if each contact in the iterating list is included/contains in another list of contacts. How should I approach ?

Component


  
  
  

   
        
{!ctct.Contact.FirstName}

Controller

 doInit : function(component,event,helper){
   var secondContactList= component.get("v.wspContact");
   var firstContactList = component.get("v.contactList");
   for(var i=0; i

Like shown below, I need to identify the already evaluated contact item and its corresponding button needs to be changed.
Iterating List

How to make Gvim run output shell commands inside split/inner terminal

Sometimes Gvim uses cmd.exe and terminal pop up or blinks in few miliseconds as a external window. How to force Gvim to use internal terminal in split? This behaviour causes anoying blinking or distracts because of output in external windows.
It is visible while updating plugins (Plug) or while using some commands :Man ls

What does Gulzar actually mean by saying that Earth can hide a river inside?

The poem “The Magical Earth” by Gulzar (from Green Poems, 2014) contains these lines (in the English translation by Pavan K. Varma):

There is something indeed in the earth of my garden
Is this earth magical?
The earth knows how to do magic!

[…]

A sherbet, or milk, or water
Anything may fall, it absorbs them all
How much water does it drink?!
It gulps down whatever you give
Be it from a jug or a bucket
Amazingly, its stomach never fills
I have heard that it can even hide a river inside!
The earth knows how to do magic!

What does it poetically mean that earth can hide a river inside? Better give a summary of the poetic non literal lines in the poem “The Magical Earth”.

Calling a smart contract function inside another in web3

Here is my code Sample in js script connected to ContractInstance through web3:

ContractInstance.Fire(function(error,res){
   if(!error){ContractInstance.dead.call(function(err, result){
              console.log(result);});}
             });

ContractInstance.dead.call(function(err, result){
                  console.log(result) });
  • So when I call fire function of contract then my dead variable
    changes to true (I confirm it in remix )
  • And then I call dead variable inside Fire function.
  • Somehow it prints false in the console, but later when I call it
    outside the function it prints true.

I don’t know why this is happening maybe because

  • when I call fire function it stops for a while because metamask asks
    for confirmation .

  • or it might be due to the fact that it does not update in the
    contract so quickly.

Can somebody help me how should I call dead variable just after the the fire function is called ?