Konstiga fenomen med chroot, OpenDCHub, rc.local-script och OpenBSD 3.7

Permalänk
Medlem

Konstiga fenomen med chroot, OpenDCHub, rc.local-script och OpenBSD 3.7

Som jag nämnde i en tidigare tråd så har jag sattit upp OpenDCHub i en chrootad miljö, /var/opendchub/. För att starta hubben gör jag följande:

[16:22:31][FLAGEL@Amy ~] sudo chroot -g opendchub -u opendchub /var/opendchub opendchub Hub is up and running. Listening for user connections on port 6000 and listening for admin connections on port 53696

Vilket är just så det ska vara.

För att få OpenDCHub att starta vid varje boot la jag till detta script i /etc/rc.local:

if [ X"${opendchub_flags}" != X"NO" -a -x /var/opendchub/bin/opendchub ]; then echo -n ' opendchub'; chroot -g opendchub -u opendchub /var/opendchub opendchub fi

Vid boot så körs OpenDCHub igång men resultatet blir inte detsamma som "sudo chroot -g opendchub -u opendchub /var/opendchub opendchub" i shell. Den hittar inte configfilerna och frågar efter de värden man ställer in när man kör igång OpenDCHub för första gången.

För att vara säker på att det inte skulle vara behörighetsproblem så har jag kört "chmod -R 777 *" i /var/opendchub/.

Jag kan verkligen inte komma på felet. >.<

ls -laphR:

