Navigation

VLC streaming

LAMP server

If you alter your httpd.conf file to include the following two lines the presence, and version, of the PHP module will be hidden - as will the version of Apache you're using:
ServerSignature Off
ServerTokens production

/etc/init.d/apache2 reload

PHP is a fantastic language and is perfect for you dynamic mySQL driven site, but the flexibility of it at the same time makes it vulnerable for external expoits. Here are a few tips of how to secure your php.ini !

Edit our php.ini by logging into shell with root :
vim /usr/lib/php.ini

IPTables - masquerade

1. Nastavte v klikátku pevnou IP karty,která je připojená k ostatním počítačům v DOMACÍ SÍTI - například 192.168.0.1 a masku podsítě 255.255.255.0 2. Nějaký dodatečný nastavení NAT - ethX je karta připojená k internetu Kód: {syntaxhighlighter brush: php}sudo iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE{/syntaxhighlighter} 3. Povolení IP forwardingu (potřebujete terminál superuživatele, ne příkaz sudo!) Kód: sudo gnome-terminal (resp. konsole) echo 1 > /proc/sys/net/ipv4/ip_forward 4. Nainstalujeme dnsmasq a ipmasq (to je na sdílení připojení nejdůležitější...

IPTables - QOS

#!/sbin/runscript

# NOTE!! - This script assumes your kernel has been patched with the
# appropriate HTB queue and IMQ patches available here:
# (subnote: future kernels may not require patching)
#
# http://luxik.cdi.cz/~devik/qos/htb/
# http://luxik.cdi.cz/~patrick/imq/
#

opts="start stop status"

depend() {
need net
}

#
#---------------------------------------------
#---------------------------------------------
#

DEV=eth0
RATEUP=3000

# 

IPTables

#!/bin/sh
# 1. Co jde do retezce INPUT , jde JEN_NA_TEN_STROJ do lokalniho procesu.
# 2. Co jde do retezce FORWARD je urceno jinam a nekam preposlano.
# 3. Co jde do retezce OUTPUT jde z LOKALNIHO_PROCESU masiny ven.
# 4. FORWARD i OUTPUT jdou nakonec do POSTROUTING
# Zakladni traverse packetu retezci je:
# Ethx -> PREROUTING -> FORWARD (nebo INPUT -> OUTPUT) -> POSTROUTING -> Ethx
 
# loopback
LO_IP="127.0.0.1/32"

# vnejsi rozhrani (eth0, eth1)
INET_IFACE="eth0"
LAN_IFACE="eth1"

# cesta k programu iptables
IPTABLES="/sbin/iptables"

PHP - File upload

<p>
<INPUT type="file" name="uploadedfile" size="62">

$trimmed=htmlspecialchars($_FILES["uploadedfile"]["name"]);
$trimmed=substr($trimmed, -3, 3);
$retez=$num_rows.".".$trimmed;

mysql_query("INSERT INTO quads (nazev,popis,cena,razeni,typ) VALUES ('$x_nazev','$x_popis','$x_cena','$x_razeni','$trimmed')");

$result=mysql_query("SELECT * FROM quads where nazev='$x_nazev' and popis='$x_popis'");
$cislo = @mysql_fetch_array($result);
//echo"$cislo[0]"; echo"<br>";
$uploaddir = './pictures/';
$uploadfile = $uploaddir . $cislo[0] . "." . $trimmed;

Upload souborů

<p>
<INPUT type="file" name="uploadedfile" size="62">

$trimmed=htmlspecialchars($_FILES["uploadedfile"]["name"]);
$trimmed=substr($trimmed, -3, 3);
$retez=$num_rows.".".$trimmed;

mysql_query("INSERT INTO quads (nazev,popis,cena,razeni,typ) VALUES ('$x_nazev','$x_popis','$x_cena','$x_razeni','$trimmed')");

$result=mysql_query("SELECT * FROM quads where nazev='$x_nazev' and popis='$x_popis'");
$cislo = @mysql_fetch_array($result);
//echo"$cislo[0]"; echo"<br>";
$uploaddir = './pictures/';
$uploadfile = $uploaddir . $cislo[0] . "." . $trimmed;

Kód a CSS

function URLEncode(plaintext){
// The Javascript escape and unescape functions do not correspond
// with what browsers actually do...
var SAFECHARS = "0123456789" + // Numeric
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
"abcdefghijklmnopqrstuvwxyz" +
"-_.!~*'()"; // RFC2396 Mark characters
var HEX = "0123456789ABCDEF";

var encoded = "";
for (var i = 0; i < plaintext.length; i++ ) {
var ch = plaintext.charAt(i);
if (ch == " ") {
encoded += "+"; // x-www-urlencoded, rather than %20
} else if (SAFECHARS.indexOf(ch) != -1) {
encoded += ch;
} else {
Tags: 

Linuxtero

Pages

Subscribe to www.duckd.cz RSS