AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-75267

Bryan Hunt's questions

Martin Hope
Bryan Hunt
Asked: 2013-02-28 02:48:08 +0800 CST

traceroute 如何解析路由器名称?

  • 0

我发现了这个有趣的 traceroute 小例子,它被用来输出星球大战的东西。

它最初来自http://beaglenetworks.net。

% traceroute -m 100 -U -p 3550 obiwan.scrye.net
traceroute to obiwan.scrye.net (216.81.59.173), 100 hops max, 60 byte packets
 1  pfsense.zeebox.com (192.168.1.1)  0.185 ms  0.136 ms  0.114 ms
 2  ser014173.thca.uk.exponential-e.net (83.244.231.177)  19.416 ms  23.226 ms  24.093 ms
 3  1-1-2.pr01.thca.uk.exponential-e.net (195.66.224.186)  15.108 ms  15.090 ms  15.072 ms
 4  10gigabitethernet1-1.core1.lon1.he.net (195.66.224.21)  14.979 ms  14.999 ms  17.027 ms
 7  10gigabitethernet1-2.core1.atl1.he.net (184.105.213.110)  115.214 ms  101.668 ms  108.998 ms
 8  216.66.0.26 (216.66.0.26)  101.521 ms  109.526 ms  109.521 ms
 9  * * *
10  Episode.IV (206.214.251.1)  148.498 ms  149.193 ms  149.059 ms
11  A.NEW.HOPE (206.214.251.6)  149.804 ms  144.125 ms  148.881 ms
12  It.is.a.period.of.civil.war (206.214.251.9)  147.718 ms  145.229 ms  145.045 ms

所以前几个 IP 地址似乎是通过 DNS 解析的。

但后来的绝对不是基于 TLD 的。

后来,更明显了。

52  0------------------0 (206.214.251.97)  146.877 ms  153.889 ms  146.824 ms

那么这些名字是从哪里来的呢?这只是一种格式化技巧,还是以另一种方式解决了它们。

domain-name-system
  • 2 个回答
  • 7427 Views
Martin Hope
Bryan Hunt
Asked: 2012-08-07 23:05:35 +0800 CST

systemtap 未在 Ubuntu 12 上正确初始化(精确)

  • 0

我在一家拥有一定数量遗留批处理流程的公司工作。

当涉及到数据库连接时,其中一些东西确实存在漏洞。

  • 我需要记录系统中打开数据库连接的每个进程。

Strace 不是一个选项,进程太多,它们的生命周期太短,我需要审核多个框。

IPtables 不是一个选项,您可以匹配进程路径/用户,但您不能记录该信息(据我所知)

通常的工具,如 lsof/netstat 等,只包含有关活动进程和它们正在使用的连接的信息。

另一方面,这些批处理作业已经死了——所以我无法将进程与套接字相关联。

所以现在是学习 systemtap 的最佳时机。或者编写自定义内核模块。但是我没有专业知识/时间开始侵入系统调用表,此外,我想学习 systemtap 因为它似乎是非常有用的工具。

我的最终目标是编写一个探针,它 -

  • 尽可能多地打印出有关本地连接到 MySQL 的每个进程的信息。

但细节决定成败。我无法在 Debian 上安装它(喘息)(根本),而且我在 Ubuntu 12(精确)上遇到奇怪的错误。

在 Ubuntu 上,一个基本的 systemtap 探测就可以正常工作(这些是基本的复制和粘贴示例)。

 #! /usr/bin/env stap
 probe begin { println("hello world") exit () }

它产生预期的输出。

sudo stap -v stapinit.stp
Pass 1: parsed user script and 76 library script(s) using 22792virt/13512res/2224shr kb, in 90usr/0sys/93real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) using 23056virt/14000res/2304shr kb, in 10usr/0sys/2real ms.
Pass 3: translated to C into "/tmp/stap2ntfcM/stap_32acf6b6a3f643d9444c9c8339e390d8_687.c" using 23056virt/14332res/2584shr kb, in 0usr/0sys/0real ms.
Pass 4: compiled C into "stap_32acf6b6a3f643d9444c9c8339e390d8_687.ko" in 1290usr/390sys/1902real ms.
Pass 5: starting run.
hello world
Pass 5: run completed in 10usr/40sys/596real ms.

但是一个更复杂的探针就死了,例如:

# Show sockets setting options

# Return enabled or disabled based on value of optval
function getstatus(optval)
{
    if ( optval == 1 )
        return "enabling"
    else
        return "disabling"
}

probe begin
{
        print ("\nChecking for apps setting socket options\n")
}

# Set a socket option
probe tcp.setsockopt
{
    status = getstatus(user_int($optval))
        printf ("  App '%s' (PID %d) is %s socket option %s... ", execname(), pid(), status, optstr)
}

# Check setting the socket option worked
probe tcp.setsockopt.return
{
    if ( ret == 0 )
        printf ("success")
    else
        printf ("failed")
    printf ("\n")
}

probe end
{
        print ("\nClosing down\n")
}

生产 -

