criticablog

ソフトウェアエンジニアがニッチな情報を書きます。

get rid of “you've launched an older version of firefox” after crash in Safe Mode

  1. I updated Firefox from (67.0+build2-0ubuntu0.18.04.1) to (67.0.1+build1-0ubuntu0.18.04.1).
  2. Firefox crashed three times in a row.
  3. I launched Firefox in safe mode but it crashed too.
  4. Firefox begun to refuse to run saying "you've launched an older version of firefox",

    Using an older version of Firefox can corrupt bookmarks and browsing history already saved to an existing Firefox profile. To protect your information, create a new profile for this installation of Firefox.

    This isn't in my case.

  5. compatibility.ini in my profile folder was
    [Compatibility]
    LastVersion=Safe Mode
    LastOSABI=Linux_x86_64-gcc3
    LastPlatformDir=/usr/lib/firefox
    LastAppDir=/usr/lib/firefox/browser
  6. I removed the line LastVersion=Safe Mode.
  7. I launched Firefox. It opened tabs successfully.
  8. compatibility.ini changed to
    [Compatibility]
    LastVersion=67.0.1_20190530055249/20190530055249
    LastOSABI=Linux_x86_64-gcc3
    LastPlatformDir=/usr/lib/firefox
    LastAppDir=/usr/lib/firefox/browser

simple table of referrer policy

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy から作成

下にいくほど緩い。

Policy

downgrade

equal or more secure

same origin

no-referrer

no no no

same-origin

no no full

strict-origin

no origin origin

strict-origin-when-cross-origin

no origin full

no-referrer-when-downgrade

no full full

origin

origin origin origin

origin-when-cross-origin

origin origin full

unsafe-url

full full full

legend:

column name means
downgrade when requesting http resource from https
equal or more secure having different origins and either of (http ← http or https ← http or httpshttps)
same origin when origins are equal
value means
no send nothing
origin send only scheme, host, port
full send the full URL

広告を表示しなくても iOS 広告用識別子を使えた

広告を表示しないけれど、広告効果計測用のライブラリを使う iPhone アプリを作成しました。iTunes Connect にアップロードし審査へ提出するときの

このAppは広告ID(IDFA)を使用しますか?

が「はい」でも「いいえ」でも審査は通りました。 「はい」のときここらへんは多分チェックつけたはず:

  • App内で広告を出す
  • このAppのインストールを、前に出した広告と関連付ける
  • このApp内で行われたアクションを、前に出した広告と関連付ける

Apple Developer Program License Agreement の 3.3.12節

Advertising Identifier: 3.3.12 You and Your Applications (and any third party with whom You have contracted to serve advertising) may use the Advertising Identifier, and any information obtained through the use of the Advertising Identifier, only for the purpose of serving advertising. If a user resets the Advertising Identifier, then You agree not to combine, correlate, link or otherwise associate, either directly or indirectly, the prior Advertising Identifier and any derived information with the reset Advertising Identifier.

には “only for the purpose of serving advertising” とありますがこれが直接広告の画像なりテキストなりを app 内で表示することを指すわけではない、ということでしょうか。

一般的なアプリケーションの却下理由 - App Store - Apple Developer

アプリケーションで IDFA を使用していると答えたものの広告機能を備えていない、または広告が適切に表示されない場合は、アプリケーションが却下される可能性があります。

If you indicate that your app uses the IDFA, but it does not have ad functionality or does not display ads properly, your app may be rejected.

にある「広告機能」は広告表示に限らず、広告の効果測定のような、アプリを見て分からない機能も含むというということでしょうか。

それでは 2014年に英語や日本語でリジェクトされるぞって言っていたのは何だったのでしょう。

Appleのデベロッパに広告識別子の規則遵守が義務化, 違反者はApp Storeから拒絶される | TechCrunch Japan

ちなみに Android で使える Google Play 開発者サービスの Advertising ID はユーザーの分析に使えると書いてあります。

play.google.com

bitnami redmine と同じホストで git 連携する