total 24 drwxr-xr-x 6 root wheel 512B Aug 1 16:34 ./ drwxr-xr-x 24 root wheel 512B Aug 1 15:47 ../ drwxrwxrwx 2 root wheel 512B Aug 1 15:19 bin/ drwxrwxrwx 4 root wheel 512B Aug 1 16:34 config/ drwxrwxrwx 5 opendchub opendchub 512B Aug 1 16:28 home/ drwxrwxrwx 4 root wheel 512B Aug 1 00:26 usr/ ./bin: total 776 drwxrwxrwx 2 root wheel 512B Aug 1 15:19 ./ drwxr-xr-x 6 root wheel 512B Aug 1 16:34 ../ -rwxrwxrwx 1 root wheel 357K Aug 1 00:18 opendchub ./config: total 16 drwxrwxrwx 4 root wheel 512B Aug 1 16:34 ./ drwxr-xr-x 6 root wheel 512B Aug 1 16:34 ../ drwxrwxrwx 3 root wheel 512B Aug 1 16:34 .opendchub/ drwxrwxrwx 2 root wheel 512B Aug 1 16:34 tmp/ ./config/.opendchub: total 40 drwxrwxrwx 3 root wheel 512B Aug 1 16:34 ./ drwxrwxrwx 4 root wheel 512B Aug 1 16:34 ../ -rwxrwxrwx 1 root wheel 0B Aug 1 16:34 allowlist -rwxrwxrwx 1 root wheel 0B Aug 1 16:34 banlist -rwxrwxrwx 1 root wheel 735B Aug 1 16:34 config -rwxrwxrwx 1 root wheel 0B Aug 1 16:34 linklist -rwxrwxrwx 1 root wheel 9.0K Aug 1 16:34 log -rwxrwxrwx 1 root wheel 86B Aug 1 16:34 motd -rwxrwxrwx 1 root wheel 0B Aug 1 16:34 nickbanlist -rwxrwxrwx 1 root wheel 0B Aug 1 16:34 op_permlist -rwxrwxrwx 1 root wheel 0B Aug 1 16:34 reglist drwxrwxrwx 2 root wheel 512B Aug 1 16:34 scripts/ ./config/.opendchub/scripts: total 24 drwxrwxrwx 2 root wheel 512B Aug 1 16:34 ./ drwxrwxrwx 3 root wheel 512B Aug 1 16:34 ../ -rwxrwxrwx 1 root wheel 3.7K Aug 1 16:34 functestbot.plz -rwxrwxrwx 1 root wheel 2.8K Aug 1 16:34 subtestbot.plz ./config/tmp: total 8 drwxrwxrwx 2 root wheel 512B Aug 1 16:34 ./ drwxrwxrwx 4 root wheel 512B Aug 1 16:34 ../ ./home: total 20 drwxrwxrwx 5 opendchub opendchub 512B Aug 1 16:28 ./ drwxr-xr-x 6 root wheel 512B Aug 1 16:34 ../ drwxrwxrwx 4 opendchub opendchub 512B Aug 1 00:58 FLAGEL/ drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 opendchub/ drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 root/ ./home/FLAGEL: total 16 drwxrwxrwx 4 opendchub opendchub 512B Aug 1 00:58 ./ drwxrwxrwx 5 opendchub opendchub 512B Aug 1 16:28 ../ drwxrwxrwx 3 opendchub opendchub 512B Aug 1 16:26 .opendchub/ drwxrwxrwx 2 opendchub opendchub 512B Aug 1 16:26 tmp/ ./home/FLAGEL/.opendchub: total 40 drwxrwxrwx 3 opendchub opendchub 512B Aug 1 16:26 ./ drwxrwxrwx 4 opendchub opendchub 512B Aug 1 00:58 ../ -rwxrwxrwx 1 opendchub opendchub 0B Aug 1 16:22 allowlist -rwxrwxrwx 1 opendchub opendchub 0B Aug 1 16:22 banlist -rwxrwxrwx 1 opendchub opendchub 735B Aug 1 16:26 config -rwxrwxrwx 1 opendchub opendchub 0B Aug 1 01:21 linklist -rwxrwxrwx 1 opendchub opendchub 9.0K Aug 1 16:26 log -rwxrwxrwx 1 opendchub opendchub 86B Aug 1 03:54 motd -rwxrwxrwx 1 opendchub opendchub 0B Aug 1 16:22 nickbanlist -rwxrwxrwx 1 opendchub opendchub 0B Aug 1 01:21 op_permlist -rwxrwxrwx 1 opendchub opendchub 0B Aug 1 01:21 reglist drwxrwxrwx 2 opendchub opendchub 512B Aug 1 00:23 scripts/ ./home/FLAGEL/.opendchub/scripts: total 24 drwxrwxrwx 2 opendchub opendchub 512B Aug 1 00:23 ./ drwxrwxrwx 3 opendchub opendchub 512B Aug 1 16:26 ../ -rwxrwxrwx 1 opendchub opendchub 3.7K Aug 1 01:21 functestbot.plz -rwxrwxrwx 1 opendchub opendchub 2.8K Aug 1 01:21 subtestbot.plz ./home/FLAGEL/tmp: total 8 drwxrwxrwx 2 opendchub opendchub 512B Aug 1 16:26 ./ drwxrwxrwx 4 opendchub opendchub 512B Aug 1 00:58 ../ ./home/opendchub: total 16 drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 5 opendchub opendchub 512B Aug 1 16:28 ../ drwxrwxrwx 3 root opendchub 512B Aug 1 16:28 .opendchub/ drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 tmp/ ./home/opendchub/.opendchub: total 40 drwxrwxrwx 3 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 ../ -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 allowlist -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 banlist -rwxrwxrwx 1 root opendchub 735B Aug 1 16:28 config -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 linklist -rwxrwxrwx 1 root opendchub 9.0K Aug 1 16:28 log -rwxrwxrwx 1 root opendchub 86B Aug 1 16:28 motd -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 nickbanlist -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 op_permlist -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 reglist drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 scripts/ ./home/opendchub/.opendchub/scripts: total 24 drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 3 root opendchub 512B Aug 1 16:28 ../ -rwxrwxrwx 1 root opendchub 3.7K Aug 1 16:28 functestbot.plz -rwxrwxrwx 1 root opendchub 2.8K Aug 1 16:28 subtestbot.plz ./home/opendchub/tmp: total 8 drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 ../ ./home/root: total 16 drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 5 opendchub opendchub 512B Aug 1 16:28 ../ drwxrwxrwx 3 root opendchub 512B Aug 1 16:28 .opendchub/ drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 tmp/ ./home/root/.opendchub: total 40 drwxrwxrwx 3 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 ../ -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 allowlist -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 banlist -rwxrwxrwx 1 root opendchub 735B Aug 1 16:28 config -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 linklist -rwxrwxrwx 1 root opendchub 9.0K Aug 1 16:28 log -rwxrwxrwx 1 root opendchub 86B Aug 1 16:28 motd -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 nickbanlist -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 op_permlist -rwxrwxrwx 1 root opendchub 0B Aug 1 16:28 reglist drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 scripts/ ./home/root/.opendchub/scripts: total 24 drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 3 root opendchub 512B Aug 1 16:28 ../ -rwxrwxrwx 1 root opendchub 3.7K Aug 1 16:28 functestbot.plz -rwxrwxrwx 1 root opendchub 2.8K Aug 1 16:28 subtestbot.plz ./home/root/tmp: total 8 drwxrwxrwx 2 root opendchub 512B Aug 1 16:28 ./ drwxrwxrwx 4 root opendchub 512B Aug 1 16:28 ../ ./usr: total 16 drwxrwxrwx 4 root wheel 512B Aug 1 00:26 ./ drwxr-xr-x 6 root wheel 512B Aug 1 16:34 ../ drwxrwxrwx 2 root wheel 512B Aug 1 00:33 lib/ drwxrwxrwx 2 root wheel 512B Aug 1 00:33 libexec/ ./usr/lib: total 5936 drwxrwxrwx 2 root wheel 512B Aug 1 00:33 ./ drwxrwxrwx 4 root wheel 512B Aug 1 00:26 ../ -rwxrwxrwx 1 root wheel 677K Aug 1 00:33 libc.so.34.2 -rwxrwxrwx 1 root wheel 998K Aug 1 00:33 libcrypto.so.11.0 -rwxrwxrwx 1 root wheel 88.0K Aug 1 00:33 libm.so.2.0 -rwxrwxrwx 1 root wheel 1.0M Aug 1 00:33 libperl.so.10.0 -rwxrwxrwx 1 root wheel 59.8K Aug 1 00:33 libutil.so.11.0 ./usr/libexec: total 76 drwxrwxrwx 2 root wheel 512B Aug 1 00:33 ./ drwxrwxrwx 4 root wheel 512B Aug 1 00:26 ../ -rwxrwxrwx 1 root wheel 32.3K Aug 1 00:33 ld.so