Pass 1: parsed user script and 76 library script(s) using 22812virt/13660res/2224shr kb, in 90usr/10sys/120real ms.
semantic error: missing i386 kernel/module debuginfo under '/lib/modules/3.2.0-27-generic-pae/build' while resolving probe point kernel.function("tcp_setsockopt")
semantic error: no match while resolving probe point tcp.setsockopt
semantic error: missing i386 kernel/module debuginfo under '/lib/modules/3.2.0-27-generic-pae/build' while resolving probe point kernel.function("tcp_setsockopt").return
semantic error: no match while resolving probe point tcp.setsockopt.return
Pass 2: analyzed script: 2 probe(s), 1 function(s), 0 embed(s), 0 global(s) using 23136virt/14424res/2540shr kb, in 70usr/580sys/1255real ms.
Pass 2: analysis failed.  Try again with another '--vp 01' option.

看来我缺少依赖项,但我已经安装了厨房水槽。

sudo apt-get install elfutils
sudo apt-get install linux-headers-generic gcc libcap-dev
sudo apt-get install systemtap-sdt-dev
sudo apt-get install systemtap systemtap-doc linux-image linux-headers-generic-pae
  • 更新 1

apt-get install systemtap 建议的软件包可能有些误导。

linux-headers-virtual 、 linux-image 、 linux-source 和 linux-tools 是虚拟包,因此将跟踪当前升级到的任何内核。

sudo apt-get install linux-headers-virtual linux-image linux-source linux-tools 

为了更好地衡量,我还安装了 fdutils 和 kernel-package

sudo apt-get install fdutils kernel-package

将尝试这个并报告回来。

  • 更新 2

仍然损坏,同样的错误,这实际上是我尝试安装它的第三个系统。

我还发现了以下 Ubuntu 错误,也许包坏了?

https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/824105

  • 更新 3

Ubuntu 上的问题似乎是他们没有构建内核调试符号包,或者至少以标准方式分发它。我的结论是 systemtap 包在 Ubuntu 上被破坏了,因为它没有安装关键的依赖项。

https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/106957

在我的 Debian 机器上,我有一个不同的问题,测试已启用 - 因此 gcc 已升级到 4.6,并且 linux-headers 包需要 gcc 4.3

 root@datasift:~# apt-get install systemtap linux-image-`uname -r`-dbg linux-headers-`uname -r`
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 systemtap is already the newest version.
 Some packages could not be installed. This may mean that you have
 requested an impossible situation or if you are using the unstable
 distribution that some required packages have not yet been created
 or been moved out of Incoming.
 The following information may help to resolve the situation:

 The following packages have unmet dependencies:
  linux-headers-2.6.32-5-amd64 : Depends: gcc-4.3 but it is not going to be installed
 E: Broken packages
 root@datasift:~# uname -a
 Linux datasift.sentimentmetrics.com 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux
  • 结论

所以,总而言之——systemtap 有可能在 Debian 上工作正常,在 Ubuntu 上工作的可能性很小,而且我没有时间继续。我希望我运行的是 BSD/Solaris 或带有标准仪器接口的东西,但不管你喜不喜欢,Linux 都是商品之神。

更新 4

与此同时,我设法使用了 Linux 审计框架,灵感来自于以下帖子:

我如何确定哪个进程在 Linux 上进行 UDP 通信?

我的 auditd 命令:

 auditctl -a exit,always -F arch=b64 -F a0=2 -S socket

生成以下格式的日志消息:

  type=SYSCALL msg=audit(1344346149.672:1670): arch=c000003e syscall=41 success=yes exit=5 a0=2 a1=1 a2=6 a3=1999999999999999 items=0 ppid=1 pid=29674 auid=0 uid=1003 gid=1003 euid=1003 suid=1003 fsuid=1003 egid=1003 sgid=1003 fsgid=1003 tty=(none) ses=124 comm="php5" exe="/usr/bin/php5" key=(null)

这很好,但最终没用,因为它们不包含程序参数。

我真正需要的(至少)是可以捕获参数的东西,例如:

 exe="/usr/bin/php5" args="/Administraitor/learn-to-code-hehe.php"   

理想情况下,我也希望能够按主机和端口进行过滤。

ubuntu
  • 2 个回答
  • 1315 Views
Martin Hope
Bryan Hunt
Asked: 2012-07-25 07:07:08 +0800 CST

nagios 安装后触发警报

  • 4

我刚刚安装了一堆 Nagios。现在是测试它们的时候了。我首先想做的只是快速完整性检查,以验证安装是否正确。

有没有一种快速的方法来触发 Nagios 警报,使用默认安装,而不是使用 dd 或类似的方式填满硬盘?

nagios
  • 4 个回答
  • 6239 Views
Martin Hope
Bryan Hunt
Asked: 2012-06-06 14:45:53 +0800 CST

防止满足 apt 依赖(永久)

  • -1

我想安装 mailman(只是为了使用它的邮件归档功能),但 Ubuntu 想要卸载大量额外的依赖项。

sudo apt-get install mailman 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2 apache2-mpm-worker apache2.2-common
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom spamassassin lynx listadmin

有什么方法可以将这些软件包( apache2 apache2-mpm-worker apache2.2-common )标记为永远不会安装?这不是 2002 年 ;)

ubuntu debian apache-2.2 apt mailman
  • 1 个回答
  • 77 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve