diff options
author | root <root@darth_serious> | 2014-05-12 14:00:11 +0200 |
---|---|---|
committer | root <root@darth_serious> | 2014-05-12 14:02:46 +0200 |
commit | 9c34e20898def5954da2f50fdc6036209521b5f8 (patch) | |
tree | 064075d02febdff495cf2a0457b552c25a40ad8b | |
parent | 92d73fb495314e29195c0979fa939cd98e952efc (diff) |
fix new reaktor config
-rw-r--r-- | elchos/root-image/etc/systemd/system/Reaktor.service | 14 | ||||
-rwxr-xr-x | elchos/root-image/krebs/bin/reaktor-shell.sh | 2 | ||||
-rw-r--r-- | elchos/root-image/krebs/config.sh | 1 | ||||
-rw-r--r-- | elchos/root-image/krebs/etc/Reaktor/elchos/admin.lst (renamed from elchos/root-image/krebs/etc/Reaktor/admin.lst) | 0 | ||||
-rw-r--r-- | elchos/root-image/krebs/etc/Reaktor/elchos/auth.lst (renamed from elchos/root-image/krebs/etc/Reaktor/auth.lst) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/ftpget (renamed from elchos/root-image/krebs/etc/Reaktor/commands/ftpget) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/identify (renamed from elchos/root-image/krebs/etc/Reaktor/commands/identify) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/io (renamed from elchos/root-image/krebs/etc/Reaktor/commands/io) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/ips (renamed from elchos/root-image/krebs/etc/Reaktor/commands/ips) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/list_downloads (renamed from elchos/root-image/krebs/etc/Reaktor/commands/list_downloads) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/onion (renamed from elchos/root-image/krebs/etc/Reaktor/commands/onion) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/reboot (renamed from elchos/root-image/krebs/etc/Reaktor/commands/reboot) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/refresh_shares (renamed from elchos/root-image/krebs/etc/Reaktor/commands/refresh_shares) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/shares (renamed from elchos/root-image/krebs/etc/Reaktor/commands/shares) | 0 | ||||
-rwxr-xr-x | elchos/root-image/krebs/etc/Reaktor/elchos/commands/update_search (renamed from elchos/root-image/krebs/etc/Reaktor/commands/update-search) | 0 | ||||
-rw-r--r-- | elchos/root-image/krebs/etc/Reaktor/elchos/config.py (renamed from elchos/root-image/krebs/etc/Reaktor/config.py) | 45 | ||||
-rwxr-xr-x | elchos/root-image/root/customize_root_image.sh | 4 |
17 files changed, 47 insertions, 19 deletions
diff --git a/elchos/root-image/etc/systemd/system/Reaktor.service b/elchos/root-image/etc/systemd/system/Reaktor.service new file mode 100644 index 00000000..e57be81a --- /dev/null +++ b/elchos/root-image/etc/systemd/system/Reaktor.service @@ -0,0 +1,14 @@ +[Unit] +Description=Reaktor for user %i +After=network.target nss-lookup.target + +[Service] +Type=normal +#TODO - make reaktor path variable +User=reaktor +ExecStart=/krebs/painload/Reaktor/index elchos/config.py +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target diff --git a/elchos/root-image/krebs/bin/reaktor-shell.sh b/elchos/root-image/krebs/bin/reaktor-shell.sh index 117c64f6..c5548cb8 100755 --- a/elchos/root-image/krebs/bin/reaktor-shell.sh +++ b/elchos/root-image/krebs/bin/reaktor-shell.sh @@ -1,4 +1,4 @@ #!/bin/sh echo "IP Addresses:" -/krebs/painload/Reaktor/commands/ips || echo "no IPs!" +/krebs/painload/Reaktor/elchos/commands/ips || echo "no IPs!" /krebs/bin/add-reaktor-secret.sh diff --git a/elchos/root-image/krebs/config.sh b/elchos/root-image/krebs/config.sh new file mode 100644 index 00000000..a2b4d202 --- /dev/null +++ b/elchos/root-image/krebs/config.sh @@ -0,0 +1 @@ +IRC_SERVER=irc.freenode.net diff --git a/elchos/root-image/krebs/etc/Reaktor/admin.lst b/elchos/root-image/krebs/etc/Reaktor/elchos/admin.lst index e69de29b..e69de29b 100644 --- a/elchos/root-image/krebs/etc/Reaktor/admin.lst +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/admin.lst diff --git a/elchos/root-image/krebs/etc/Reaktor/auth.lst b/elchos/root-image/krebs/etc/Reaktor/elchos/auth.lst index e69de29b..e69de29b 100644 --- a/elchos/root-image/krebs/etc/Reaktor/auth.lst +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/auth.lst diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/ftpget b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/ftpget index 74e76f8e..74e76f8e 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/ftpget +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/ftpget diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/identify b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/identify index c2fb2c58..c2fb2c58 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/identify +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/identify diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/io b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/io index eb04ae9b..eb04ae9b 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/io +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/io diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/ips b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/ips index 17c39658..17c39658 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/ips +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/ips diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/list_downloads b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/list_downloads index f53067d8..f53067d8 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/list_downloads +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/list_downloads diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/onion b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/onion index 1a202991..1a202991 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/onion +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/onion diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/reboot b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/reboot index a264831a..a264831a 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/reboot +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/reboot diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/refresh_shares b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/refresh_shares index 1005998b..1005998b 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/refresh_shares +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/refresh_shares diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/shares b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/shares index 1601d584..1601d584 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/shares +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/shares diff --git a/elchos/root-image/krebs/etc/Reaktor/commands/update-search b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/update_search index 1db1c1b2..1db1c1b2 100755 --- a/elchos/root-image/krebs/etc/Reaktor/commands/update-search +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/commands/update_search diff --git a/elchos/root-image/krebs/etc/Reaktor/config.py b/elchos/root-image/krebs/etc/Reaktor/elchos/config.py index 58bc7180..a850b7ae 100644 --- a/elchos/root-image/krebs/etc/Reaktor/config.py +++ b/elchos/root-image/krebs/etc/Reaktor/elchos/config.py @@ -1,15 +1,24 @@ import socket +name = socket.gethostname() +source = "/krebs/config.sh" -debug = False +# TODO: shell config file cannot contain variables or anything fancy +ret ={} +with open(cfg_file) as f: + for line in f: + k,v = line.split("=") + ret[k] = v -name = socket.gethostname() +#irc_server = 'irc.freenode.net' +irc_server = ret["IRC_SERVER"] +debug = False + +state_dir='/krebs/painload/Reaktor' irc_alarm_timeout = 300 irc_hammer_interval = 10 irc_kill_timeout = 360 irc_nickname = name -irc_server = 'elchirc.nsupdate.info' -#irc_server = 'irc.freenode.net' irc_restart_timeout = 5 irc_port = 6667 irc_channels = [ @@ -25,18 +34,24 @@ def default_command(cmd): 'pattern': '^(?:' + name + '|\\*):\\s*' + cmd + '\\s*(?:\\s+(?P<args>.*))?$', 'argv': [ 'commands/' + cmd ] } +def elch_command(cmd): + return { + 'capname': cmd, + 'pattern': '^(?:' + name + '|\\*):\\s*' + cmd + '\\s*(?:\\s+(?P<args>.*))?$', + 'argv': [ 'elchos/commands/' + cmd ] } + public_commands = [ default_command('caps'), default_command('hello'), - default_command('search'), - default_command('list_downloads'), + default_command('uptime'), default_command('badcommand'), default_command('rev'), - default_command('io'), - default_command('ips'), - default_command('uptime'), - default_command('shares'), - default_command('onion'), + elch_command('search'), + elch_command('list_downloads'), + elch_command('io'), + elch_command('ips'), + elch_command('shares'), + elch_command('onion'), default_command('nocommand'), # command not found { 'pattern': '^(?:' + name + '|\\*):.*', @@ -53,8 +68,8 @@ public_commands = [ commands = [ default_command('reload'), - default_command('update-search'), - default_command('refresh_shares'), - default_command('ftpget'), - default_command('reboot') + elch_command('update_search'), + elch_command('refresh_shares'), + elch_command('ftpget'), + elch_command('reboot') ] diff --git a/elchos/root-image/root/customize_root_image.sh b/elchos/root-image/root/customize_root_image.sh index 1c6abea0..59166853 100755 --- a/elchos/root-image/root/customize_root_image.sh +++ b/elchos/root-image/root/customize_root_image.sh @@ -52,9 +52,7 @@ echo "$reaktor_user ALL=(tor) NOPASSWD: /krebs/bin/tor-get-hidden-service.sh" >> echo "$reaktor_user ALL=(root) NOPASSWD: /krebs/bin/refresh-shares.ship" >> /etc/sudoers.d/reaktor echo "$reaktor_user ALL=($ncdc_user) NOPASSWD: ALL" >> /etc/sudoers.d/reaktor echo "$reaktor_user ALL=(root) NOPASSWD: /usr/bin/reboot" >> /etc/sudoers.d/reaktor -echo -cp /krebs/painload/Reaktor/etc/systemd/system/Reaktor@.service \ - /etc/systemd/system + # add bonus features for elch cp -a /krebs/etc/Reaktor /krebs/painload |