目的

Bitnami 版 Redmine と同じホストの /git というパスで git リポジトリにHTTPアクセスできるようにする。 もちろん Redmine のプロジェクトのメンバー管理と連動して git リポジトリへのアクセス制限を掛ける。

git-http-backend を(mod_cgi.so が Apache に無かったので)fcgiwrap を使って FastCGI として実行することにした。

Bitnami 公式ドキュメントの手順 https://wiki.bitnami.com/Applications/BitNami_Redmine#How_to_configure_Redmine_for_advanced_integration_with_Git と比較すると、git.YOUR_DOMAIN_NAME とか別VirtualHost を切らなくていいし、htdocs 下に別の Passenger アプリ grack を置く必要もない(Apache の設定は詳しくないので別なやり方あれば教えてください……)。

なおリポジトリをこの Redmine 上で作成するために SCM Creator プラグイン を入れているが、たぶん無くても動作するのでここでは説明しない。

材料と道具

使用したバージョン

設定

fcgiwrap

apache (/opt/bitnami/apache2/bin/httpd.bin) プロセスが fcgiwrap の作るソケットに読み書きできるようにユーザ/グループを設定する。

/etc/default/fcgiwrap

FCGI_USER=daemon
FCGI_GROUP=bitnami
FCGI_SOCKET_OWNER=daemon
FCGI_SOCKET_GROUP=daemon

httpd の設定

vcs.conf とか別ファイルに書いて /opt/bitnami/apache2/conf/httpd.conf から Include する。

<IfModule !perl_module>
LoadModule perl_module modules/mod_perl.so
</IfModule>
<IfModule !env_module>
LoadModule env_module modules/mod_env.so
</IfModule>
PerlLoadModule Apache::Authn::Redmine

# Subversionの設定
<Location /svn>
    DAV svn
    SVNParentPath /opt/repositories/svn
    SVNListParentPath on
    # 適当な内容の設定を置いてある
    AuthzSVNAccessFile /usr/local/etc/svnauthz

    AuthType Basic
    AuthName "Subversion"
    # http://www.redmine.org/boards/2/topics/35428
    AuthUserFile /dev/null
    Require valid-user

    # Redmine プロジェクトのメンバー管理と連動したアクセス制御。
    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler
    # /opt/bitnami/apps/redmine/htdocs/config/database.yml と同じ値にする。
    RedmineDSN "DBI:mysql:database=bitnami_redmine;host=localhost;mysql_socket=/opt/bitnami/mysql/tmp/mysql.sock"
    RedmineDbUser "bitnami"
    RedmineDbPass "****"
</Location>

# Gitの設定
# bitnami の apache には mod_cgi.so が付属しないので CGI コマンドを直接実行できない。
<IfModule !proxy_module>
LoadModule proxy_module modules/mod_proxy.so
</IfModule>
<IfModule !proxy_fcgi_module>
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
</IfModule>

LogLevel trace2
# Alias を使い SCRIPT_FILENAME が git-http-backend を指すようにする。$1 は GIT_PROJECT_ROOT 下のディレクトリ名
AliasMatch "/git/(.+)" "/opt/bitnami/git/libexec/git-core/git-http-backend/$1"
<Location /git>
    # SCRIPT_FILENAME 変数が proxy:fcgi://〜 で始まるというバグが Apache 2.4.20 の mod_proxy_fcgi にある。
    # [Bug 59618 – SCRIPT_FILENAME is prefixed with bogus "proxy:fcgi"](https://bz.apache.org/bugzilla/show_bug.cgi?id=59618)
    # そのため fcgiwrap が実行すべきコマンドが分からず
    # Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?
    # というエラーを返す。 https://github.com/gnosek/fcgiwrap/blob/master/fcgiwrap.c
    # 一方 proxy:balancer: は除去するようになっているので balancer を経由するよう書けばよい:
    SetHandler "proxy:balancer://fcgi59618workaround"
    # バグ修正されたバージョンの Apache を使う場合こうなるはず:
    #SetHandler "proxy:unix:/run/fcgiwrap.socket|fcgi://."

    SetEnv GIT_HTTP_EXPORT_ALL ""
    SetEnv GIT_PROJECT_ROOT "/opt/repositories/git"

    AuthType Basic
    AuthName "Git"
    # http://www.redmine.org/boards/2/topics/35428
    AuthUserFile /dev/null
    Require valid-user

    # Redmine プロジェクトのメンバー管理と連動したアクセス制御。
    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler
    # /opt/bitnami/apps/redmine/htdocs/config/database.yml と同じ値にする。
    RedmineDSN "DBI:mysql:database=bitnami_redmine;host=localhost;mysql_socket=/opt/bitnami/mysql/tmp/mysql.sock"
    RedmineDbUser "bitnami"
    RedmineDbPass "****"
    RedmineGitSmartHttp yes
</Location>

# bug 59618 の回避策用の balancer を定義する。ここで決めた名前に proxy: をプレフィクスして上の SetHandler で参照している。
<Proxy "balancer://fcgi59618workaround">
    # fcgiwrap は FCGI プロトコルをしゃべり、SCRIPT_FILENAME で指定された CGIコマンド を実行する。
    # Unix domain socket を使う記法は https://httpd.apache.org/docs/2.4/en/mod/mod_proxy_fcgi.html のとおり。
    # socat でデバッグするときはソケットの path を変更する。
    BalancerMember "unix:/run/fcgiwrap.socket|fcgi://."
</Proxy> 

モジュールの配置

mkdir -p /opt/bitnami/perl/lib/site_perl/5.16.3/Apache/Authn
ln -sv /opt/bitnami/apps/redmine/htdocs/extra/svn/Redmine.pm /opt/bitnami/perl/lib/site_perl/5.16.3/Apache/Authn/Redmine.pm

おわりに

以上の設定で /opt/repositories/git/aaa を git clone http://(サーバ名)/git/aaa などと読み書きできるはず。

/opt/bitnami/apache2/conf/httpd.conf は大部分 bitnami の配布しているままだが、再現性の観点から載せとく。

/opt/bitnami/apache2/conf/httpd.conf

Apache で mod_proxy_fcgi と fcgiwrap を組み合わせる例もウェブ上には少ないので参考になると思う。

おまけ

FastCGIunix domain socket 通信内容を見たい場合 socat を apt-get でインストールして

sudo socat -t100 -v unix-listen:/home/bitnami/fcgiwrap.socket,mode=777,reuseaddr,fork unix-connect:/run/fcgiwrap.socket > ~/fcgiwrap.log 2>&1 &

と起動しておいて上の vcs.confunix:/run/fcgiwrap.socket と書いてるとこを unix:/home/bitnami/fcgiwrap.socket と置き換えればよい。 ちなみに設定を書き換えたら sudo /opt/bitnami/ctlscript.sh restart apache で読みなおす必要がある。

SSL protocol error of Device Portal on Windows 10 Mobile

Device Portal of Windows 10 Mobile is now available on NuAns NEO but it's not usable. Browsers say “The connection to the server was reset while the page was loading.” This is not a kind of insecure-certificate problem.

update 2016-07-31: I found that the SNI servername other than "localhost" causes the error. So a workaround is to use USB connection with URL https://localhost:10443/ .

My NuAns NEO:

  • Windows 10 Mobile, build 10.0.14393.5 (The problem exists since the first 10586 build which come to NuAns NEO as far as I can remember.)
  • Firmware rev 1028.020.001.79

I've tested it with the openssl command.

C:> openssl s_client -connect 172.16.10.186:443
CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 306 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1469769595
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

The message lacks server certificate, cipher string and so on. I wonder what situation/configuration causes this. Like the phone vendor forgot to install something?

Using USB connection doesn't help because http://127.0.0.1:10080 redirects https page which emits the same erroneous message. cURL says unknown SSL protocol error:

