←  Operating Systems

ComputerCraft | Programmable Computers for Minecraft

»

cLinux [now with OPTIONAL Desktop Envirome...

Piorjade's Photo Piorjade 17 Sep 2016

cLinux, secure freedom.


Made by:
  • Piorjade
  • thecrimulo
(Current state of usability: you are able to fully use it with external programs (NOTE: programs that use the FS API inside forbidden folders will crash and display an error, use sudo or log in as root to use them, or at best (if the program has the path set as string somewhere at the top) change the path to an allowed one, please :)/> ) )

Join our Gitter! : https://gitter.im/cL...aign=share-link

The idea:
Spoiler
How you may use it:
Spoiler
Current functions:
Spoiler
Planned functions:
Spoiler
Current functions/variables in _G:
Spoiler
NOTE (about programs that use the ShellAPI, for example shell.run() )
THIS OS HAS SHELL DUMMIES NOW:
Ok, but which do not and will not (probably ever, as I don't want to) work? :
  • shell tabs = they all return nil, for the sake of not crashing most of the programs instantly, some will still tho
  • NOTE: shell.complete does not return the last commands, will add that later but for now it does autocomplete
All the other Shell function should work as expected, I CANNOT guarantee you that. (BTW if you use shell.run, the FS API is STILL limited, AND NOONE (not even root) IS ALLOWED TO RUN PROGRAMS IN /rom/programs/ ! Why? simply because I intended to use this OS as a replacement of CraftOS, not having it ontop of it. If you want everything from CraftOS available to you, then please look at other OSes (or my doorOS, if you want))

Changelog:
Spoiler

Screenshots:
Spoiler

How to get it:
pastebin run d6fC8hBd 

How to get the doorX Desktop Enviroment (maybe a problem for people on public servers..):
Spoiler


Where is the code? :
https://github.com/Piorjade/cLinux

Credits:
Anavrins - For SHA-256 & contributing in GitHub :3
Lyqyd - For packman
apemanzilla - For gitget (the installer)
Nevercast (& me) - For Top Level Coroutine Override
Sewbacca - For various things and mainly this till' now
thecrimulo - Mainly for contributing in GitHub :)/>/>

Funfact:
I did this because I love Linux and finally completely destroyed my Windows 10 partition and installed Manjaro on it <3
Edited by Piorjade, 08 May 2017 - 11:02 AM.
Quote

Piorjade's Photo Piorjade 18 Sep 2016

UPDATE

Spoiler

Edited by Piorjade, 15 October 2016 - 10:24 PM.
Quote

thecrimulo's Photo thecrimulo 18 Sep 2016

Okay:
I'd just like to interject for a moment, no, I am not goint to give you the GNU/Linux speech, but I have some things to say.

1) "only allow the root to edit stuff under the user/[NAME]/home/ directory"
This is the root user and I can't find the reason why would you block it from going outside, when the main reason of the root account is to modify all the system and hence why it's not a common user, and programs like apt need to run as SU.
2) "rewrite fs.open (and probably other functions, which could harm the OS) to only edit in the homedirectory, IF the logged-in user is not root (basically "emulate" the root directory"
Here I am assuming you want to make a permission and user system, which is fine, and I am doing it too in an OS I'm also developing, more carefully.
But, I think its incorrect to say you are "emulating the root directory".
3) "commands are (like in linux and CraftOS) extra files saved in /usr/bin"
This is less of an issue, but there are also binaries that are included in the system and make it unusable if they didn't come preinstalled, I am referring to commands like cd, rm or edit.
4)

Quote

If you use a program, which uses the shell API (for example, shell.run), it will give an error!!!
Why?
Well basically I use the fixed TopLevelCoroutineOverride, to completely disable Shell and start my OS as the top-coroutine, which means Shell is NOT loaded and you can't use it's functions.
Well here we got something simple, but mind that if you are nulling the shell (and multishell), you have to get replacements for the help functions, autocomplete functions, path functions and others. There is no problem on the TLCO. Buuut there is something wrong here: If you are doing a TLCO that makes you, want it or not, disable the shell (which is a program), and you are suggesting to load it with loadAPI, but 1st, the TLCO can broke, 2nd the shell will bypass the security and 3rd it is not a library.
5) Making evident the variables where the current user and (hashed and salted) password are, can just cause a simple security bypass.
6) You are implementing an user and permission system, but you can't make other users. This is undone, clearly, but I'd suggest finishing the systems, libraries and binaries after allocating the userspace.

I am making an OS, which is more advanced than this, replacing all libraries and binaries, making it crash when trying to run programs or libraries in /rom/*, (deprecating everything in rom, only useful for making the new libraries). If you need help, you can PM me, tho my holidays ended and I'll not be very active. Anyways I offer my help.

I hope I didn't make you feel bad or something, it wasn't my intention.
~ Dael
Quote

Piorjade's Photo Piorjade 18 Sep 2016

1. By emulating root I actually meant that I'm PLANNING to redirect fs.open("/blah") to fs.open("[myhome]/blah"), thats why the title also says WIP
2. As it says WIP, multiuser creation is yet not implemented
3. As stated in my post, I THOUGHT loading shell as an API would work but I didn't test it and I have to look into it's code to see how it could potentially harm the system. (but I don't recommend programmers using this OS to use any shell commands cuz the main reason of this is to REPLACE shell)
4. The normal user CAN get out of it's home but in read-only mode (I'm thinking of adding the sudo command, which will ask for the root password)
5. I don't know if we are misunderstanding each other but by saying editing 'under the homedir' I actually mean adding files, editing files, creating folders, etc. in folders like /usr/ oder / or anything thats 'under' the logged users' home, meaning that you need to be root / use sudo to do this and to use packman because they are editing files under home and you could potentially harm the OS with that, you know what I mean?
6. Sorry for not writing this in the topic but I actually stored these variables temporarely there. As you stated, having cd and basic stuff as extra file could also be pre-installed, that's actually my next step to prevent saving these variables globally :P

So all in one:
I got NO problem with your post here , but I think you didn't see that many things are not implemented yet and have many 'securityholes', which I know of myself.
And thank you for reply :D

NOTE: The 'endproduct' will be WAY more secure than that. And I made basic commands as extra files because I could then program them without restarting the whole computer all the time, because I am lazy AF :P

EDIT: Btw yeah I also plan to implement autocompletion
And by path functions, do you mean something like shell.setPath()? If yes, in the current state you just have to edit _G.currentDir <-- I can't see any reason in this state to make some kind of function, as the Terminal would probably end up being in that directory if your program edits this string...
EDIT 2: The thing is, is it really necessary to replace ALL libraries and binaries in an OS? Considering you want to have as many programs compatible as you can because lets say you replace everything which was stock and use your stuff (using TLCO to knock shell out too) and basically having the problem that some programs probably won't work, you would probably make something like Windows vs Linux where all of these lazy dudes are who don't want to switch from the stock to your libraries (Windows vs Linux is a very good example for Game-Producers heheh :P) and your OS will probably end up being useless cuz you can't use any external program. (Look at dem NDFJay OSes LOL)
Edited by Piorjade, 19 September 2016 - 12:02 AM.
Quote

Anavrins's Photo Anavrins 19 Sep 2016

Hey there, just saying that blake256 is not a custom implementation of sha256, it's a completely different algorithm that was part of the sha3 competition.
Haven't looked at it in a while, and I believe my sha256 api is much more optimized than it and might be more suited for your needs if you're using it for password storage.
I also noticed a slight misuse of it in os.lua, technically it would work on newer CC versions, but would break in older ones, so I made a pull request to fix it :)
Quote

H4X0RZ's Photo H4X0RZ 19 Sep 2016

View PostPiorjade, on 18 September 2016 - 11:40 PM, said:

1. By emulating root I actually meant that I'm PLANNING to redirect fs.open("/blah") to fs.open("[myhome]/blah"), thats why the title also says WIP
2. As it says WIP, multiuser creation is yet not implemented
3. As stated in my post, I THOUGHT loading shell as an API would work but I didn't test it and I have to look into it's code to see how it could potentially harm the system. (but I don't recommend programmers using this OS to use any shell commands cuz the main reason of this is to REPLACE shell)
4. The normal user CAN get out of it's home but in read-only mode (I'm thinking of adding the sudo command, which will ask for the root password)
5. I don't know if we are misunderstanding each other but by saying editing 'under the homedir' I actually mean adding files, editing files, creating folders, etc. in folders like /usr/ oder / or anything thats 'under' the logged users' home, meaning that you need to be root / use sudo to do this and to use packman because they are editing files under home and you could potentially harm the OS with that, you know what I mean?
6. Sorry for not writing this in the topic but I actually stored these variables temporarely there. As you stated, having cd and basic stuff as extra file could also be pre-installed, that's actually my next step to prevent saving these variables globally :P/>

So all in one:
I got NO problem with your post here , but I think you didn't see that many things are not implemented yet and have many 'securityholes', which I know of myself.
And thank you for reply :D/>

NOTE: The 'endproduct' will be WAY more secure than that. And I made basic commands as extra files because I could then program them without restarting the whole computer all the time, because I am lazy AF :P/>

EDIT: Btw yeah I also plan to implement autocompletion
And by path functions, do you mean something like shell.setPath()? If yes, in the current state you just have to edit _G.currentDir <-- I can't see any reason in this state to make some kind of function, as the Terminal would probably end up being in that directory if your program edits this string...
EDIT 2: The thing is, is it really necessary to replace ALL libraries and binaries in an OS? Considering you want to have as many programs compatible as you can because lets say you replace everything which was stock and use your stuff (using TLCO to knock shell out too) and basically having the problem that some programs probably won't work, you would probably make something like Windows vs Linux where all of these lazy dudes are who don't want to switch from the stock to your libraries (Windows vs Linux is a very good example for Game-Producers heheh :P/>) and your OS will probably end up being useless cuz you can't use any external program. (Look at dem NDFJay OSes LOL)

Isn't that exactly why we have Wine? It's a compatibility layer between Linux and Windows, giving programs access to all the windows stuff Linux doesn't have.

Sure, you don't have to add implementations of all the stock APIs you lost because of the TLCO but you would also drop support for the majority of programs. If you really have to do everything "your own way", add dummy functions for the shell API which either do nothing, or call your custom functions.
Quote

Piorjade's Photo Piorjade 19 Sep 2016

Thx Anavrins :)

About doing things my own way, I was actually meaning his OS idea. I won't replace every library. (right now I think only shell doesn't work) Right now I need to make, as you said, dummy functions (for programs that use things like: shell.run() )
Btw how I understand wine, isn't it porting for example the directX code into linux-executeable code "on-the-fly" ?
I guess thats why there is a bit of a performance loss and DirectX11 is still not supported. (I really would like to have my Windows games natively ported to Linux :P )
Edited by Piorjade, 19 September 2016 - 07:06 AM.
Quote

Piorjade's Photo Piorjade 19 Sep 2016

Ok I merged your pull request, going to look into your suggestion about your SHA-256 API tho.
NOTE: the new version with your fix is not yet compiled into the pastebin link, going to do this after I'm back home. (or maybe I will directly implement your SHA-256 API after I'm back home :P)
EDIT: Wrote your name wrong LMAO
Edited by Piorjade, 19 September 2016 - 07:07 AM.
Quote

Piorjade's Photo Piorjade 19 Sep 2016

(I added a small information about the Shell API in the topic, if something changes and the example won't work anymore, I will change the note too. To prevent confusion:
No, I didn't implement that yet and this example will be added in the OS itself, so that older programs do NOT have to update their code, thanks for reading.)
Quote

Piorjade's Photo Piorjade 19 Sep 2016

UPDATE:

Spoiler
Quote

thecrimulo's Photo thecrimulo 19 Sep 2016

Thanks for clarifying it all, Piorjade.
Also, as for if you should replace all libraries and binaries, it really depends a lot on what are you replacing:
If you are, like me, renaming, creating and deleting functions that can't work well with the TLCO or, to keep consistency with the rest of your APIs, also for APIs
that have code that may not work on your OS. There is no need to replace libraries like the GPS, also keep in mind that you don't have to completely deprecate the APIs in /rom/, as there are functions that you cannot recreate, like the FS ones. As for the wine-like compatibility layer, you can make functions that work just as aliases, shortcuts for another function, and that "should" do the same, in case you haven't got that, It is kind of... strange, I'd say, to lose functions that worked well and people used. Then, using those functions, you can't guarantee if they will fully work, but you can improve it by testing long programs like Nevardon, LuaIDE, Discover Store and others.

Also, by the path I didn't mean the current directory, I meant where is supposed to look for the programs, like adding a directory to the Environment Path on WIndows, just like CraftOS searches for cd or rm in /rom/programs
Quote

Piorjade's Photo Piorjade 19 Sep 2016

Yeah and thank you for replying to my post, it really motivates me to continue if people reply.
Hell even some of you guys put pull requests on my GitHub and it made me really happy to see that =)

Btw

UPDATE:
Spoiler
Quote

Piorjade's Photo Piorjade 19 Sep 2016

View Postthecrimulo, on 19 September 2016 - 06:50 PM, said:

Thanks for clarifying it all, Piorjade.
Also, as for if you should replace all libraries and binaries, it really depends a lot on what are you replacing:
If you are, like me, renaming, creating and deleting functions that can't work well with the TLCO or, to keep consistency with the rest of your APIs, also for APIs
that have code that may not work on your OS. There is no need to replace libraries like the GPS, also keep in mind that you don't have to completely deprecate the APIs in /rom/, as there are functions that you cannot recreate, like the FS ones. As for the wine-like compatibility layer, you can make functions that work just as aliases, shortcuts for another function, and that "should" do the same, in case you haven't got that, It is kind of... strange, I'd say, to lose functions that worked well and people used. Then, using those functions, you can't guarantee if they will fully work, but you can improve it by testing long programs like Nevardon, LuaIDE, Discover Store and others.

Also, by the path I didn't mean the current directory, I meant where is supposed to look for the programs, like adding a directory to the Environment Path on WIndows, just like CraftOS searches for cd or rm in /rom/programs

And about the compatibility layer: in the current state I only need a ShellAPI layer, which shouldn't be THAT hard when looking in the wiki page :)
Edited by Piorjade, 19 September 2016 - 08:21 PM.
Quote

thecrimulo's Photo thecrimulo 19 Sep 2016

View PostPiorjade, on 19 September 2016 - 08:20 PM, said:

View Postthecrimulo, on 19 September 2016 - 06:50 PM, said:

Thanks for clarifying it all, Piorjade.
Also, as for if you should replace all libraries and binaries, it really depends a lot on what are you replacing:
If you are, like me, renaming, creating and deleting functions that can't work well with the TLCO or, to keep consistency with the rest of your APIs, also for APIs
that have code that may not work on your OS. There is no need to replace libraries like the GPS, also keep in mind that you don't have to completely deprecate the APIs in /rom/, as there are functions that you cannot recreate, like the FS ones. As for the wine-like compatibility layer, you can make functions that work just as aliases, shortcuts for another function, and that "should" do the same, in case you haven't got that, It is kind of... strange, I'd say, to lose functions that worked well and people used. Then, using those functions, you can't guarantee if they will fully work, but you can improve it by testing long programs like Nevardon, LuaIDE, Discover Store and others.

Also, by the path I didn't mean the current directory, I meant where is supposed to look for the programs, like adding a directory to the Environment Path on WIndows, just like CraftOS searches for cd or rm in /rom/programs

And about the compatibility layer: in the current state I only need a ShellAPI layer, which shouldn't be THAT hard when looking in the wiki page :)

Anyways, I'd suggest a new one, programs can stop working unexpectedly, this happens when, by some call, the TLCO breaks, or the program finds a flaw, or just not executing at all. Also. Thanks for the merge, I'll keep contributing ;)
Quote

Piorjade's Photo Piorjade 19 Sep 2016

View Postthecrimulo, on 19 September 2016 - 08:37 PM, said:

View PostPiorjade, on 19 September 2016 - 08:20 PM, said:

View Postthecrimulo, on 19 September 2016 - 06:50 PM, said:

Thanks for clarifying it all, Piorjade.
Also, as for if you should replace all libraries and binaries, it really depends a lot on what are you replacing:
If you are, like me, renaming, creating and deleting functions that can't work well with the TLCO or, to keep consistency with the rest of your APIs, also for APIs
that have code that may not work on your OS. There is no need to replace libraries like the GPS, also keep in mind that you don't have to completely deprecate the APIs in /rom/, as there are functions that you cannot recreate, like the FS ones. As for the wine-like compatibility layer, you can make functions that work just as aliases, shortcuts for another function, and that "should" do the same, in case you haven't got that, It is kind of... strange, I'd say, to lose functions that worked well and people used. Then, using those functions, you can't guarantee if they will fully work, but you can improve it by testing long programs like Nevardon, LuaIDE, Discover Store and others.

Also, by the path I didn't mean the current directory, I meant where is supposed to look for the programs, like adding a directory to the Environment Path on WIndows, just like CraftOS searches for cd or rm in /rom/programs

And about the compatibility layer: in the current state I only need a ShellAPI layer, which shouldn't be THAT hard when looking in the wiki page :)

Anyways, I'd suggest a new one, programs can stop working unexpectedly, this happens when, by some call, the TLCO breaks, or the program finds a flaw, or just not executing at all. Also. Thanks for the merge, I'll keep contributing ;)

I'll always accept merges, if they fix something or add something useful ;)
Quote

Piorjade's Photo Piorjade 19 Sep 2016

OFFTOPIC:
Is it the real life syndrome where noone likes Linux or why do I still have only about 200 views on this?
But nvm I guess because these people who clicked on this were interested in this and I'm really grateful to them :)
Quote

thecrimulo's Photo thecrimulo 19 Sep 2016

View PostPiorjade, on 19 September 2016 - 09:16 PM, said:

OFFTOPIC:
Is it the real life syndrome where noone likes Linux or why do I still have only about 200 views on this?
But nvm I guess because these people who clicked on this were interested in this and I'm really grateful to them :)
Have to say, lately the OS sections have been bloated with... flawful, incomplete, or not OSes at all, I think we need something new and better.
Quote

Piorjade's Photo Piorjade 19 Sep 2016

View Postthecrimulo, on 19 September 2016 - 09:22 PM, said:

View PostPiorjade, on 19 September 2016 - 09:16 PM, said:

OFFTOPIC:
Is it the real life syndrome where noone likes Linux or why do I still have only about 200 views on this?
But nvm I guess because these people who clicked on this were interested in this and I'm really grateful to them :)/>
Have to say, lately the OS sections have been bloated with... flawful, incomplete, or not OSes at all, I think we need something new and better.

True, what do you think about this tho?
(And until now there haven't been REAL OSes I think but at least external program support has to be implemented, which it isn't in these NDFJay clones)

Btw:
#merged and ty for the installer
Cannot access my PC right now so I tried to copy the code over to pastebin with my phone. ( d6fC8hBd )
Could you test it out?
Quote

thecrimulo's Photo thecrimulo 19 Sep 2016

I'll try tomorrow, turns out that is late and I have school. I will get back 8pm or so, spain time.
You welcome, and Cya
Quote

Piorjade's Photo Piorjade 19 Sep 2016

K cya
Quote