blob: 5e6def5d82bb3463602b840d3263d6242b2372fa (
plain)
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
|
#@include core
#@include network
ncdc_user=${ncdc_user:-hooker}
ncdc_bin=${ncdc_bin:-/usr/bin/ncdc}
ncdc_config(){
# maybe we want to use the running ncdc process and communicate via tmux send-keys ?
(sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user "$ncdc_bin"
}
ncdc_configure_netshare(){
:${1?provide path to share}
rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom`
rnd_name="share_$rnd"
info "setting active as true"
info "adding share"
(echo "/set active true" ;
echo "/share $rnd_name $1") | ncdc_config
}
ncdc_configure_nick(){
nick=${1?nick must be provided}
info "configuring DC Nick: $nick"
echo "/nick $nick" | ncdc_config
}
ncdc_configure_hub(){
rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom`
hubname="hub_$rnd"
hub=${1?adcs://localhost:2781}
info "configuring DC Hub: $hub, activating autconnect"
(echo "/open ${hubname} ${hub}" ;
echo "/hset autoconnect true") | ncdc_config
}
ncdc_install(){
install_dir="$(dirname "${ncdc_bin}")"
info "installing ncdc to $install_dir"
curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C "$install_dir"
useradd -m $ncdc_user ||:
}
ncdc_autostart(){
# only systemd
# punani install tmux
cat > /etc/systemd/system/ncdc@.service <<EOF
[Unit]
Description=ncdc
Requires=network.target local-fs.target
[Service]
Type=oneshot
RemainAfterExit=yes
KillMode=none
User=%I
ExecStart=/usr/bin/tmux new-session -s dcpp -n ncdc -d ncdc
ExecStop=/usr/bin/tmux send-keys -t dcpp:ncdc "/quit" C-m
[Install]
WantedBy=multi-user.target
EOF
systemctl enable ncdc@$ncdc_user
}
install_tor_announce(){
# systemd only
cat > /etc/systemd/system/tor_announce.service<<EOF
[Unit]
Description=Announce Tor Hidden Address
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/tor_announce
[Install]
WantedBy=multi-user.target
EOF
http_get conf.krebsco.de/tor_publish_ssh > /usr/bin/tor_annouce
chmod +x /usr/bin/tor_annouce
systemctl enable tor_announce
systemctl start tor_announce
}
|