Techn4b’s Blog

July 2, 2009

How to install RPM?

Filed under: Linux — Tags: , , — techn4b @ 16:37

rpm -Uhv {name}.rpm

Parameter info:
U for Update or Install, better than option “i” as it also upgrads
v for verbose information
h for print hash marks, Install progress

f.ex.:

# rpm -Uhv oracle-instantclient11.1-basiclite-11.1.0.7.0-1.x86_64.rpm

Advertisements

April 24, 2009

Linux change route eth1

Filed under: Linux — Tags: , , , , , , — techn4b @ 12:30

Problem: default route needs to be changed from eth0 to eth1

Environment: SuSE Linux 10.3 with SuHosin

Route print:

server:/ # route

Kernel IP Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
172.31.40.0     *               255.255.248.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         172.31.40.1     0.0.0.0         UG    0      0        0 eth0

Solution:

add eth1 interface /etc/sysconfig/network/ifcfg-eth1, set defaultroute for eth1 in /etc/sysconfig/network/routes

server:/ # route add default gw 10.64.240.1 dev eth0

server:/ # route
Kernel IP Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
172.31.40.0     *               255.255.248.0   U     0      0        0 eth0
172.31.40.0     *               255.255.248.0   U     0      0        0 eth1
link-local      *               255.255.0.0     U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         172.31.40.1     0.0.0.0         UG    0      0        0 eth1

restart network

server:/etc/rc.d # ./network restart
Shutting down network interfaces:
    eth0      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth0                                                              done
    eth1      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth1                                                              done
Shutting down service network  .  .  .  .  .  .  .  .  .  .  .  .  .  done
Hint: you may set mandatory devices in /etc/sysconfig/network/config
Setting up network interfaces:
    lo
    lo        IP address: 127.0.0.1/8
Checking for network time protocol daemon (NTPD):                     running
    lo                                                                done
    eth0      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth0      IP address: 172.31.40.4/21
    eth0:GLORIAGW2 IP address: 172.31.40.3/21
Checking for network time protocol daemon (NTPD):                     running
    eth0                                                              done
    eth1      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth1      IP address: 172.31.40.2/21
Checking for network time protocol daemon (NTPD):                     running
    eth1                                                              done
Setting up service network  .  .  .  .  .  .  .  .  .  .  .  .  .  .  done

Comment:

unfinished yet

April 23, 2009

Snort – no sensor

Filed under: Linux — Tags: , , , , , , — techn4b @ 12:06

Problem: No sensor after fresh snort installation

Environment: snort 2.8.4, SuSE Linux 10.3 with SuHosin, base-1.4.1, adodb508, mysql 5.0.67

Codehack found at snort.org:

snortml@iotti.biz wrote:
> I’m having exactly the same problem: fresh 2.8.4 install with mysql output:
> sensor table never gets inserted a row.
>
> I think I have found the problem and produced a simple patch but please,
> revise it: I’m not a coder, and have no particular experience with snort. So
> I’m not sure my patch can not have some side-effecs.
>
> That said, the problem seems to be in Select() in
> src/output-plugins/spo_database.c , in the portion of the function used with
> the mysql db (I did not examine other dbs’ code).
> This function makes a SQL SELECT and, upon success, returns the fetched
> value converted to integer. When it encounters an error, returns 0.
> But, as a special case, when the query was successfull but did not yeld any
> row, it returns 1. There is no distinction whether the “1” returned was
> because the value “1” was fetched from the DB, or simply the DB did not
> return any row.
> As a consequence, when this code is executed:
>
> data->shared->sid = Select(select_sensor_id,data);
> if(data->shared->sid == 0)
> {
> Insert(insert_into_sensor,data);
>
> the Select() returns 1, and the Insert() is never done.
> So the sensor table remains empty.
>
> My patch is just as simple as:

 # diff -ubB spo_database.c.orig spo_database.c
 --- spo_database.c.orig      2009-04-13 16:03:49.000000000 +0200
 +++ spo_database.c   2009-04-13 15:59:53.000000000 +0200
 @@ -2798,6 +2798,14 @@
                      {
                          result = atoi(data->m_row[0]);
                      }
                    else
                    {
                        result = 0;
                    }
                }
                else
                {
                    result = 0;
                  }
              }
              mysql_free_result(data->m_result);

> I simply return 0 (false) if the query was technically successfull, but no
> result was found.
>
> As I said, I would like some expert to revise the patch, since I don’t know
> if in ALL SITUATIONS it is right to return 0 (just like there was an error)
> when we have no value returned. I’m just sure it’s better to return 0 than
> 1.
>
> Cheers
> Luigi

Comment:

Modify src/output-plugins/spo_database.c as described above, re-compile, make, make install worked fine for me. Thx Luigi

*** RS

Create a free website or blog at WordPress.com.