Hjälp uppskattas verkligen!

Edit: Nu har jag kopierat configfilerna till alla möjliga ställen i /var/opendchub som kan ses ovan, dock fortfarande samma resultat.

Visa signatur

qw q b

Permalänk
Hedersmedlem

när du kör sudo som flagel så följer $HOME (/home/FLAGEL) m fl andra miljövariabler med, men när du istället kör chroot direkt som root är $HOME=/root och när du kör det från ett script finns den nog inte alls.

Citat:

By default, sudo does not modify HOME

Kan du inte ange för opendchub var den skall leta efter sin konfig?
eller se till att $HOME sätts av startupscriptet.

Visa signatur

Det kan aldrig bli fel med mekanisk destruktion

Permalänk
Medlem
Citat:

Ursprungligen inskrivet av Aphex
när du kör sudo som flagel så följer $HOME (/home/FLAGEL) m fl andra miljövariabler med, men när du istället kör chroot direkt som root är $HOME=/root och när du kör det från ett script finns den nog inte alls.

Kan du inte ange för opendchub var den skall leta efter sin konfig?
eller se till att $HOME sätts av startupscriptet.

Det verkar inte vara möjligt att ange OpenDCHub var den ska leta efter sin config, har sökt efter det tidigare utan resultat.

Tack för tipsen, jag ska testa att skapa /var/opendchub/root/.opendchub, fungerar det inte så ska jag försöka få scriptet att sätta $HOME.

Edit: Det fungerade! Yay, jag skulle kunna ge dig en blöt puss på kinden just nu.

if [ X"${opendchub_flags}" != X"NO" -a -x /var/opendchub/bin/opendchub ]; then echo -n ' opendchub'; export HOME=/root; chroot -g opendchub -u opendchub /var/opendchub opendchub ${opendchub_flags}1> /dev/null fi

Visa signatur

qw q b