C:> curl --verbose -i https://127.0.0.1:10443/
* STATE: INIT => CONNECT handle 0x600082340; line 1402 (connection #-5000)
* Added connection 0. The cache now contains 1 members
*   Trying 127.0.0.1...
* STATE: CONNECT => WAITCONNECT handle 0x600082340; line 1455 (connection #0)
* Connected to 127.0.0.1 (127.0.0.1) port 10443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x600082340; line 1562 (connection #0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /usr/ssl/certs/ca-bundle.crt
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x600082340; line 1576 (connection #0)
* Unknown SSL protocol error in connection to 127.0.0.1:10443
* multi_done
* Closing connection 0
* The cache now contains 0 members
* Expire cleared
curl: (35) Unknown SSL protocol error in connection to 127.0.0.1:10443

In contrast, connection to another phone Lumia 1520 succeeds as follows.

C:> openssl s_client -connect 172.16.10.5:443
CONNECTED(00000003)
depth=0 CN = 172.16.10.5
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = 172.16.10.5
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
 0 s:/CN=172.16.10.5
   i:/CN=Microsoft Windows Web Management (Test) (Windows-Phone)
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDYzCCAkugAwIBAgII/x+R…
-----END CERTIFICATE-----
subject=/CN=172.16.10.5
issuer=/CN=Microsoft Windows Web Management (Test) (Windows-Phone)
---
No client certificate CA names sent
Peer signing digest: SHA256
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 1355 bytes and written 432 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: 1324…
    Session-ID-ctx:
    Master-Key: 2818…
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 146976…
    Timeout   : 300 (sec)
    Verify return code: 21 (unable to verify the first certificate)
---
read:errno=104

AT&Tでできる Lumia SIMアンロック

昨年の某イベントで配布された Lumia 1520 などの Windows Phone は AT&T回線にロックされていた。しかし現在はAT&T自身が非契約者にもアンロックコードを提供しているので、これらのスマートフォンSIMロックを安全かつ無料で解除できる。


従来、AT&T回線ロックされた端末をロック解除するには AT&Tと契約をするか、米国のアンロック業者を使う必要があった。

statemachine.hatenablog.com

ところが10月に AT&Tのページを読みなおしてみると、契約を持っていない者もアンロックできるように書いてある。

AT&T Wireless Consumer Device Unlock Request

ページなかほどの非顧客 (Non-AT&T Mobility Customers) のところ:

You’ve never had an AT&T wireless account and you meet the General Requirements for unlock requests.

ということで、上の General Requirements for All Unlock Requests を読んで当てはまるなら申請できる。

次のページでは Customer Type: Non-AT&T Mobility customer を選ぶと番号などの入力が不要になる。 IMEIなどの必要事項を入力すれば Confirmation Email が送られてくる。 もしかしたら必要事項を入力してサブミットしたとき、間違えたつもりは無くとも、失敗したとかエラーとか出るかもしれない。後日再度入力したらいいはず。 f:id:criticabug:20151101224104p:plain

Confirmation Email の指示に従いリンクにアクセスするとリクエストが受け付けられ、2営業日以内にアンロック コードが用意される。メールで送られてくるかはわからないが、このページでステータスを確認するとアンロックコードが得られる:

AT&T Wireless Consumer Device Unlock Status f:id:criticabug:20151101223555p:plain

SIMを Windows Phone に挿し数字20桁のアンロックコードを間違えずに入力するとあっさりアンロックに成功する。APN設定を行えば通信ができるようになるだろう。1520は 4G (iijmio LTE) も利用できる。なお技適(ry

またこの端末は以前 8.1 Developer Preview や Windows 10 Mobile Insider Preview にアップグレードしていたが、使っていると反応がなくなるなど不安があったので、端末リセットしてあったことを付記しておく。

Windows 10 Mobile のリリースが待ち遠しい。


以下余談

なぜ AT&T が契約を持っていない者にも回線アンロックを許可するようになったかというと、CTIAという業界団体のガイドラインが 2015年2月に変わっただか発行されただかが関係あるようだ。