Author : Thomas de Grivel
Date : 2020-04-10T19:07:41
|Public access ?||public|
UNIX system administration in Common Lisp
|Disk usage||0.00 kB|
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)'
$ cd ~/common-lisp/cl-adams/adams $ make $ sudo cp build/adams /usr/local/bin/adams
~/.emacs file :
;; Adams (add-to-list 'auto-mode-alist '("\\.adams\\'" . lisp-mode))
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
tutorial.adams script will synchronize the host “adams.kmx.io”
according to the resource specifications given in the file.
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*))