Open Source Secure Sockets Framework - frameworks

I am looking for an open source framework to build a proprietary protocol onto (Agent/Client talks to a Receiver/Server that stuffs things into a SQL database).
I need session handling (ie login/logout) and some kind of encryption.
I found the Spread Framework which looks great, but does not appear to support authentication or encryption of any kind out of the box.
My preferred language is C, C++, Python, or Perl.
Anyone know of anything off hand? Hoping for something to be out there to save me time rather than doing it the hard way all in *nix sockets ;)
Thanks in advance!

Why not use libcurl, as it can do SSL.
http://curl.haxx.se/libcurl/c/example.html

DJango and DJango ORM, or SQLAlchemy combinations can be a good start. A python base framework and ORM.

Since you are working at the socket level, I assume that you are trying to write an application from the ground up. Or are you trying to run within an existing web server?
Could you use lighttpd with HTTPS & mod_cgi? This isn't really a framework, per se, but it would keep your application portable to other infrastructures.
On the server side, CGI::Session could take care of the session management. Authentication could be done using mod_auth.

Why not use SSL/TLS? On the client you can use libcurl, which works with C, C++, Python, and Perl. On the server, use Apache, lightttp etc, with cgi or your favorite language. You can use mutual authentication to ensure verify the identify of both the client and server, as well as provided an encrypted channel.

Related

WebSocket with free RDMBS (PostgreSQL, SQLite, etc) and without JavaScript ecosystem

I'm searching a simple implementation to push changes from a free relational database (PostgreSQL, MySQL, SQLite, etc.) to clients' browsers via WebSocket or WebPush.
I want to avoid all the server-side JavaScript ecosystem (Node.js, npm & cie) and the NoSQL databases.
All must be hosted in the servers of my company, I can't use third-party services.
I found these interesting solutions :
http://initd.org/psycopg/articles/2010/12/01/postgresql-notifications-psycopg2-eventlet/ [with Python]
https://gist.github.com/drocco007/6e44ac1a581546c16e67 [the same one slightly improved]
https://coussej.github.io/2015/09/15/Listening-to-generic-JSON-notifications-from-PostgreSQL-in-Go/ [with Go]
Do you know other ways to get this done?
Is PostgreSQL the more suitable free RDBMS to do this?
Can it be accomplished with a SQLite database?
Can Apache or NGinx abilities be used to achieve this?
Update 01/23/17: I wrote an application called postgresql2websocket in order to send PostgreSQL notifications over websockets using Python 3 with asyncio + aiohttp + asyncpg https://github.com/frafra/postgresql2websocket; you could combine it with PostgREST in order to have both standard REST APIs and realtime updates using WebSockets.
As far I know, there is no HTTP server extension for using SQL databases with Websockets without anything in the middle.
You can use Python on the server side, like this: Real Time Web Apps with (just) Python and Postgres. I think it could be improved thanks to aiopg. If you don't need Websockets, you can just use ngx_postgres.
If you like Django, Django Channels will be probably included in Django 1.10 (Redis/in-memory/... layer for channels and SQL backend).
You could use SQLite, but bear in mind that you have to implement a separate server side publish/subscribe mechanism (like Django channel does), because SQLite doesn't have one.
If you're just interested in pub/sub over Websockets, you could use Webdis (Redis-based solution): it would be probably lighter than a full SQL database.

can we create a web service using objective c

In my iphone application I am calling (by SOAP post method) a web service which is written in .net and hosted on a server, and its all working fine. But my doubt is, can we write a web service in objective c? And host it on a server? so that we should be able to access it from any of the platforms like .net, php and objectiveC.
I read a fantastic tutorial regarding this question some time ago here.
To be honest, it can be quite difficult to really use this in a productive environment. If you want to get all the features and tools Apple gives to you (what seems to be the intention of your question), you'll have to use a Mac in order to run your service afterwards.
In my opionion using PHP for example (if you need a db also backed up by MySQL) is much easier. Almost all hosters support it and you won't have to worry about setting up a bunch of macs and connecting them via solid and stable cables to the internet (and with that: guarantee availability).
Yes. A web service is just some application that can provide a service over the web. As you can create an application in Objective C, it can be a web service the same as made in any other language.
You can make it run on any server where you have an objective C compiler, however, the framework you use may restrict your choices to the server (ie, you can write objective C on windows, but you wouldn't be able to use the NS framework)
Web services are not limited to a programming language, however you do need to find if there is any framework using objective-c can run on specific server. For example, iiS allows you to use Asp.net which could be implemented using C# or VB.Net.
From the clients who will consume web services, they don't have to be a specific type of device. I think that's the point of web services. The messages travel in between is formatted. For example, a SOAP message is using xml, and that would ensure the message travel on HTTP. Therefore no matter you use iPhone or Android or Blackberry, you should have no problem to make web service calls.
So in general, I think you have to see what kind of web services you want to create, and then see if Apple(I assume) can provide you with a good framework to do it. In terms of client side, as long as your web services are using XML or JSON, it should be well supported.
Hope it helps.

Abstraction layer between iphone and database

I've built a backend in python that posts data to the database. I want a layer of abstraction, so I thought that the best thing to do was to call a python function from objective-c. The python function would then post to the database. How can this be done?
You'll need to access the Python function via a web server (potentially using an intermediate scripting language to call the Python script). You can read more about this via http://docs.python.org/howto/webservers.html
Being honest, it may prove to be less hassle to simply use a more common web scripting language (i.e.: not Python) if this is an option.
Moving on, in terms of the iPhone-side activity, you'll need to :
Ensure there's a network connection available to the remote site in question. (There's a plethora of questions here on Stack Overflow, such as: Determining Internet Availability on iPhone?)
Open a request to the remote web server.
The NSURLRequest class should be ideal for this.
Handle the results of the above correctly.

How (im)practical is it to use GWT with something other than Java on the server-side?

For web application development, I've been steeped in dynamic languages such as Ruby, PHP, and Python. Using popular frameworks for these languages, all my knowledge about HTML, CSS, and JavaScript transfers fairly straightforwardly: templates are basically HTML with embedded code that the server executes to generate the dynamic sections of the page.
Lately, I've been thinking about using GWT for building the UI of my next project. At this point, I'm just trying to wrap my head around how development with GWT works, as seems to follow an entirely different paradigm. In addition, it seems there's an unstated assumption that the server-side part of the app is written in Java. Would it be impractical to use something other than Java for the server side?
Related question:
GWT + GAE python: frameworks for COMET & RPC
While not actually impractical I would say that you get the most value from GWT by having the same code on client and server, since it allows for easy code reuse (fx. if your data objects are serializable then you could just send them directly to the client). So I guess my answer would be; yes you can do it and it's going to be more work than just having Java on the server side.
I don't think there's any requirement that you use Java on the server. At the end of the day, GWT compiles Java to JavaScript. You can do all the comms via the RequestBuilder object, you don't have to use the RPC services.
I guess the question is: if you don't like/know/prefer Java on the server side, why would you use it on the client when it's effectively an abstraction over JavaScript anyway?
There is no requirement to use Java on the server side. GWT supports JSON out of the box. Any server side component that can generate JSON ( or other supported serialization methods ) will work. You could use PHP on the server side, or bash shell scripts, it doesn't matter to the Javascript code that is generated by GWT.
Yes, it can be practical. I use Rails as my backend and GWT/GXT as my frontend. I love every bit of it! I couldn't stand worrying about browser incompatibilities, so GWT/GXT was a real joy. Also, I had already started my backend in Rails and did not have much experience with Java on the server, so I stuck with Rails.
You may want to take a look at an appropriate GWT Rest framework, as you won't be using RPC.
As an aside, there is one exception where you should use Java on the server. That's if you want to use Google App Engine.
Feel free to ask me any specific questions and I'll be happy to help you out.
Good Luck.
-JP

Which Perl session management library works well with TemplateToolkit?

I've considered CGI::Application and CGI::Session. Of the two, CGI::Session seems more promising. CGI::Application model, however, doesn't look like it would work well with Template Toolkit. (Am I wrong to think so?)
I would like to evaluate more session management libraries, before comitting to one. Any recommendations? I'm looking for a library that's web server agnostic, and works across multiple servers. Catalyst is not an option for now, due to the time required to retrofit existing code into the Catalyst way of doing things.
CGI::Application and CGI::Session are very different modules. CGI::Session is a session module - it does not do anything beyond this. CGI::Application is a lightweight framework. It works well with Template Toolkit, some of us use with CGI::Application::Plugin::TT.
So, if you need sessions only, use CGI::Session.
If you need better structure of your code - use CGI::Application. You can even use CGI::Session in it, with CGI::Application::Plugin::Session.
I have used Apache::Session with some success. Although the name tells a different story, I don't think it will only work with an Apache webserver.
The nice thing is that you can easily change the way sessions are stored without changing your own session handling code. E.g. you might start out with sessions being stored as files on disk and then move to a DB based system. And then change the DB backend after that.