pepper ssh root




rootアカウント:
id: root
pwd:root

pepper [err 1] ~ $ su -
Password:
This account is currently not available.

I think I read somewhere that it is not possible, via SSH at least. Why do you want the root account for ?
You can still perform a sudo from the Nao account, in most of the cases it's enough.

基本諸元

$ uname -a
Linux pepper 3.10.33-rt33-aldebaran-rt-g6ce4391 #1 SMP PREEMPT RT Wed Oct 21 12:47:48 CEST 2015 i686 Intel(R) Atom(TM) CPU E3845 @ 1.91GHz GenuineIntel GNU/Linux

pepper [0] ~ $ cat /proc/meminfo
MemTotal: 1979204 kB→メモリ2G

pepper [0] ~/.local/share $ ls -al
drwxr-xr-x 20 nao nao 4096 Mar 5 15:06 .
drwxr-xr-x 3 nao nao 4096 Oct 16 14:31 ..
drwxr-xr-x 2 nao nao 4096 Mar 5 15:06 .jobdata
drwxr-xr-x 2 nao nao 4096 Mar 5 15:06 ALPodDetection
drwxr-xr-x 6 nao nao 4096 Mar 5 10:27 PackageManager
drwxr-xr-x 2 nao nao 4096 Mar 5 15:06 PreferenceManager
drwxr-xr-x 2 nao nao 4096 Mar 5 15:06 RechargeManager
drwxr-xr-x 4 nao nao 4096 Oct 16 14:31 asr
drwxr-xr-x 2 nao nao 4096 Oct 16 14:31 databases
drwxr-xr-x 27 nao nao 20480 Mar 3 14:57 dialog
drwxr-xr-x 9 nao nao 4096 Jan 22 13:37 locale
drwxr-xr-x 12 nao nao 4096 Feb 4 10:27 naoqi
drwxr-xr-x 3 nao nao 4096 Mar 5 15:06 navigation
drwxr-xr-x 3 nao nao 4096 Oct 16 14:31 qi
drwxr-xr-x 3 nao nao 4096 Jan 22 15:35 sbrapp
drwxr-xr-x 2 nao nao 4096 Mar 2 16:27 store
drwxr-xr-x 2 nao nao 4096 Oct 16 14:31 tts
drwxr-xr-x 2 nao nao 4096 Mar 7 11:27 usersession
drwxr-xr-x 3 nao nao 4096 Oct 16 14:31 vision
drwxr-xr-x 2 nao nao 4096 Mar 4 07:34 worldrepresentation

.local 以下が Pepper 用の設定みたいです。



  1. Server:
    nginx/1.3.14
ロボット側ではnginxが稼働しており、そこから配信されるコンテンツをロボット-タブレット間のLANを通して
ブラウザで表示するようになっています。
タブレットからはqimessage.jsを使ったsocket.ioでロボットのAPIを呼び出すようになっています。

pepper [0] ~ $ ps aux | grep nginx
root 3926 0.0 0.0 5248 720 ? Ss Mar05 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
root 3927 0.0 0.0 5776 1736 ? S Mar05 0:00 nginx: worker process
nao 16370 0.0 0.0 2132 516 pts/2 S+ 13:20 0:00 grep --colour=auto nginx


Choregrapheによってパッケージング&インストールされたアプリケーションは

/home/nao/.local/share/PackageManager/apps
に配置されるのですが、/var/www/appsでシンボリックリンクがはられていて、
nginxで各アプリケーションのhtmlディレクトリ以下が配信できるようになっています。
Choregrapheでhtmlフォルダをつくってその中にコンテンツをいれるというのはこのためですね。

pepper [0] /var/www $ ls -al
lrwxrwxrwx 1 root root 42 Oct 21 22:45 apps -> /home/nao/.local/share/PackageManager/apps
drwxr-xr-x 3 root root 1024 Oct 21 22:45 libs
drwxr-xr-x 2 root root 1024 Oct 21 22:45 licenses
drwxr-xr-x 2 root root 1024 Oct 21 22:45 localhost
drwxr-xr-x 6 root root 1024 Oct 21 22:45 oldrobotwebpage
drwxrwxr-x 8 root root 1024 Oct 21 22:45 robotsgate

pepper [0] ~$ nginx -V
nginx version: nginx/1.3.14
TLS SNI support enabled
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-ipv6 --with-pcre --without-http_geo_module --with-http_realip_module --add-module=/opennao-atom/tmp/portage/www-servers/nginx-1.3.14-r5/work/ngx_http_auth_pam_module-1.2 --with-http_ssl_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --user=nginx --group=nginx

nginxの設定:
pepper [0] /var/www $ cat /etc/nginx/nginx.conf
user root root;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

gzip on;

server {
listen 80;
server_name localhost;

root /var/www;
index index.html index.htm;

satisfy any;
allow 198.18.0.2/32;
location / {
root /var/www/robotsgate;
}
location ^~ /advanced {
alias /var/www/apps/robots_advanced/html;
}
location ^~ /licenses {
alias /var/www/licenses;
}
location /libs {
root /var/www;
}
location ~* /libs/qimessaging/.*/qimessaging.js {
auth_pam "Secure Zone";
auth_pam_service_name "nginx";
}
location ~* /libs/qimessaging/.*/socket.io/ {
rewrite /libs/qimessaging/(.*)/socket.io/(.*) /$1/$2 break;
proxy_pass http://127.0.0.1:8002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location ~ /apps/.*/html/?.* {
root /var/www;
}
location ^~ /apps {
rewrite ^(/apps/[a-zA-Z0-9_\.-]*)(/.*)$ /$1/html$2 break;
}
location ^~ /services {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgi-nao.sock;
fastcgi_param SCRIPT_NAME /django-fcgi;
}
}
}

