Re: [CentOS] CentOS 6 and screenshot of website

2012-01-05 Thread Walter Haidinger
Am 05.01.2012 12:52, schrieb John Hodrien:
> So he wants to be able to capture an image of what a website looks like from
> the command line, and not really take a screenshot at all.

Indeed, as there is no screen...

This is diffcult, as websites need to be rendered
and one just has to google for ACID-3 to see that
this not that straightforward.

> I think that's a fair summary anyway...

Yes, thanks for the clarification!

As a workaround, I'd use a "virtual" screen, i.e.
automate the tasks that would have to be done for
a "real" screenshot. This can be scripted without
any user interaction:

* Run Xvnc in the desired resolution/depth
  Sort of a headless X11, debug by connecting via VNC
* setup authentication using xauth (or even xhost if desperate)
* export $DISPLAY to access it
* open the URL to "screenshot" in firefox/chrome/opera, e.g.
  firefox -height x -width y "$url"
  (the -height and -width options still work, right?)
* run xwininfo and grep for the name of the browser window
  to get the windows id
* Screenshot it:
  xwd -id $browserid | xwdtopnm | pnmtojpeg > website.jpg
* kill firefox process
* kill Xvnc if no more screenshots are needed

All steps can also be done manually, therefore
debugging should be easily step by step.

Walter
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] CentOS 6 and screenshot of website

2012-01-05 Thread Walter Haidinger
Am 05.01.2012 09:19, schrieb Jani Ollikainen:
> Yes, the need was for automated command line tool which I can use
> without requiring any user interaction.

Use option -id or -name of xwd(1) to specify the window, e.g:
xwd -id 0xc000c5 | xwdtopnm | pnmtojpeg > win.jpg

To find the id or name, parse the output of:
xwininfo -root -children

Walter


___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] CentOS 6 and screenshot of website

2012-01-05 Thread Walter Haidinger
Am 04.01.2012 10:46, schrieb Jani Ollikainen:
> How one is supposed to do screenshots of a website with CentOS 6?
For X11, there is xwd(1): X window dump.
Prompts you to click on a window and dumps its contents.

To "screenshot" a single window and save it as a jpeg, e.g.:

xwd | xwdtopnm | pnmtojpeg > window.jpg

Under CentOS 6, xwd is part of the xorg-x11-apps package,
xwdtopnm and pnmtojpeg come with netpbm-progs.

Hope that helps.

Walter

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Centos VPS Kernel 2.6.35.4 & 'string-less' IP tables

2011-08-31 Thread Walter Haidinger
Am 31.08.2011 15:18, schrieb Always Learning:
>>> uname -a =  2.6.35.4 #2  (don't know how this got installed)
> 
>> This is not a CentOS-provided kernel; as has been said elsewhere
>> in the thread, this is likely an OpenVZ kernel.  Your hosting

No stock OpenVZ kernel, see http://download.openvz.org/kernel/branches/
for the available OpenVZ kernel branches. 2.6.32 is the most recent.

> A very helpful and knowledgeable poster, Walter Haidinger, in his email
> dated Wed, 31 Aug 2011 13:10:16 +0200 (12:10 BST), gave what appears to
> be an ideal solution.
>   * get a more recent iptables from netfilter.org
>   * install to a different location
>   * how to install it

Please note that wanted to provide fix to your problem, which is hardly
an ideal solution. You might want to read my reply to KB post and
my emphasis on keeping a "clean" distribution.

> The server provider's suggestion
> 
>   modprobe ipt_string

So your kernel is missing the required iptables kernel module too.
I really doubt that you've permission to load a kernel module from
inside of an OpenVZ container. AFAIK this must be done on the host.

Once the kernel module is loaded, you can try if your stock iptables
works. If not, you'll have to try a newer release as I suggested in the
first place.

> So I am observing.
> Thank you.

Good luck, you're welcome.

Regards,
Walter
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Centos VPS Kernel 2.6.35.4 & 'string-less' IP tables

2011-08-31 Thread Walter Haidinger
Am 31.08.2011 15:35, schrieb Karanbir Singh:
>> PS: To install iptables from source is pretty straightforward:
>>  get the tarball from netfilter.org, unpack and run:
>>  ./configure --prefix=/opt/iptables&&  make&&  make install
> 
> And at that point you lose. All management capability or the ability to 
> audit / track or even upgrade along the distro. Installing from source, 
> is almost always the wrong solution; There are *some* places where it 

Yes, it should be an exception. I wanted to present a fix to the OP problem.
The correct solution would be to point him to a repository from where he can
install/update a newer iptables package. Unfortunately, I don't know any.

Installing from source should be considered the "quick & dirty" solution.
That is why I install to a _distinct_ /opt directory, _not_ overwriting
any rpm-owned files, and set the path to it only where needed, not globally.

Your advice holds true if one is not careful to keep the distro "clean",
i.e. prevent mixing it with non-distro files when running just running
configure without --prefix (thus installing to /usr/local or, even worse,
to /usr) or by installing "alien" other-distro rpm packages.

Maybe it should be emphasized that it is _critical_ to keep a "clean"
distribution. Otherwise yes, I absolutely agree with your statement above. 

Installing a few packages to a distinct directory don't hurt cleanliness, 
IMHO. It is not in the PATH by default and can easily be "uninstalled" by
a "rm -r /opt/foo".

Not to forget: Any manually installed package must be maintained anyways,
regardless if built from source or installed by rpm. 

> might be a workable solution, but really do you want your first line of 
> machine defence to be from source ? Just the amount of effort needed to 
> make something like that work is huge.

In my particular case, the new iptables are _only_ used to fill the mangle
table. Anything else is done by the stock iptables, so only the QoS rules
would be affected. Not that critical.

Of course, when running a newer (read: unsupported) kernel, such as 2.6.32
or 2.6.35, on CentOS 5, you'd better verify everything works for you in a test
environment before deploying it in the wild. 

Regards,
Walter
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Centos VPS Kernel 2.6.35.4 & 'string-less' IP tables

2011-08-31 Thread Walter Haidinger
Am 31.08.2011 04:24, schrieb Always Learning:
> 
> On a VPS I wanted to add to IP tables:-
> iptables -A  -p tcp -m string --algo bm --string 'login' -j DROP
> 
> I got:
>   iptables: Unknown error 18446744073709551615
>
> uname -a =  2.6.35.4 #2  (don't know how this got installed)
> lsmod | grep ipt = ipt_LOG   5419  2 
> yum upgrade iptables* = nothing to install.

I had similar problems back with CentOS 5.4 and non-distro kernel 2.6.32
when I tried to use the MARK target.

The fix was to get a more recent iptables from netfilter.org.
iptables-1.4.7 work for me, currently CentOS 5.6 and kernel 2.6.35.14
in production.

Since I only require the newer iptables command when adding MARK targets
to the mangle table, I've installed netfilter.org iptables to /opt/iptables
and "set export PATH=/opt/iptables/sbin:${PATH}" in scripts where needed.
Yes, no custom rpm built, just a quick and dirty install to /opt...

FYI, kernels 2.6.32 and 2.6.35 work fine with CentOS 5 except for the
the iptables issue above and a (minor) mcelog problem, IIRC.

Hope that helps,
Walter

PS: To install iptables from source is pretty straightforward:
get the tarball from netfilter.org, unpack and run:
./configure --prefix=/opt/iptables && make && make install
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] qemu-kvm-0.15 + CentOS 5.6 + vanilla 2.6.35.14 (working, patch included)

2011-08-23 Thread Walter Haidinger
Hi!

Just in case somebody else needs this. Below is a patch which
allows building qemu-kvm-0.15 unter CentOS 5.6 with vanilla
kernel 2.6.35.14 and (optionally) vde2 [1].

FYI: qemu-kvm-0.15 compiles fine on CentOS 6 with distro-kernel,
 no patches needed.

For CentOS 5.6, unpack 0.15 qemu-kvm tarball [2], apply the path
below, configure and compile. Make sure to export the kernel include
path before building, otherwise the kernel mman-common.h header
won't be found:
export CPATH=/lib/modules/2.6.35.14/build/include

The patch also adds some #error pragmas to make sure that
KSM is used. This isn't a requirement to run, though.

If you'd like to use vde2 too, then additionally export the paths to
the vde2 installation (here: /opt/vde2) before configure (if vde2 is
not installed in /opt/vde2 then change your paths accordingly):
export CCFLAGS="-I/opt/vde2/include"
export LDFLAGS="-L/opt/vde2/lib"
export LD_LIBRARY_PATH="/opt/vde2/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

With the above, ./configure --enable-vde works (for me).

I'm posting this here, rather than on a kvm list, because this is
rather CentOS 5 specific, IMHO.

