# \[ANNOUNCE\]node-red-contrib-xterm : second beta (sidebar)

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718>\
**Category:** Share Your Nodes\
**Created:** [30 December 2019 00:16 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718 "2019-12-30T00:16:47Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [1 January 2020 11:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/41 "2020-01-01T11:52:54Z")

</div>

> [@nodecentral](#):
>
> One feature I am looking for is the ability to ssh onto another device on my network and run commands on that, could xterm do that ?

Nope that is currently not possible.  
Currently this sidebar ensures that there is only a **single** config node available under the hood, where all the settings (from the '_Settings_' tabsheet) are stored:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/0bbfeb0043c8a1eb3cafb5bd7feb1a0919298c45.png)

In your proposal you would need to have a config node per IP address. And then in the "_Terminal_" tabsheet, there should be a dropdown on top where you can add/select/remove config nodes. And then - when the "_Start_" button is pressed - it should connect to the selected IP address. But it now works closely together with my http admin endpoint. And you won't have that endpoint on other servers, unless Node-RED and my node would be installed there. Otherwise my node should be designed to communicate in another way...

But even if that all would be redesigned, then it sounds to me more like [distributed Node-RED editor](https://github.com/namgk/dnr-editor) related stuff...

So that is why it is currently not possible, and it will probably never be redesigned...

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 January 2020 12:01 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/42 "2020-01-01T12:01:05Z")

</div>

> [@BartButenaers](#):
>
> QUESTION: By talking about security, _ **I am now wondering if my httpAdmin endpoint is secured enough** _ :
> 
> ```auto
> RED.httpAdmin.get('/xterm_shell/:terminal_id/:command/:info', function(req, res) {
> 
> ```
> 
> Or should I do something special for **permissions** , to avoid that everybody can call the endpoint?

That endpoint has _absolutely no security_ applied to it. Anyone can access it regardless of how they have configured adminAuth.

You need to add the `needsPermission` middleware with a `write` permission if it should only be accessed by users with full write access.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [1 January 2020 12:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/43 "2020-01-01T12:53:46Z")

</div>

> [@BartButenaers](#):
>
> Nope that is currently not possible.  
> Currently this sidebar ensures that there is only a **single** config node available under the hood, where all the settings (from the ' _Settings_ ' tabsheet) are stored:

Ummm, I just did it. Runing NR on my mac, opened the terminal in NR and ssh'd into one of my pi's

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [1 January 2020 13:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/44 "2020-01-01T13:12:19Z")

</div>

> [@greenembrace](#):
>
> The only thought I have about all users is that each command has a unique PID and all sub process of that command are linked to this. Therefore each user would generate there own unique PID which could be filtered.

Had been thinking about something similar, but not sure whether it will be useful.  
Each sidebar tabsheet has its own unique terminal id, which I use to make sure that the (input and output) data is communicated between each terminal window and the corresponding pseudo terminal process correctly. The server stores the routing information in a map:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d65e5079b3645108bb19630d20f047e27ff78123.png)

Suppose I implemented the following changes:

- add an output to the Terminal-Input node
- include the PID and/or the terminal Id in the output messages
- show the PID and terminalId (both readonly) in the sidebar.

But then you still need to copy/past the PID and/or the terminal Id in your switch node and deploy your flow to filter your own messages:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f684b833095d0b5b406c6b5cca680056a43467f5.png)

But then \*other users won't see their own messages anymore. Therefore I'm still not convinced that this is very useful in a multi-user environment. But perhaps I'm completely wrong ... And perhaps I could add it for single-user environments? Because most of the users are using it for small systems ...

> [@knolleary](#):
>
> You need to add the `needsPermission` middleware with a `write` permission if it should only be accessed by users with full write access.

Ok thanks Nick! Was not sure whether that was enough to secure an endpoint ...  
The version on Github now contains this:

```auto
RED.httpAdmin.get('/xterm_shell/:terminal_id/:command/:info', RED.auth.needsPermission('xterm.write'), function(req, res) {

```

And now it still seems to be working on my Raspberry.

> [@zenofmud](#):
>
> Ummm, I just did it. Runing NR on my mac, opened the terminal in NR and ssh'd into one of my pi's

Ah ok. That way. Might be indeed handy. Can you post some more details, then I add it afterwards on my readme page. Thanks !!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [1 January 2020 13:24 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/45 "2020-01-01T13:24:00Z")

</div>

1. add a `xterm_ln` node and add ssh details - in my case I used `ssh pi@yellowpi.local`
2. added another `xterm_ln` node with `ls'
3. start the xterm running and I see:  
 ![Screen Shot 2020-01-01 at 8.16.20 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e8ad09cc1b99896a08315fae23b7470c80e940e7.png)
4. Press the 'ssh' xterm and see :  
 ![Screen Shot 2020-01-01 at 8.16.30 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/0f6fd2abe0697d61b8530e908185cb37a1600126.png)
5. enter the password in the xterm window:  
 ![Screen Shot 2020-01-01 at 8.16.50 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3d3a90bdd92655df8c92465383d8dffb69c006b0.png)
6. press the 'ls' xterm and get:  
 ![Screen Shot 2020-01-01 at 8.16.59 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e94d0ea50d7837d134d9176cf1d0cc7a698e9123.png)

Just for the heck of it, I then SSH back to my Mac and got in with no problem!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 January 2020 16:01 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/46 "2020-01-01T16:01:02Z")

</div>

> [@BartButenaers](#):
>
> Should this be like this or something else?

Yes. The permissions are sort of documented [here](https://nodered.org/docs/user-guide/runtime/securing-node-red#user-permissions) though not with any detail. With the example you give, an `adminAuth` authenticated user with the `permissions` `"read"` would, I believe, have access as they would if you gave them `permissions` containing `"xterm.read"`. Since "read" was one of the original simple permissions, you could give a more specific permission such as 'xterm.write' (`write` was not one of the earlier simplistic permissions and so less likely to be accidentally assumed).

> [@BartButenaers](#):
>
> But digging into that further is unfortunately at the moment not possible in my limited spare time.

I don't blame you. I've been looking into these things on and off for several years now and I still don't believe that I understand them properly!! The perils of not being a full-time developer perhaps.

In regard to Node-RED websocket security. I'd forgotten about the setting `webSocketNodeVerifyClient` so I started some testing on that since I can't find any useful documentation.

Unfortunately, I've not yet managed to get that function to trigger at all - perhaps someone else can shed some light? Here is the relevant section of my settings.js file:

```auto
    // The following property can be used to verify websocket connection attempts.
    // This allows, for example, the HTTP request headers to be checked to ensure
    // they include valid authentication information.
    webSocketNodeVerifyClient: function(info) {
        console.log('WEBSOKCETNODEVERIFYCLIENT: ', info)

        // 'info' has three properties:
        // - origin : the value in the Origin header
        // - req : the HTTP request
        // - secure : true if req.connection.authorized or req.connection.encrypted is set
        //
        // The function should return true if the connection should be accepted, false otherwise.

        return true
    },

```

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [4 January 2020 17:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/47 "2020-01-04T17:52:59Z")

</div>

@ghayne, @cymplecy,

@zenofmud just reported to me that he gets a popup, the first time he clicks the "_Start_" button:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1b9a4adca9f3187cda987cc73111fddb86c4c2f4.png)

Which is not what I had expected. Do you guys also get that popup or not?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [4 January 2020 17:55 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/48 "2020-01-04T17:55:20Z")

</div>

No popup.  
 ![Peek 2020-01-01 14-19](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/84e9a1a928e6ab2dd02e77e0350d290e3e0f786c.gif)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [4 January 2020 17:55 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/49 "2020-01-04T17:55:58Z")

</div>

> [@BartButenaers](#):
>
> npm install bartbutenaers/node-red-contrib-xterm

Just installed it and yep

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/336527cfd83d2e7918a9342b38de7ee83cb23762.png)

Fine the second time I launched it (as usual)

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [4 January 2020 19:02 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/50 "2020-01-04T19:02:53Z")

</div>

I’m noticing a difference. In the screenshots with the message there were undeployed changes. The one Garry showed hadn’t. Could that be the difference? Worth testing out. I know that message, I’ve seen it when doing things like closing the tab or going to another web address with undeployed changes. Is the document.location modified anywhere by chance?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 January 2020 19:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/51 "2020-01-04T19:53:48Z")

</div>

I'm sort of seeing something similar... in that it only starts at the second attempt.  
At the first attempt, the node-RED screen appears to refresh, and the sidebar returns to 'info'.  
Attempt number 2 means pressing the start button again.  
There doesn't seem to be anything reported in the NR log, or browser tools.

However, I wasn't sure if it was your most current node version, so I npm uninstalled it, and again installed it (to ensure I'd got the latest), but after a restart, I couldn't get node-RED to load in my browser, just the continual loading gif. There was no errors in the NR log, and yes I did clear my cache & tried incognito.  
I've again uninstalled the node & NR has started normally again, but I haven't got chance tonight to look into it further.

_Attached: youtube video_

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 January 2020 20:24 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/52 "2020-01-04T20:24:31Z")

</div>

This is all done in a empty flow - i.e. there are no nodes added to it.

If you install the node (cli) and start NR then start Xterm, you get the Popup AND deploy goes RED. If you deploy, a configuration node is created and if you stop/start NR then start xterm, the popup does not show up.

If you go to "Manage Palette" you can not remove the node because it is 'in use' because of the configuration node.

If you delete the configuration node, stop/start NR the popup will show up again.

If you don't delete the configuration node and exit NR and remove the node (cli) then start NR again you will see a NR warning:  
 ![Screen Shot 2020-01-04 at 3.20.41 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3dc6273e5e0d352385ef2388a98c654538297860.png)  
and in the log you will see:

```auto
4 Jan 20:19:35 - [info] Waiting for missing types to be registered:
4 Jan 20:19:35 - [info] - xterm_config

```

(remember that configuration node??)

And if you go to the 'Configuration nodes' tab, you will see an orphaned xterm\_config node.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 January 2020 20:28 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/53 "2020-01-04T20:28:23Z")

</div>

> [@zenofmud](#):
>
> If you don't delete the configuration node and exit NR and remove the node (cli) then start NR again you will see a NR warning

Yes Paul, I got the same, and also had to delete the node config myself.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [4 January 2020 20:35 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/54 "2020-01-04T20:35:17Z")

</div>

Thanks for all feedback!!!  
Well I think that is normal behaviour. There should always be 1 config node, where I have store the terminal settings. For every action, the sidebar panel will check whether the config node is available:

1. When 1 config node available, that will be used.
2. When 0 config nodes available, then one will be created.
3. When \>1 config node available, then the others will be deleted.

So a lot is going on behind the scenes. But due to those changes, the 'Deploy' button will become active...

Just found out that in Firefox I can reproduce part of those problems: my tabsheets close. So that is at least a point to start my search. Will come back here when I have more news, or more questions ...

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 January 2020 20:38 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/55 "2020-01-04T20:38:13Z")

</div>

> [@BartButenaers](#):
>
> Just found out that in Firefox I can reproduce part of those problems: my tabsheets close

I'm using google chrome browser.

> [@BartButenaers](#):
>
> Well I think that is normal behaviour

It doesn't seem normal to me. Usually when you have an orphaned config node, you get a message saying so. This produces a `Flows stopped due to missing node types` message.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [4 January 2020 20:39 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/56 "2020-01-04T20:39:59Z")

</div>

> [@Paul-Reed](#):
>
> I'm using google chrome browser.

Yes, me too but that works fine here ...

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [4 January 2020 20:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/58 "2020-01-04T20:52:30Z")

</div>

> [@Paul-Reed](#):
>
> It doesn't seem normal to me. Usually when you have an orphaned config node, you get a message saying so. This produces a `Flows stopped due to missing node types` message.

Well I might have misunderstood the concept of the sidebar panels, since this is an undocumented API. But if you look at the code of the few existing side panel repositories, you will notice something like this:

```auto
globalTerminalConfigNode = {
    ...
    hasUsers: false, 
    users: [],
    ...
}

```

I have interpreted like this: since this config node is dynamically created and only used in this sidebar ( **which isn't a node!!!!** ), the config node is in fact "unused". But since we don't want it to appear "unused" in the "config nodes" panel, we need to set `hasUsers` to false (see [node-red/CHANGELOG.md at master · node-red/node-red · GitHub](https://github.com/node-red/node-red/blob/master/CHANGELOG.md#0161-maintenance-release)). Otherwise it would be removed automatically when a user removes all unused nodes.

So I 'think' you cannot simply compare the behaviour to the config nodes of normal nodes...

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 January 2020 20:59 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/59 "2020-01-04T20:59:53Z")

</div>

@zenofmud, Paul, after uninstalling the node (& config), did you manage to re-install it successfully again from the latest git?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [4 January 2020 21:26 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/60 "2020-01-04T21:26:38Z")

</div>

@afelix Just checked this, you are right, if I change a flow and do not deploy but click on the terminal tab I also get a popup.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 January 2020 21:29 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718/61 "2020-01-04T21:29:48Z")

</div>

Yes I can remove and reinstall it at will

[Previous page](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718.md?page=2)

[Next page](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718.md?page=4)
