A RestAPI MicroService GateWay for Linux
api-routerd is a cloud-enabled, mobile-ready, a super light weight remote management tool which uses REST API for real time configuration and performance as well as health monitoring for systems (containers) and applications. It provides fast API based monitoring without affecting the system it's running on.
- Platform independent REST APIs can be accessed via any application (curl, chrome, PostMan ...) from any OS (Linux, IOS, Android, Windows ...)
- An Iphone App Demo using REST APIS
- Minimal data transfer using JSON.
- Plugin based Architechture. See how to write plugin section for more information.
- systemd socket activation support
- systemd
- systemd informations
- services (start, stop, restart, status)
- service properties for example CPUShares
- See service logs.
- networkd config
- .network
- .netdev
- .link
- configure hostnamed
- configure users using login (list-sessions, list-users and terminate-user etc)
- configure timdate
- configure nameserver
/etc/resolv.conf
- configure timesynd
- configure journald.conf
- configure system.conf
- configure coredump.conf
- configure systemd-resolved.conf
- configure kernel modules (modprobe, lsmod, rmmod)
- configure network (netlink)
- Link: mtu, up, down
- Create bridge and enslave links
- Adddress: Set, Get, Delete
- Gateway: Default Gateway Add and Delete
- configure group add/delete/modify
- configure users add/delete/modify (requires newuser)
- configure sysctl add/delete/modify and apply
- see information from /proc such as netstat, netdev, memory and much more
- configure
/proc/sys/net
(core/ipv4/ipv6), VM - See ethtool information and configure offload features
- See sudoers and sshd conf
Refer spreadsheet APIs
api-routerd uses a number of open source projects to work properly:
And of course api-routerd itself is open source with a public repository on GitHub.
Want to contribute? Great!
First configure your $GOPATH
. If you have already done this skip this step.
# keep in ~/.bashrc
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export OS_OUTPUT_GOPATH=1
Clone inside src dir of $GOPATH
. In my case
$ pwd
/home/sus/go/src
$ go get github.com/RestGW/api-routerd
$ git clone https://github.com/RestGW/api-routerd
$ cd api-routerd
$ pwd
/home/sus/go/src/api-routerd
$ go build -v
$ sudo ./api-routerd
INFO[0000] api-routerd: v0.1 (built go1.11.4)
INFO[0000] Start Server at 0.0.0.0:8080
INFO[0000] Starting api-routerd in plain text mode
Conf dir: /etc/api-routerd/
Conf File: api-routerd.toml
$ cat /etc/api-routerd/api-routerd.toml
[Network]
IPAddress="0.0.0.0"
Port="8080"
Add user name and authentication string in space separated lines
# cat /etc/api-routerd/api-routerd-auth.conf
Susant secret
Max bbbb
Joy ccccc
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
$ openssl genrsa -out server.key 2048
Generating RSA private key, 2048 bit long modulus (2 primes)
.......................+++++
.+++++
e is 65537 (0x010001)
openssl genrsa -out server.key 2048
Generation of self-signed(x509) public key (PEM-encodings .pem|.crt) based on the private (.key)
$ openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:
Place server.crt
and server.key
in the dir /etc/api-routerd/tls
[root@Zeus tls]# ls
server.crt server.key
[root@Zeus tls]# pwd
/etc/api-routerd/tls
Use case: https
$ curl --header "X-Session-Token: secret" --request GET https://localhost:8080/api/network/ethtool/vmnet8/get-link-features -k --tlsv1.2
Refer usecase document use cases
api-routerd is designed with plugin based architecture in mind and can act as a thin client. You can always add and remove modules to it with minimal effort
- Choose namespace under cmd directory ( network, proc, system etc) whare you want to put your module.
- Write sub router see for example
api-routerd/cmd/system/login
- Write your module
module.go
andmodule_router.go
- Write
RegisterRouterModule
- Register
RegisterRouterModule
with parent router for example forlogin
registered withRegisterRouterSystem
undersystem
namespace aslogin.RegisterRouterLogin(n)
- Write Tests
- Networkd
- iptables
Apache 2.0
Free Software, Hell Yeah!