Hash :
b920b927
Author :
Thomas de Grivel
Date :
2020-04-10T19:30:50
Adams is our new cybernetic DevOps. Please welcome him and make him feel at home, I hope he will find a nice place to work amongst us. So far he’s been a brilliant student though a bit dumb and formal, I hope he will find a warm and welcoming place in our hearts. For the next months he will remain in formation so if you would please consider handing him any rookie task you might have he shall gladly take them upon him and will probably crash the system and need your help to fix it but, hey, that’s what unpaid interns are for, right ?
Adams is currently able to use a local shell or connect to remote hosts via ssh. He is quite the hardcore hacker wannabe using only /bin/sh though ksh and bash suit him fine too. He’s still green but he can already gather basic information about users, groups and files.
We are currently teaching him about new kinds of resources and how to read resource specification manifests.
You should only allow Adams what you would allow your system operators :
All commands issued to the remote hosts can be logged.
Adams does not grant the hosts access to its workstation while it works. Adams does not grant access to data belonging to any host. Adams does not send any data that is not of direct concern to the host. In short, all UNIX permissions are respected, Adams is a regular UNIX user.
$ sbcl --eval '(repo:install :adams)'
adams
binary $ cd ~/common-lisp/cl-adams/adams
$ make
$ sudo cp build/adams /usr/local/bin/adams
In your ~/.emacs
file :
;; Adams
(add-to-list 'auto-mode-alist '("\\.adams\\'" . lisp-mode))
.adams
script
In the tutorial.adams
file :
#!/usr/local/bin/adams --script
(resource 'host "adams.kmx.io"
:user "adams"
(resource 'user "adams"
:shell "/bin/sh"
:ensure :present))
(with-host "adams.kmx.io"
(sync *host*))
$ chmod 755 tutorial.adams
$ ./tutorial.adams
The tutorial.adams
script will synchronize the host “adams.kmx.io”
according to the resource specifications given in the file.
#.(include "file")
In the user/dx.adams
file :
;; Thomas de Grivel (kmx.io)
(resource 'group "dx"
:gid 19256
:ensure :present)
(resource 'user "dx"
:uid 19256
:gid 19256
:home "/home/dx"
:ensure :present)
In your main script :
#!/usr/local/bin/adams --script
(resource 'host "adams.kmx.io"
:user "adams"
(resource 'user "adams"
:shell "/bin/sh"
:ensure :present)
#.(include "user/dx"))
(with-host "adams.kmx.io"
(sync *host*))
;; Copyright YEAR AUTHOR <EMAIL>
;;
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;;
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;
To contribute, fork this repository and send us a pull request.
Please publish under the ISC License terms.
Thomas de Grivel thoxdg@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
Adams
=====
Adams is our new cybernetic DevOps. Please welcome him and make him feel
at home, I hope he will find a nice place to work amongst us. So far he's
been a brilliant student though a bit dumb and formal, I hope he will find
a warm and welcoming place in our hearts.
For the next months he will remain in formation so if you would please
consider handing him any rookie task you might have he shall gladly take
them upon him and will probably crash the system and need your help to fix it
but, hey, that's what unpaid interns are for, right ?
Current status
--------------
Adams is currently able to use a local shell or connect to remote hosts via
ssh.
He is quite the hardcore hacker wannabe using only /bin/sh though ksh and
bash suit him fine too.
He's still green but he can already gather basic information about users,
groups and files.
We are currently teaching him about new kinds of resources and how to read
resource specification manifests.
Security design
---------------
You should only allow Adams what you would allow your system operators :
- a shell accessible through SSH using a public key
- apropriate sudo permissions
All commands issued to the remote hosts can be logged.
Adams does not grant the hosts access to its workstation while it works.
Adams does not grant access to data belonging to any host.
Adams does not send any data that is not of direct concern to the host.
In short, all UNIX permissions are respected, Adams is a regular UNIX user.
Usage
-----
### 1. Install [repo](https://github.com/common-lisp-repo/repo).
### 2. Fetch adams sources.
``` shell
$ sbcl --eval '(repo:install :adams)'
```
### 3. Build and install the `adams` binary
``` shell
$ cd ~/common-lisp/cl-adams/adams
$ make
$ sudo cp build/adams /usr/local/bin/adams
```
### 4. Configure emacs (optional)
In your `~/.emacs` file :
``` emacs-lisp
;; Adams
(add-to-list 'auto-mode-alist '("\\.adams\\'" . lisp-mode))
```
### 5. Write some resources in a `.adams` script
In the `tutorial.adams` file :
``` common-lisp
#!/usr/local/bin/adams --script
(resource 'host "adams.kmx.io"
:user "adams"
(resource 'user "adams"
:shell "/bin/sh"
:ensure :present))
(with-host "adams.kmx.io"
(sync *host*))
```
### 6. Profit.
``` shell
$ chmod 755 tutorial.adams
$ ./tutorial.adams
```
The `tutorial.adams` script will synchronize the host "adams.kmx.io"
according to the resource specifications given in the file.
### 7. DRY up your scripts using `#.(include "file")`
In the `user/dx.adams` file :
``` common-lisp
;; Thomas de Grivel (kmx.io)
(resource 'group "dx"
:gid 19256
:ensure :present)
(resource 'user "dx"
:uid 19256
:gid 19256
:home "/home/dx"
:ensure :present)
```
In your main script :
``` common-lisp
#!/usr/local/bin/adams --script
(resource 'host "adams.kmx.io"
:user "adams"
(resource 'user "adams"
:shell "/bin/sh"
:ensure :present)
#.(include "user/dx"))
(with-host "adams.kmx.io"
(sync *host*))
```
ISC License
-----------
```
;; Copyright YEAR AUTHOR <EMAIL>
;;
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;;
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;
```
Contribute
----------
To contribute, fork this repository and send us a pull request.
Please publish under the
[ISC License](https://en.wikipedia.org/wiki/ISC_license)
terms.
Authors
-------
Thomas de Grivel <thoxdg@gmail.com>