Giter VIP home page Giter VIP logo

houzuoguo / laitos Goto Github PK

View Code? Open in Web Editor NEW
249.0 20.0 23.0 33.72 MB

Top geek's chindogu - personal assistant over satellite/telephone/SMS/chatbot, plus web infrastructure servers (web & mail, ad-free DNS, TCP-over-DNS, web proxy, etc)

License: Mozilla Public License 2.0

Go 95.79% Shell 2.03% PowerShell 0.13% Dockerfile 0.09% Makefile 0.03% HTML 0.63% Procfile 0.02% TypeScript 1.24% CSS 0.04%
mad-science satellite pstn sms snmp http smtp dns wolfram-alpha microsoft-bot

laitos's Introduction

laitos - Top geek's chindogu

poster image

laitos software suite offers all you need for hosting a personal website, receiving Emails, blocking ads with a DNS server.

And now for the geeks ๐Ÿค“ - as a professional geek, you need Internet access whenever and wherever! laitos inter-operates with telephone, SMS, satellite terminals, to give you access to Internet features such as:

  • Browse news and check out the weather.
  • Keep in touch via Email, telephone call, and SMS.
  • Remotely control computers in your laitos fleet.
  • ... more apps to explore!

And when the going gets though, laitos tunnels TCP traffic over DNS for you to get around local network restrictions.

Check out the comprehensive component list to explore all of the features!

Highlights

  • Efficient - it runs on an economy server with as little as 128MB system memory.
  • Portable - it runs on X86, ARM, and all flavours of Linux and Windows.
  • Independent - built-in self-healing and automatic maintenance for unmatched reliability.
  • Hyped by Buzzwords - certified to run in container/Kubernetes/PaaS/IaaS/FaaS/*aaS.

Get Started

Download ready-to-use latest release, then craft your own server with the friendly get started page.

Support

Should you encounter any challenge during configuration and deployment of the software, please file an issue.

I'd love to hear from your feedback, feel free to Email me, get in touch on Twitter, and visit my home page hz.gl.

This is not an officially supported Google product.

Copyright

Copyright (C) 2016-February 2021 Houzuo (Howard) Guo [email protected]. All rights reserved.

Copyright (C) 2021, 2022, 2023, 2024 Google Inc. and contributors. All rights reserved.

This program is free software subject to the terms of Mozilla Public License, v. 2.0. You may find the license text in the LICENSE file

Project name and origin

In late 2015/early 2016, a much smaller program called "websh" was created to offer basic shell access via SMS and telephone. The laitos project evolved from the smaller program, restarted from scratch in late 2016, and throughout 2017 the project gained a full suite of web servers along with integration to social networks and utility apps.

Finland is my favourite country and a good Finnish friend on IRC by the name of "zutt" recommended Finnish word "laitos" (meaning institute, apparently) to replace the old name "websh". I do not understand the rationale, but it sounds cute enough to name a project.

CircleCI

laitos's People

Contributors

houzuoguo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laitos's Issues

Portability issues on BSD

Compilation failures are observed on FreeBSD, due to missing syscall symbols:

laitos/main_util.go:26:13: undefined: syscall.Mlockall
laitos/main_util.go:175:58: undefined: syscall.TCGETS
laitos/main_util.go:185:65: undefined: syscall.TCSETS

feature idea - Laitos hosted notification service

Yeah.. So. Progressive web applications are a thing on phones nowdays, been for a while. And desktops support same functionality to a certain extent.

So I had this feature idea: Laitos hosted notification service done with javascript using:

  • Progressive web application technology on phones to register persistent service workers on phones
  • Service workers on desktop
  • http(S) as the rest backend
  • http(S) upgrade connections - websockets as the backend.

ideas of features of these notifications:

  • Send & forget
  • send & require confirmation
    IE: send notification -> user clicks it -> notification launches another action (laitos http page or something) that includes ticking off the notification, otherwise keep sending it periodically to the user
  • Other applications should be able to send these notifications using rest/websockets (ie, bash script that can just fire off curl requests ๐Ÿ˜)
  • Notifications should have importance priority (no vibrating phones or playing notification sounds at night if low priority)
  • SIMPLE this needs to be veeeeery simple to the end user and developers sending these notifications

Needed testing:

  • websockets vs time.tick-like XHR requests - Mainly for the convenience/speed and the battery consumption on mobile, on desktop websockets are great. We can even let the user decide which one to pick in fact
  • other things?

Should this be a stand alone thing or included in laitos? (I'm eventually going to make a standalone service out of this idea, but Laitos would be great place to actually test this out)

If this gets wind under its wings, I wouldn't mind implementing the clientside stuff (JS, progressive app, everything related to the client side), would someone be interested in implementing the laitos side of things?

๐Ÿ‘ / ๐Ÿ‘Ž?

stuff related to this.
https://developers.google.com/web/progressive-web-apps/
https://developers.google.com/web/fundamentals/primers/service-workers/
https://developers.google.com/web/fundamentals/codelabs/offline/

Lack of clean-up after ramdisk usage

If the password web server is used to launch laitos from encrypted data archive, laitos doesn't automatically release its ramdisk and remove its temporary directory after exiting.

I need a way to do "atexit".

Present aggregated traffic stats in health check

In health check output, present the total count and average processing time of

  • Succeeded HTTP requests (2xx)
  • Failed HTTP requests
  • DNS requests in both TCP and UDP server
  • SMTP conversations
  • .. other daemons that could present this information

Periodically acquire latest public IP for daemons' operation

Several daemons such as DNS server need to know server's public IP address, this is conducted only once when program starts up. However, if server IP changes, the daemons will continue to operate based on stale invalid IP address.

Correct the behaviour so that every daemon that needs public IP address will fetch it periodically.

Improve supervisor by auto-restarting laitos process in case of crash

Implement the following behaviour in supervisor:

  • Upon start, fork laitos main process that runs all daemons.
  • When the main process crashes, restart the main process up to two times.
  • Should more crashes occur, shed daemons one by one in consecutive crashes, in the following order:
    • maintenance
    • dnsd
    • sockd
    • smtpd
    • httpd
    • insecurehttpd
    • telegram
    • plainsocket
  • If the last remaining daemon still crashes, then cease shedding daemons and only relaunch main process with all daemons enabled in case of further crash.

The rationale works very well for aircraft checklists, I suppose it should also work in this case.

Allow spaces in the command line

Small feature request:

sudo ./laitos -gomaxprocs 16 -config sample-config.json.txt -daemons dnsd,httpd,insecurehttpd,maintenance,plainsocket,serialport,simpleipsvcd,smtpd,snmpd,sockd,telegram

is rather long, but breaking it up with \ newlines and spaces broke it. Making the command more "whitespace-tolerant" would be nice.

Let servers unlock each other's program data

In the likely case of system upgrade triggered reboot, or the unlikely case of fault triggered reboot, a server with encrypted program data will need to be manually unlocked by entering decryption password. It is a small hassle.

If there are more than one instances of laitos deployed and online at a time, it would be quite convenient to tell an online laitos instance to decrypt an instance awaiting password input.

Support SMTP over TLS in addition to StartTLS for outgoing mail configuration

Hi @HouzuoGuo,

Would you write a how to for Outgoing mail configuration for SMTP server (via SSL Mail) please?

Azure does not block SSL Mail port 465. I can test it out after you've written it.
If you need Go code that can send SSL Mail, I can look it up for you, but it's the most common one that I used and connect to SMTP server via SSL Mail and send mail just fine.

thanks

create minimal example conf for laitos to just get_started in less then 5min

i wanted to share some small points from my pov about laitos doc, that could be improved afaik.

  • putting documentation in a wiki, from my pov can decrease contributors to improve the documentation of the project. At least i would prefer the doc and or Readme.md ( each pr can improve documentation directly in this way)

  • on the getting started, would be nice to have at least a minimal to go example/muster that would not require the full reading of doc/conf files, just a simple quickstart

Brainstorming new feature ideas

  • As of now laitos works the same way for all Twilio phone number connected with it. Think of a way to distinguish between the connected phone numbers, and allow configured app command shortcuts to execute on backup numbers (See also #44)
  • Allow certain configured app command shortcuts to execute even if global lockdown is in effect (see also #43)
  • Extend the existing "recurring app command" feature to execute alarm detection parameters, and sends out notifications when an alarm is raised (see also #36)
  • Create a new daemon for generating push notifications, each notification entry can be a piece of text collected from web API invocation, a generated alarm, response from a recurring app command, or something else (see also #29)

Allow some app commands to execute even if lockdown is in effect

Tonight Unity office in Helsinki kindly hosted the October golang meet-up, during which I gave a short introduction and live demo of couple of laitos features. A fellow geek suggested that self destruct command shall remain accessible even when lockdown is in effect, which is indeed a good idea. Find a way to get it done ๐Ÿ‘

Very rare crash due to error: string with NUL passed to StringToUTF16

The error occurs on windows exclusively and happens rarely. There is no clue as to what triggers the error - it may happen as soon as daemons are started or as late as after hundreds of hours of uptime. The error leads to a panic which is subsequently recovered by supervisor.

Unfortunately supervisor for some reason won't capture the entire stack trace, and the only clue so far is an error simply stating "string with NUL passed to StringToUTF16".

Two minor issues with benchmark run

  • The total processing seconds accounted for daemon stats appear to be abnormally high during a benchmark run. Is this an indication of some sort of FD leak?
    (Comment: more probably the daemons may not have closed client socket early enough, and they had to wait for IO timeout)

  • Benchmark isn't using UDP as much as it uses TCP, very strange.

Supress "conflict" response from being logged via calling telegram bot API

Nowadays telegram bot API gives an error HTTP response when more than one servers are polling on the same account:

HTTP 409: {"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}

Nevertheless, the API succeeds in retrieving pending message in the next round. Therefore, suppress logging of the conflict HTTP API response.

Consider regularly restarting main program via the supervisor

Due to rather hideous issues deep inside laitos or one of the popular cloud platforms, laitos DNS and sock daemon appears to grow "tired" after unpredictable amount of uptime, generally between 2-7 days.

Symptom being that both daemons begin to perform very slowly at around the same time, yet none of the daemon reports rate limit being exceeded. One very rare case even caused laitos to crash - and subsequently supervisor did its proper job to relaunch laitos. Unfortunately the program log was lost before it could be inspected.

So while this issue demands more investigation, implement a temporary measure in supervisor that relaunches laitos regularly, interval of which is defined by user in configuration.

Make an RSS reader

Provide RSS reader via the toolbox feature interface, and by default configure the reader with reputable sources such as BBC.

Periodically re-copy bundled programs into the utility program directory

ElasticBeanstalk is quite weird, it periodically clears /tmp directory and leaves nothing but supervisor socket behind, this causes the utility program directory to disappear. Therefore, periodically re-copy those bundled programs similar to how the pseudo-random number generator is reseeded.

Rare crash in featureset.SelfTest routine

The following crash was captured recently and has never been seen before:

github.com/HouzuoGuo/laitos/toolbox.(*WolframAlpha).SelfTest(0xc4200017e8, 0x12031, 0x0)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/toolbox/wolframalpha.go:30 +0x30a
github.com/HouzuoGuo/laitos/toolbox.(*FeatureSet).SelfTest.func1(0xc4204b1800, 0xc42036f300, 0xc4204b1810, 0xaea440, 0xc4200017e8)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/toolbox/feature_set.go:70 +0x49
created by github.com/HouzuoGuo/laitos/toolbox.(*FeatureSet).SelfTest
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/toolbox/feature_set.go:69 +0x190

Improve responsiveness of info HTTP endpoint

The information HTTP endpoint does way too many things, consequently it is way too slow to load.

It will be better to remove configuration validation from the info output, so that the output solely focuses on general stats.

Occasionally http daemon encounters a panic during initialisation routine

As noticed and recovered by supervisor:

panic: http: multiple registrations for /
goroutine 384 [running]:
net/http.(*ServeMux).Handle(0xc4203a94d0, 0xc4200136a8, 0x1, 0x9bd820, 0xc4202b5460)
/home/howard/go/src/net/http/server.go:2270 +0x627
net/http.(*ServeMux).HandleFunc(0xc4203a94d0, 0xc4200136a8, 0x1, 0xc4202b5460)
/home/howard/go/src/net/http/server.go:2302 +0x55
github.com/HouzuoGuo/laitos/daemon/httpd.(*Daemon).Initialise(0xc4201326e0, 0xc42047a6f0, 0xc4203263c0)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/daemon/httpd/httpd.go:175 +0x409
github.com/HouzuoGuo/laitos/launcher.Config.GetHTTPD.func1()
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/launcher/config.go:308 +0x512
sync.(*Once).Do(0xc420419ab0, 0xc4201e2690)
/home/howard/go/src/sync/once.go:44 +0xbe
github.com/HouzuoGuo/laitos/launcher.Config.GetHTTPD(0xc420000f00, 0xc420013840, 0xb, 0xc42005f400, 0x11, 0x9dd, 0xc420013830, 0x6, 0xc42008c140, 0x45, ...)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/launcher/config.go:206 +0x89
main.main.func2(0xc4203e9140, 0xc420081b00)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/main.go:264 +0x57
created by main.main

Create a new daemon that sends out alarm notifications upon customised trigger conditions

The new daemon collects configuration input on alarm name, methods of notification (telephone, SMS, email, satellite, or any combination), and trigger conditions such as:

  • Disk usage on / (built-in)
  • Free memory (built-in)
  • Shell script that normally exits with status 0 (customised input)

Then, the daemon runs in background and periodically checks the trigger conditions, interval of which is also customised by configuration input.

Consecutive failures in trigger conditions will not cause more notifications to be delivered, however, when trigger conditions are no longer present, notifications will tell that alarm conditions are no longer triggered.

For example:

An alarm called "disk usage threshold exceeded" is configured to send notification via telephone call, SMS, and email, the alarm checks disk usage on / at 3 minutes interval and triggers when the usage exceeds 95%.

Rare crash in sockd

This crash has never been observed in the past:

crypto/cipher.(*ctr).refill(0xc4210b2eb0)
/home/howard/go/src/crypto/cipher/ctr.go:54 +0x1bf
crypto/cipher.(*ctr).XORKeyStream(0xc4210b2eb0, 0xc42110f081, 0x1ccd, 0x1ccd, 0xc421159581, 0x1ccd, 0x1ccd)
/home/howard/go/src/crypto/cipher/ctr.go:76 +0x1db
github.com/HouzuoGuo/laitos/daemon/sockd.(*Cipher).Encrypt(0xc420773a40, 0xc42110ea00, 0x234e, 0x234e, 0xc421158f00, 0x234e, 0x234e)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/daemon/sockd/sockd.go:193 +0x6f
github.com/HouzuoGuo/laitos/daemon/sockd.(*TCPCipherConnection).Write(0xc420be10a0, 0xc421158f00, 0x234e, 0x234e, 0x0, 0x0, 0xb25600)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/daemon/sockd/tcp.go:135 +0x111
github.com/HouzuoGuo/laitos/daemon/sockd.PipeTCPConnection(0xaebdc0, 0xc420cec1c8, 0xaebd00, 0xc420be10a0, 0xaebd00)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/daemon/sockd/tcp.go:246 +0x1f8
github.com/HouzuoGuo/laitos/daemon/sockd.(*TCPCipherConnection).HandleTCPConnection(0xc420be10a0)
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/daemon/sockd/tcp.go:234 +0x41a
created by github.com/HouzuoGuo/laitos/daemon/sockd.(*Daemon).StartAndBlockTCP
/home/howard/gopath/src/github.com/HouzuoGuo/laitos/daemon/sockd/tcp.go:58 +0x46e

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.