Categories
Android

解决android 2.2 market搜索结果偏少的问题

那是很久很久以前的事了,大概花了两个星期去折腾,整理整理,与朋友们分享一下。

我们开始移植到 2.2时,market运行很好,过一段时间测试组提出bug。问题现象:Android market 搜素记录严重偏少,比如搜索 qq,在我们的broncho a1上,只有1条记录。

首先,确定apk包是没有问题的。同样的包安装在G1上,可以找到300多条记录。此外,特意让上海龙旗的一位网友看了他们公司的手机,说可以搜索到25条qq记录,他们的分辨率是 800 * 600, 我们的是480 * 320。他把apk包发给我,在我们机器上还是同样的结果。

其次,在javaeye上,有网友说跟机器有 root权限有关,他发布一款软件到market上,他的机器是root权限,搜索不到他刚发布的程序,改为普通用户后,就可以了。这有可能,因为我们的机器一直是root权限,重新编译kernel,改为普通用户,还是不行。

后来有人说,跟market上设置的protected权限有关。我为此还花了25$注册 market开发者,写个小程序放上去,关闭权限,结果还是没有生效。

解决问题最好的方法是找差异。为此,getprop 获取G1系统参数做比较,还是没有找到有异常嫌疑之处。gpps包是从cm上获取的,我们没有通过正规的渠道拿到,怀疑是跟授权有关,如果真的是这样,那就没办法了,不过,上海龙旗既然可以搜索到25条记录,我想应该跟这没关系。

用 tcpdump与 wireshark 工具观察 market请求发出的数据包找出url,那是一串经过序列化然后再经过base64加密后的字符串。有开源的 android market api,基于protobuf协议,之前也是运行好好的,最近就不行了。翻遍它的 google groups,说什么帐号跟手机的deviceId挂钩了,我重新注册个gmail帐号,还是一样。又有说根据ip来源,返回不同的搜索结果。我干脆把程序放在美国的服务器上跑,还是没成功。

绝望,绝望!!! 一个android手机,如果电子市场不能使用,那简直是暗淡无光。

正值网络上爆出android暗含高达40% 的扣费短信。wusong童鞋无聊给我发个帖子链接《近期 Android 平台扣费软件检测的分析心得与思路分享》,说是如何扫描apk包含扣费短信的,文章中说通过反编译apk,插入 Log.v 打印出非法信息。灵光一闪,既然我无法全部理解那长长的url,那何不如让它自己打印出自己的信息呢?

修改ProtoBuf里的insertObject函数,添加Object toString()打印对象,如果是vector,就遍历打印。

结果发现,我们只有这个信息:

1222 insertObject: W tag=10 index=0com.google.android.feature.GOOGLE_BUILD

相应的g1的有很多信息,经查询, 问题出现在 FeatureInfo[] systemAvailableFeatures =
packageManager.getSystemAvailableFeatures(); 这个函数。

运行时,PackageManagerService.java 从 /system/etc/permissions/ 下所有
的文件读取 features/permissions。这个目录下,我们只有一个features.xml, 而这个文件还是从gapps里拷贝过来的。
所以,应该把以下文件

frameworks/base/data/etc:
android.hardware.camera.autofocus.xml
android.hardware.location.gps.xml
android.hardware.telephony.gsm.xml
android.hardware.touchscreen.multitouch.xml
android.hardware.wifi.xml
handheld_core_hardware.xml

生成image时拷贝到

/system/etc/permissions/

如果是cdma,
请把 android.hardware.telephony.gsm.xml
替换为
android.hardware.telephony.cdma.xml

测试,OK。

我把问题解决后,才发现一下别人的帖子:
APAD IMX515 安装 Android Market 方法

Working Android market and all google app (for 2.2)

问题解决后再回顾:

1. 如果我早用 Quick system info 这个工具,会很快找到问题,这个工具可以显示 system availabe features信息,两机器都同时安装,跟G1一对比,一目了然。

2. 如果把 market的数据清空,再抓数据包,在 base64 decode,虽然不能看出所有的含义,但至少也看到 xxx.xx.xx 这样可显示的字符串,也可以尽快找出问题。market 手机系统信息,是第一次运行时才收集,后面的url请求只需要从cache里获取系统信息即可。

3. DeviceConfiguration.java 有 toString(),注入调试信息也可以显示出来。

4. 仔细阅读官方文件 http://developer.android.com/guide/appendix/market-filters.html, 有提到getSystemAvailableFeatures()这个函数.

Categories
他山之石

Hardening guide for VSFTPD on RHEL 5.4

The guide bellow instruct how to install, configure and secure FTP server called VSFTP, based on RHEL 5.4, enabling only SFTP access to the server.

Installation phase

1. Login to the server using Root account.
2. Install from the RHEL 5.4 DVD the following RPM:
rpm -ivh vsftpd-2.0.5-16.el5.i386.rpm
3. Create a group for FTP users:
groupadd ftp-users
4. Create folder for the FTP:
mkdir -p /ftp
5. Change ownership and permissions on the FTP folder:
chown root:ftp-users /ftp
chmod 777 -R /ftp
6. Example of user creation:
useradd -g ftp-users -d /ftp user1
passwd user1
7. Edit using VI, the file /etc/vsftpd/vsftpd.conf
Change from:
anonymous_enable=YESTo:
anonymous_enable=NO

Change from:
xferlog_std_format=YESTo:
xferlog_std_format=NO

Change from:
#tftpd_banner=Welcome to blah FTP service.To:
tftpd_banner=Secure FTP server

Add the lines bellow:
local_root=/ftp
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
vsftpd_log_file=/var/log/vsftpd.log
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
ssl_ciphers=ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
rsa_cert_file=/etc/vsftpd/vsftpd.pem
8. Run the command bellow to create VSFTP SSL key:
openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/vsftpd/vsftpd.pem -out /etc/vsftpd/vsftpd.pem
Note: The command above should written as one line.
9. Edit using VI, the file /etc/vsftpd/user_list and add members of the FTP-Users group to this list.
10. Run the command bellow to manually start the VSFTP service:
/etc/init.d/vsftpd start
11. Run the command bellow to configure the VSFTP to start at server startup:
chkconfig vsftpd on

原文 无法打开,在google cache 找到 http://security-24-7.com/hardening-guide-for-vsftpd-on-rhel-5-4/