引言由于我司有一部分windows的业务,我在agent安装时遇到了很多的坑,由于目前windows服务比较少,所以社区相关的资料比较少,很多都是自己到处查资料研究及蓝鲸大神的协助解决,为了避免大家踩坑,特将我这边的解决方案和大家分享。 部署前提
:: 开启 Function Discovery Resource Publication sc config FDResPub start= demand sc start FDResPub :: 开启 SSDP Discovery sc config SSDPSRV start= demand sc start SSDPSRV :: 开启UPnP Device Host sc config upnphost start= demand sc start upnphost :: 开启TCP/IP NetBIOS Helper sc config lmhosts start= demand sc start lmhosts :: 开启Server sc start LanmanServer :: 设置OPENSSL环境变量 wmic ENVIRONMENT create name="OPENSSL_ia32cap",username="<system>",VariableValue=0x1000000000000000:0 :: 开启admin$和c$的隐式共享,并且授予超级管理员权限, 其中adminbf为计算机的超级管理员账号,根据实际情况修改。 net share /delete admin$ net share admin$ /unlimited /grant:adminbf,full net share /delete c$ net share c$=c: /unlimited /grant:adminbf,full :: 开启防火墙策略 :: 需要对remotip(中控机或proxy的内网IP)放通60020-60030的TCP, UDP端口, 安装时要放通TCP 139,135,445,1024-65535 端口 :: 以windows高级防火墙管理为例: netsh advfirewall firewall add rule name="for blueking-agent tcp" protocol=TCP dir=in localport=60020-60030 action=allow remoteip=10.0.0.0/8 netsh advfirewall firewall add rule name="for blueking-agent udp" protocol=UDP dir=in localport=60020-60030 action=allow remoteip=10.0.0.0/8 :: 以下规则仅安装时用,安装成功后可以删除 netsh advfirewall firewall add rule name="for blueking-agent install" protocol=TCP dir=in localport=139,135,445,1024-65535 action=allow remoteip=10.0.0.0/8 检查脚本运行完成后,可根据 官方指引进行检查,若无问题即可以开始安装 可能出现的问题
[2022-04-18 10:41:45 ERROR] [proxy] proxy_fail FAILED Traceback (most recent call last): File "/opt/py36/lib/python3.6/cmd.py", line 214, in onecmd func = getattr(self, 'do_' + cmd) AttributeError: 'RemoteShell' object has no attribute 'do_del' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/wmiexec.py", line 122, in run result = self.shell.onecmd(self.__command) File "/opt/py36/lib/python3.6/cmd.py", line 216, in onecmd return self.default(line) File "/tmp/wmiexec.py", line 270, in default return self.send_data(line) File "/tmp/wmiexec.py", line 339, in send_data print(self.__outputBuffer) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/setup_pagent.py", line 880, in <module> main() File "/tmp/setup_pagent.py", line 485, in main login_ip, construct_cmd[_os], user, int(port), identity, args.download_url, tmp_dir, File "/tmp/setup_pagent.py", line 196, in windows_cmd execute_win_commands(commands, login_ip, user, identity, download_url) File "/tmp/setup_pagent.py", line 204, in execute_win_commands res = execute_cmd(cmd, login_ip, user, identity, download_url, noOutput=noOutput) File "/tmp/setup_pagent.py", line 324, in execute_cmd result_data = executor.run(ipaddr) File "/tmp/wmiexec.py", line 136, in run raise Exception(str(e)) Exception: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) 原因: proxy或中控机的字集不符合要求, 到中控机或proxy运行 locale命令查看,需要设置成en_us.UTF-8 [root@localhost OFS_Prop]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= 解决方案:
手动安装方案如果上术方法均未能安装成功,可以选择手动部署,本人亲测可以安装成功,步骤如下:
C:\gse\agent\bin\gse_agent_daemon.exe --file C:\gse\agent\etc\agent.conf --name gse_agent_daemon_gse
# 任务管理器中观察进程状态 tasklist | findstr gse_ ## 输出有 gse_agent_daemon.exe 和 gse_agent.exe # 确认建立了连接 netstat -an | findstr 48533 ## 输出有一个ESTABLISHED
总结我们公司windows服务器比较多,环境差异也比较大,本人已经踩过很多的坑, 按这个步骤执行下来,基本上都能安装成功。 |
|