上記設定の通り、アプリケーションのhtmlコンテンツは下記のようにして取得できます。LAN内のPCのブラウザから閲覧することも可能です。
http://[pepper-ip]/apps/[application-name]

Choregrapheで実行しているアプリケーションは.lastUploadedChoregrapheBehaviorという名称でアップロードされるため、下記のようにしてコンテンツを閲覧できます。
http://[pepper-ip]/apps/.lastUploadedChoregrapheBehavior
→PCから試して見たところ、403 Forbiddenエラーが発生
Basic認証でuser=root, pwd=rootで一応topページにログインできるけど、
appsにはやはり403エラーが発生した。

/etc/nginx/nginx.confを変更しようとすると、vimがインストールされていないようです。
pepper [0] /var/www $ vi /etc/nginx/nginx.conf
-bash: vi: command not found

If all you need is a text editor, you can use "nano" which is already installed on your robot.

One of the easiest way to get a 'vi' would be to install a busybox binary to your Nao. http://busybox.net/downloads/binaries/latest/ and then run "busybox vi".


sudo nano /etc/nginx/nginx.conf
sudo: can't mkdir /var/db/sudo: Read-only file system

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

Password:
Sorry, user nao is not allowed to execute '/bin/nano /etc/nginx/nginx.conf' as root on pepper.
pepper [err 1] /var/www $ ls -al /etc/nginx/nginx.conf
-rw-r--r-- 1 root root 1637 Oct 21 22:45 /etc/nginx/nginx.conf
→naoのユーザーでは設定ファイルを変更できないようですね?

余談ですが、インストールされたアプリケーションはChoregrapheのプロジェクトにインポートしてそのまま開けるものが配置されていて簡単に実装が覗けてしまいますし、振る舞いのプログラムである *.xarファイルはPythonコードがそのままCDATAに記述されたXMLファイルですので、Choregrapheを使わなくても容易に改ざんできてしまいます。一般販売はだいぶ先に延期されてしまいましたが、この仕様のままアプリストアが開設されるんでしょうか…?
→本当にそうだった。
そのままimportすると.pmlファイルががいけど、別のプロジェクトから.pmlそのままこちらにコピーすれば問題なさそうです。


タブレットからインターネットへの接続

タブレットに表示するhtmlに、例えば http://…." /> などで外部のリソースを取得しようとすると、そのままでは失敗してしまいます。

pepper_tablet_03

セキュリティ等の制約でロボットに格納されているリソースしか扱えないようになっているのかなぁと思っていたのですが、
単にタブレットのWiFi設定がされていないだけでした。ロボットOSからインターネット共有を受けているわけではないんですね。
→別に特にtabletのインタネットは設定していないけど、
普通にhtmlファイルにsrcではインタネット上の画像が正常に表示されたけど。原因不明


pepper [0] /var/www $ qicli info ALTabletService
149 [ALTabletService]
* Info:
machine 18dfc195-3519-4d60-a93d-67d8867a6e86
process 2408
endpoints tcp://127.0.0.1:33776
tcp://198.18.0.2:33776
tcp://192.168.1.51:33776
[W] 20513 qimessaging.transportsocket: connect: Connection refused

pepper [0] /var/www $ qicli call ALTabletService.getWifiStatus
[W] 20687 qimessaging.transportsocket: connect: Connection refused
"CONNECTED"

Tabletボックスライブラリの「Show Web View」が単に ALTabletService::showWebview() を呼んでいるだけなので、これをテンプレートとしてWiFiの状況を確認するボックスを作成してみます。


1
2
3
4
5
6
7
8
9
10
11
def onInput_onStart(self):
# We create TabletService here in order to avoid
# problems with connections and disconnections of the tablet during the life of the application
tabletService = self._getTabletService()
if tabletService:
# WiFiステータス文字列を取得して出力する
result = tabletService.getWifiStatus()
self.logger.info(result)
self.onStopped(result)
else:
self.logger.warning("ALTabletService not found.")
→確認したところ、特にtabletのネットワークを設定しなくても、connectedになっているようですね。


qicli call ALTabletService.disableWifi
qicli call ALTabletService.enableWifi
qicli call ALTabletService.forgetWifi
qicli call ALTabletService.configureWifi [wep|wpa]

pepper [err 1] /var/www $ qicli call ALTabletService.disableWifi
[W] 21389 qimessaging.transportsocket: connect: Connection refused
null
pepper [0] /var/www $ qicli call ALTabletService.getWifiStatus
[W] 21401 qimessaging.transportsocket: connect: Connection refused
"DISCONNECTED"
→この状態ではプロジェクトないのhtmlファイルにsrc画像が表示できなくなった。

pepper [0] /var/www $ qicli call ALTabletService.enableWifi
[W] 21464 qimessaging.transportsocket: connect: Connection refused
null
pepper [0] /var/www $ qicli call ALTabletService.getWifiStatus
[W] 21477 qimessaging.transportsocket: connect: Connection refused
"SCANNING"
pepper [0] /var/www $ qicli call ALTabletService.getWifiStatus
[W] 21487 qimessaging.transportsocket: connect: Connection refused
"CONNECTED"
→この状態ではプロジェクトないのhtmlファイルにsrc画像が表示できるようになりました。
qimessaging.transportsocket: connect: Connection refusedはもしかしてwifi接続されているかどうかは関係なく、
別の物でしょうかね。


でid: root, pwd: rootを入力して、
アプリ毎のhtmlフォルダが内容が表示できるようになった。
(naoのユーザーはこのページにアクセスできないようです。)
不思議ですね。