Anyways, if you reply to this, please be sure to add a CC: to my email
address. While I am subscribed to this list, your email might get buried
by the list traffic. Thanks.

Best regards,
Walter

References:
[1] http://vde.sourceforge.net/
[2] 
http://sourceforge.net/projects/kvm/files/qemu-kvm/0.15.0/qemu-kvm-0.15.0.tar.gz/download

PS: The g_strcmp0() function was ripped from the URL below, just happened to be 
on top of Google's search results. (c) therefore of authors "Sysadmin 
Ramblings".
http://ramblings.narrabilis.com/patches/nautilus-dropbox-0.6.3-puias.patch

--- qemu-kvm-0.15.0/exec.c.orig 2011-08-19 11:36:04.0 +0200
+++ qemu-kvm-0.15.0/exec.c  2011-08-19 11:36:35.0 +0200
@@ -72,6 +72,15 @@
 //#define DEBUG_IOPORT
 //#define DEBUG_SUBPAGE
 
+#include 
+#ifndef MADV_MERGEABLE
+#error MADV_MERGEABLE
+#endif 
+
+#ifndef QEMU_MADV_MERGEABLE
+#error QEMU_MADV_MERGEABLE
+#endif
+
 #if !defined(CONFIG_USER_ONLY)
 /* TB consistency checks only implemented for usermode emulation.  */
 #undef DEBUG_TB_CHECK
--- qemu-kvm-0.15.0/qemu-common.h.orig  2011-08-19 11:34:22.0 +0200
+++ qemu-kvm-0.15.0/qemu-common.h   2011-08-19 11:17:18.0 +0200
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef _WIN32
 #include "qemu-os-win32.h"
--- qemu-kvm-0.15.0/osdep.h.orig2011-08-19 11:34:22.0 +0200
+++ qemu-kvm-0.15.0/osdep.h 2011-08-19 11:17:18.0 +0200
@@ -10,6 +10,11 @@
 
 #include 
 
+#include 
+#ifndef MADV_MERGEABLE
+#error MADV_MERGEABLE undefined
+#endif 
+
 #ifndef glue
 #define xglue(x, y) x ## y
 #define glue(x, y) xglue(x, y)
@@ -95,6 +100,11 @@
 
 #define QEMU_MADV_INVALID -1
 
+#include "config-host.h"
+#ifndef CONFIG_MADVISE
+#error CONFIG_MADVISE undefined
+#endif
+
 #if defined(CONFIG_MADVISE)
 
 #define QEMU_MADV_WILLNEED  MADV_WILLNEED
@@ -102,11 +112,13 @@
 #ifdef MADV_DONTFORK
 #define QEMU_MADV_DONTFORK  MADV_DONTFORK
 #else
+#error QEMU_MADV_DONTFORK undefined
 #define QEMU_MADV_DONTFORK  QEMU_MADV_INVALID
 #endif
 #ifdef MADV_MERGEABLE
 #define QEMU_MADV_MERGEABLE MADV_MERGEABLE
 #else
+#error MADV_MERGEABLE undefined
 #define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
 #endif
--- qemu-kvm-0.15.0/qemu-ga.c.orig  2011-08-19 11:34:22.0 +0200
+++ qemu-kvm-0.15.0/qemu-ga.c   2011-08-19 11:17:18.0 +0200
@@ -33,6 +33,9 @@
 #define QGA_BAUDRATE_DEFAULT B38400 /* for isa-serial channels */
 #define QGA_TIMEOUT_DEFAULT 30*1000 /* ms */
 
+/* add g_strcmp0() here which isn't available in CentOS 5 glib library */
+int g_strcmp0(const char *str1, const char *str2); /* prototype */
+
 struct GAState {
 JSONMessageParser parser;
 GMainLoop *main_loop;
@@ -134,6 +137,15 @@
 s->logging_enabled = true;
 }
 
+/* add g_strcmp0() here which isn't available in CentOS 5 glib library */
+int g_strcmp0(const char *str1, const char *str2)
+{
+ if( str1 == NULL && str2 == NULL ) return 0;
+ if( str1 == NULL ) return -1;
+ if( str2 == NULL ) return 1;
+ return g_strcasecmp(str1, str2);
+};
+
 static void ga_log(const gchar *domain, GLogLevelFlags level,
const gchar *msg, gpointer opaque)
 {

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos