From 0aa26c388dc273af25f4d28e7db631783caef6bb Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Mon, 19 Jun 2017 13:16:04 -0500 Subject: [PATCH] Licensing and Makefile standards --- LICENSE | 27 +++++++++++++++++++++ Makefile | 71 +++++++++++++++++++++++++++++++++----------------------- 2 files changed, 69 insertions(+), 29 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..878d895 --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +# http://www.wtfpl.net/about/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + + ANINIX ADDENDUM + + Trademark Pending 2017 (https://aninix.net/irc/) + + The "AniNIX" name and |> logo is trademark-pending as of 2017. All + AniNIX materials can be reproduced and re-used, though you must + contact the admins of the network to get written permission to use + the AniNIX name. + + Attribution is appreciated for other materials but not legally + required or necessary. diff --git a/Makefile b/Makefile index d5f741a..bbd7958 100644 --- a/Makefile +++ b/Makefile @@ -1,71 +1,84 @@ SHELL := /bin/bash BACKUPDIR := /usr/local/backup +INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash compile: - pacman -S openssl gzip tar openssh - make keys + ${INSTALLER} -S openssl gzip tar openssh -install: +install: compile @echo You must specify client or server in a call to make. client: user aether.bash cp aether.bash /home/aether/aether.bash - chown aether /home/aether/aether.bash - chmod 0700 /home/aether/aether.bash /home/aether/aether.bash - crontab -l > /tmp/cronie + sudo -u aether crontab -l > /tmp/cronie grep aether.bash /tmp/cronie || echo '0 1 * * * /home/aether/aether.bash &>> /var/log/aether.log' >> /tmp/cronie - crontab /tmp/cronie + sudo -u aether crontab /tmp/cronie rm /tmp/cronie touch /var/log/aether.log chown aether:aether /var/log/aether.log + make checkperm -server: scripts user ./aether-gen.bash ./aether.pub ./server-backup +server: keys scripts user ./aether-gen.bash ./aether.pub ./server-backup bash ./aether-gen.bash cp ./aether.pub /home/aether/.ssh/authorized_keys - chmod 0600 /home/aether/.ssh/authorized_keys - chown aether /home/aether/.ssh/authorized_keys + cp ./aether-gen.bash /root/bin/aether-gen.bash mkdir /usr/local/etc/Aether - chown aether /usr/local/etc/Aether - chmod 0700 /usr/local/etc/Aether touch /usr/local/etc/Aether/nodeslist - @echo You have the files. Add aether-gen.bash and server-backup to root's crontab. + mkdir -p ${BACKUPDIR}; + make checkperm + @echo You have the files. Add aether-gen.bash and server-backup to root\'s crontab. @echo Track client nodes in /usr/local/etc/Aether/nodeslist user: aether make-user.bash /bin/bash ./make-user.bash -tar: aether.bash aether make-user.bash - tar cvf aether.tar aether.bash aether Makefile make-user.bash - gzip aether.tar - node-command: - @echo -ne 'bzr checkout bzr://aninix.net/Aether' + @echo USE THE FOLLOWING COMMANDS TO SET UP A NODE. + @echo -ne 'git clone https://aninix.net/foundation/Aether;' @echo @echo -ne 'cd Aether; cat > aether # Paste the private key' @echo @echo -ne 'make client' @echo + @echo MAKE SURE TO ADD THE NODE TO /usr/local/etc/Aether/nodes.list keys: - ssh-keygen -t rsa -P "" -f aether + if [ ! -f ./aether ]; then ssh-keygen -t rsa -P "" -f aether scripts: ./server-backup ./remote-backup cp ./server-backup /root/bin - chmod 0700 /root/bin/server-backup cp ./remote-backup /root/bin - chmod 0700 /root/bin/remote-backup + make checkperm reverse: - cp /root/bin/server-backup . - cp /root/bin/remote-backup . + if [ -f /root/bin/server-backup ]; then cp /root/bin/server-backup .; fi + if [ -f /root/bin/remote-backup ]; then cp /root/bin/remote-backup .; fi + if [ -f /root/bin/aether-gen.bash ]; then cp /root/bin/aether-gen.bash .; fi + if [ -f /home/aether/aether.bash ]; then cp /home/aether/aether.bash .; fi + +diff: + if [ -f /root/bin/server-backup ]; then diff ./server-backup /root/bin/server-backup; fi + if [ -f /root/bin/remote-backup ]; then diff ./remote-backup /root/bin/remote-backup; fi + if [ -f /root/bin/aether-gen.bash ]; then diff ./aether-gen.bash /root/bin/aether-gen.bash; fi + if [ -f /home/aether/aether.bash ]; then diff ./aether.bash /home/aether/aether.bash; fi checkperm: - chmod 0700 /root/bin/remote-backup /root/bin/remote-backup - chown root:root /root/bin/server-backup /root/bin/remote-backup - chmod -R 0700 /usr/local/etc/Aether - chown -R aether:aether /usr/local/etc/Aether - chown postgres:root ${BACKUPDIR} - chmod 0770 ${BACKUPDIR} + id aether; + if [ -d /home/aether ]; then chmod 0600 /home/aether/.ssh/authorized_keys; chmod 0700 /home/aether/.ssh /home/aether; chown -R aether:aether /home/aether; fi + if [ -f /root/bin/remote-backup ]; then chmod 0700 /root/bin/remote-backup; chown root:root /root/bin/remote-backup; fi + if [ -f /root/bin/server-backup ]; then chmod 0700 /root/bin/server-backup; chown root:root /root/bin/server-backup; fi + if [ -d /usr/local/etc/Aether ]; then chmod -R 0700 /usr/local/etc/Aether; chown -R aether:aether /usr/local/etc/Aether; fi + if [ -d ${BACKUPDIR} ]; then chmod 0770 ${BACKUPDIR}; chown postgres:root ${BACKUPDIR}; fi + if [ -f /var/log/aether.log ]; then chown aether:aether /var/log/aether.log; chmod 0750 /var/log/aether.log; fi +clean: + @bash -c 'printf "This will irreversibly destroy all backups. Confirm? [YES/no] " ; read answer; [ "$$answer" == "YES" ] && exit 0; exit 1' + for i in `ls /home/aether/aether*`; do shred $$i; done + rm -Rf /home/aether + userdel aether + find /usr/local/backup -type f -exec shred {} \; + rm -Rf /usr/local/backup; fi +test: + echo bye | sftp -o IdentityFile=/home/aether/.ssh/aether aether@aninix.net