-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would you consider putting config in /etc? #74
Comments
Yes, placing system-wide configuration files in /usr/local/etc or /etc makes sense. Placing per-user configuration files in ~/.config/twin make sense too. I will have a look at your patch, and check whether it's complete or needs some adjustments |
@cosmos72, since were on the subject of config files: is there really any point of not starting the socket service by default? I'm in and out of servers all day starting TWIN sessions on a regular basis. It really is a nuisance to have to remember to turn on the socket server every time. I know there are likely to be very specific security instances where you might want to limit one's self to only the built in twterm to prevent someone else from pounding your TWIN socket. But it would seem in the majority of situations you want the socket server started so you can have ready access to whichever TWIN apps you have available. I'm usually launching many TWIN commands, which at the moment are mostly limited to More than one app / window... is after all, what TWIN is all about. ;-) |
As you correctly point out, not starting the socket service by default is a security feature. I agree that starting it manually every time is annoying and time consuming:
Anyway, I am not inclined to change the socket service behaviour from "off by default" to "on by default": |
Here's the thing: When was the last time you started X without a socket? You can't, and for good reason. Its useless without some way for clients to talk to it. TWIN is in a little better shape because twterm is built in. So you can kind of use it without the socket. The thing is that there is never a time I leave it off. Especially if you want an app eco system the socket server needs to be started to use them. I won't belabor the point since I can simply change the default in my build and even if I had to hack the source I would enable the socket on by default. I think socket security deserves some rethinking. I'll have to delve through the code to see what the whole situation is. You do have to have the token to be able to do anything with it. Anyhow I have a bundle of ideas if you want to hash it out in another issue or some other form of communication. |
Hi @jafcobend, About the security implications of enabling the socket service (with any mechanism: modifying the sources, from This is only partially mitigated by the fact that the initial surface attack area is quite small: an attacker would first need to successfully guess the content of user's |
I agree whole heartedly! I don't care if TWIN were audited. There is no good reason to expose it to the internet! If someone has one... then they need to rethink things. :-D Ok... maybe a server that does nothing but hosts demo TWIN sessions for people to play with and has no data of value with plenty of warning "use at your own risk!" But that seems pretty far fetched. ;-) For context to answer your questions, I currently have three basic use cases that I'm using TWIN in:
In all of those situations, never is TWIN exposed to the internet. As it should always be, there are firewalls that prevent the accidental exposure of services. And I, personally, can never see a time I'd directly expose TWIN to the iNet. So, I'm not concerned about that angle. What I will do is simply modify my package so But I understand the concern of an unknowing user getting TWIN, being attached unprotected to the iNet (that was painful just to write), and starting TWIN with the socket server enabled. But then I would say that in that scenario that if the user doesn't give up on TWIN, not seeing the potential, but instead they explore it, they WILL start the socket server unprotected! My suggestion in that case would be to bind the listening socket to Frankly my preference would be to not to start an IP (4/6) socket at all. But to use a UNIX domain socket in the user's home directory. I HATE things putting personal (user specific) temp files in |
Then I hope you'll agree that making it easy to accidentally expose twin socket service to the Internet is bad too. The socket service actually creates (and listens on) two sockets:
The latter has Clients already use the unix domain socket by default, and resort to TCP socket only if Maybe a reasonable compromise is to enable the socket service by default, but only listen on the unix domain socket in user's home directory? |
To be honest, I'm seeing enabling socket access via config file is the only right way and agree with all security points ! -- e.g. enabling socket should be an "understood" step by a final user, and not something enabled by default of what user will even not be aware.. Personally I'm always using socket module as all my servers and VM are running in the well protected and isolated LAB env. -- so I can always deploy my "custom" TWIN config files on all systems. But when I just started to use TWIN there were many things yet to discover, and having good secure defaults from the start was a big advantage. just my 2c Rgds, -Dimitri |
I'm going to add my nickel's (2c+2c+1c ;-) ) worth here and answer both of you:
I agree leaving the TCP service off is the most secure. @cosmos72 I think that idea is a winner! I did not know (and wondered) what those The thing I love about UNIX sockets is that, at least in Linux, there are native permissions involved:
I routinely use them when I want to keep a communication channel secure on a multi-user box. Anybody on the box can access an IP socket. But not the UNIX socket. It seems like maybe the thing to do with the socket is to put it in a protected directory. You could use something like I would put the sockets in their own folder under the user's TWIN config folder so that things remain tidy. Hiding it makes it even less likely to be a bother or get noticed. Since your include facility also looks in the TWIN config folder for the included files this leaves the main TWIN directory free for whatever TWINisms the user wants to setup. And you won't accidentally include a socket! I suppose the only real issue with personal temp folders, like stashing sockets in the home folder, is that at boot they aren't cleared. Well... at least not since Mandrake. So in a crash/reboot scenario the old sockets will remain. As for TCP service maybe the only way to turn it on should be by specifying the address or interface to bind to in the twinrc. Someone could always set it to Making this a config file edit addresses @dimitrik-fr's scenario. A user has to know something about what they are doing before they expose themselves to the iNet. Yet we still have a fully functional TWIN environment before then. This is good for new users, since they won't do something like attempt to start Frankly I will most likely never enable TCP on my TWIN sessions. I seldom use that ability of X. But then my time in TWIN-land is still relatively new. TWIN over the wire is more functional than X (less bandwidth). So I may change my mind later. But I think something needs to change with the tokens before then.... For now its access through SSH and --hw=tty. |
I ended up writing a conceptually analogous but more extensive patch - see commit a90a276:
If that's what @jafcobend intended, I'll close this issue and move the discussion about sockets to a separate issue. |
@cosmos72 yes, that's brilliant. I was lazy and didn't fight the names and since I don't have any TWINs installed with the confs in the libdir I didn't need to worry about upgrades. :-) But bonus points to you for doing so! One more thought on the conf file location: How about allowing it to be specified from the CLI? That's pretty typical and I'll be wanting to have specific TWIN sessions where specific things get loaded each time the session starts. But I'll still want to be able to start an empty session (default config). |
For my use I'm patching TWIN to place the system config files in
/etc/twin
as opposed to/usr/lib/twin
. This seems more *NIX-like to me. I also moved the personal config files to~/.config/twin
. I suppose that's just personal taste. I'd like my home folder to be less messy. :-D I have tried to make this patch work with yourauto*
stuff. But since I don't use these tools, and rather dislike them, I have likely done it wrong.Here's my patch:
With this patch you could place the config files in the "lib" directory with a configure command like:
But people I share this with always go, "Huh?!?!", when I tell them where to find the system-wide config files. And I'm fairly certain that Debian packaging politics (policy) demands they be placed in
/etc
. I'm sure other distros are just as opinionated.I can't say I've tested the uninstall since *NO* program gets installed on my system without being placed in a .deb first. So if I uninstall it I let
dpkg
do the clean up. Hence, I never runmake uninstall
.The text was updated successfully, but these errors were encountered: