SSH source code example - ssh

I would like to write my own implementation of a SSH daemon that is not based on OpenSSL. It shall be used in a non Linux-oid environment.
Is there any public domain source code for a SSH domain (probably not full-featured) available?

A number of small SSH daemons exist that may be adaptable to your environment.
If your concern is about licensing, then pick example code that is not GPL, and you'll be free to do whatever you like with it. (Note that OpenSSH uses the BSD license, so you are free to do whatever you like with it.) Dropbear is a nice, small server that often gets used in embedded environments.
Also, check out Wikipedia's Comparison of SSH servers. It's not complete, but it provides some food for thought.

If your goal is to write your own daemon, can't you just read the source code of OpenSSH, if it is too complex, then you can maybe have a look on:
http://plan9.bell-labs.com/sources/contrib/blstuart/ssh/
I think this one is released under Lucent Public License Version and written i Plan 9 C, which is a little bit different to C89 or C99. But should be quite easy to understand.
http://www.gnu.org/licenses/license-list.html#lucent102
Or have a look on the Erlang implementation of SSH.
https://github.com/erlang/otp/tree/maint/lib/ssh/src
Good luck!

There are already pointers to source code samples by emil and ghoti.
But I think to start such a project you should read the documentation of the underlying protocols.

Related

Perl6: rakudobrew cannot build moar

I'd like to upgrade to the newest version of Perl6,
rakudobrew build moar
Update git reference: rakudo
Cloning into 'rakudo'...
fatal: unable to connect to github.com:
github.com[0: 140.82.114.4]: errno=Connection timed out
Failed running git clone git://github.com/rakudo/rakudo.git rakudo at /home/con/.rakudobrew/bin/rakudobrew line 57.
main::run("git clone git://github.com/rakudo/rakudo.git rakudo") called at /home/con/.rakudobrew/bin/rakudobrew line 397
main::update_git_reference("rakudo") called at /home/con/.rakudobrew/bin/rakudobrew line 368
main::build_impl("moar", undef, "") called at /home/con/.rakudobrew/bin/rakudobrew line 115
this is just a simple connection failure, but how do I fix this?
Your connection problem is not really anything to do with any P6 related software, or in fact any software you're using. It is, as you say, "just a simple connection failure". And most such failures are transient and "fix themselves". As JJ notes, in such scenarios you just wait and then things start working again.
So by the time you read this it'll probably be working for you again without you having fixed anything. But I'm writing an answer anyway with these sections:
Consider not using rakudobrew
Connection problems that "fix themselves"
Connection problems you investigate or fix yourself
Getting around single points of failure
Consider not using rakudobrew
The main purpose of rakudobrew is to support installation of many versions of Rakudo simultaneously and the main audience for the tool is folk hacking on the Rakudo compiler, not those merely using it.
If you're just a regular user, not someone developing the Rakudo compiler and/or don't need to have multiple versions of Rakudo, with complete source code, installed simultaneously, then consider just downloading and installing Rakudo files directly, eg. via rakudo.org/files, rather than via rakudobrew.
Connection problems that "fix themselves"
rakudobrew failed because a git clone ... command failed because the connection with the github.com server timed out.
A server timing out when doing something that usually works using a connection that usually works is likely a transient problem, aka a "please try later" problem.
Transient problems typically "fix themselves" a few seconds, minutes or hours later.
If there's still a problem when you try again, and you want to spend time trying to find out what's going on officially, then look for a status page for that server.
Here are two status pages I know of for github.com:
https://www.githubstatus.com/
https://twitter.com/githubstatus?lang=en-gb.
And for unofficial scuttlebutt I suggest reading the twitter feed.
For me, right now, github.com is working fine and the status page says all systems are go.
So it should now be working for you too.
If it's not, then you can wait longer, or investigate. It you want to investigate, start by looking at the status pages above.
Connection problems you investigate or fix yourself
If github claims it's working fine then there's presumably a problem with your local internet "on-ramp" (your system or your internet service provider's) or somewhere further afield between your on-ramp and the server you're failing to connect to. (You can only know approximately where the server is based on which region of the world administers the IP address the server is associated with at any given moment.)
The next place to look will be places like the internet traffic report; this indicates traffic jams and the like across the planet. (Ignore the visual display, which is broken on some browsers, and click on the links in the table to drill down.)
If it's all green between you and the region that administers the IP address of the server you're failing to connect to, then the next place to turn would be your system's administrator and/or ISP.
Failing that, then perhaps you can ask a question at a sister stackexchange site like serverfault.com or superuser.com.
Getting around single points of failure
Perhaps you were thinking there might be some system redundancy and/or you're interested in that aspect.
P5's ecosystem and its tools are generally mature and limit spofs. This is unlike the ecosystems and tools of most of the other languages out there; so if you've gotten used to the remarkable reliability/availability of CPAN due to its avoidance of spofs, and by extension perlbrew, well, you've been spoiled by P5.
The P6 ecosystem/tool combinations are evolving in the P5 tradition.
For example, the zef package manager automatically connects to CPAN alongside github, and is built to be able to connect to other repos. The ecosystem is partway there to take advantage of this zef capability in that many modules are redundantly hosted on both CPAN and github.
rakudobrew ignores CPAN and assumes use of git repos. It is impressively configurable via its Variables.pm file which includes a %git_repos variable, which could be re-targeted to an alternative git repo site like gitlab. But no one has, to my knowledge, arranged to redundantly copy and update the relevant rakudo files to another git repo site, so this spof-avoidance ability apparently inherent in rakudobrew's code is, afaik, moot for now.

Is there any haproxy development guide?

Isn't that weird that Haproxy doesn't have any development guide to start for a beginner? For instance, for the university, I have to modify HA, but most of the content I do find on the internet is configurations of haproxy, but how to start developing it, I can't find any references.
Maybe someone knows where to get that information? Even though there are summaries on almost every method in their repo, but it still would be better if there was a more broad explanation.
From: https://github.com/haproxy/haproxy
The more detailed documentation is located into the doc/ directory :
doc/intro.txt for a quick introduction on HAProxy
doc/configuration.txt for the configuration's reference manual
doc/lua.txt for the Lua's reference manual
doc/SPOE.txt for how to use the SPOE engine
doc/network-namespaces.txt for how to use network namespaces under Linux
doc/management.txt for the management guide
doc/regression-testing.txt for how to use the regression testing suite
doc/peers.txt for the peers protocol reference
doc/coding-style.txt for how to adopt HAProxy's coding style
doc/internals for developer-specific documentation (not all up to date)
maybe you wanna start at doc/internals

Using salt-cloud with oVirt

I have a small cloud, configured and set up with SaltStack. The instances are running on Xen right now.
I would like to use oVirt instead, with automatic provisioning of virtual machines (via salt-cloud, I guess).
Apparently, there is no formula for this yet. Also, one cannot just use virsh on the command line or something (oVirt uses its own XML files for configuration and has virsh disabled). There is a REST API for oVirt, but I would prefer something already made before I dive into this and try to make it work with salt.
I have searched for oVirt and salt, but have found almost nothing.
Can I use oVirt with salt-cloud to do automatic provisioning? If so, how?
There doesn't appear to be an oVirt salt cloud driver yet. Here's the list of currently supported clouds:
https://docs.saltstack.com/en/latest/topics/cloud/#cloud-provider-specifics

AD/LDAP authentication for FitNesse

We are going to put FitNesse on a server and wants to have a AD/LDAP authentication solution for this.
Does anyone have experience with good and easy to set up solutions for this?
Thanks in advance. Magnus
One straightforward method would be to download the standard edition of the UnboundID LDAP SDK and get a copy of the jsse.jar file and install both jar files in the fitness lib directory. Create a class in the fitness.authentication package that extends the fitness.authentication.Authenticator class and overrides the isAuthenticated() method. Specify the required properties such as hostname, port, simple or SASL bind, whether to use SSL or StartTLS, base object, search scope, and so forth.
The jsse.jar will provide the necessary SSL classes so that SSL and StartTLS can be implemented as required.
see also
LDAP: Programming practices
It is possible, but it would require either finding or creating a plugin to do it.
I found the following, but I have never tried it:
https://github.com/timander/fitnesse-ldap-authenticator.
Also out there, but older is: https://github.com/dleonard0/fitnesse
You can start there, but you might have to get your hands dirty. Unfortunately, I'm just not that familiar with that part of the code.
See here: http://fitnesse.org/FitNesse.UserGuide.AdministeringFitNesse.SecurityDescription.SpnegoAuthentication
I need to give many more characters to make stakeoverflow happy.

Writing a web-scripting language from the ground up?

I'm looking for references stating how to write a web scripting language and interface it with a web-server.
I'm not looking for "how to write the language" or "how to write an interpreter" references rather - I don't know how the basics of a web-script interpreter work? Is it a simply a CGI based interpreter that is passed the HTTP parameters through stdin then interprets the script and pushes the output back to stdout?
What about interfacing and registering with the web-server (IIS, Apache) how is that done? Again, through stdin/stdout?
Any basic examples, references or comments would be appreciated.
Eric Lippert had a series of posts on building your own script engine. They may be of help/interest:
SimpleScript, Part Zero
SimpleScript Part One: DllMain is Boring
SimpleScript Part Two: Class Factories Are Also Boring
SimpleScript Part Three: Engine Skeleton
SimpleScript Part Four: Finite State Machines and Script Engines
SimpleScript Part Five: Named Items and Modules
SimpleScript Part Six: Threading Technicalities
SimpleScript Part Seven: Binder Skeleton
Is it a simply a CGI based interpreter that is passed
the HTTP parameters through stdin then interprets the
script and pushes the output back to stdout?
It could be.
What about interfacing and registering with the
web-server (IIS, Apache) how is that done?
If it is CGI, then you would use their built in CGI modules.
Otherwise, you might use FastCGI (again with built in modules), or the APIs provided by the server: Apache, IIS
This is certainly going to be server-dependent. Apache is very modular and afaik uses own IPC protocol. In any case, the interpreter should be something that is started up once for the server, not once per request. As far as IPC, stdin is one option as you mentioned; others would be shared memory, pipes, or localhost TCP.