Skip to content

chkumar246/api-routerd

Repository files navigation

api-routerd

N|Solid

A RestAPI MicroService GateWay for Linux

Build Status CircleCI Build Status HitCount CodeFactor codebeat badge Go Report Card Codacy Badge License Coverage Status

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.

Features!

  • 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

api-routerd JSON APIs

Refer spreadsheet APIs

Tech

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.

Development

Want to contribute? Great!

Installation

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

Installation

$ 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

How to configure IP and Port ?

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"

How to configure users ?

Add user name and authentication string in space separated lines

# cat /etc/api-routerd/api-routerd-auth.conf
Susant secret
Max bbbb
Joy ccccc

How to configure TLS ?

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

Use cases

Refer usecase document use cases

How to write your own plugin ?

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 and module_router.go
  • Write RegisterRouterModule
  • Register RegisterRouterModule with parent router for example for login registered with RegisterRouterSystem under system namespace as login.RegisterRouterLogin(n)

Todos

  • Write Tests
  • Networkd
  • iptables

License

Apache 2.0

Free Software, Hell Yeah!

About

A REST API Microservice Gateway for Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.3%
  • Makefile 0.7%
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy