Belekas

Viskas kas nepatenka i kitas kategorijas

May 102012
 

Flattr this!

Bash File Testing
-b filename Block special file
-c filename Special character file
-d directoryname Check for directory existence
-e filename Check for file existence
-f filename Check for regular file existence not a directory
-G filename Check if file exists and is owned by effective group ID.
-g filename true if file exists and is set-group-id.
-k filename Sticky bit
-L filename Symbolic link
-O filename True if file exists and is owned by the effective user id.
-r filename Check if file is a readable
-S filename Check if file is socket
-s filename Check if file is nonzero size
-u filename Check if file set-ser-id bit is set
-w filename Check if file is writable
-x filename Check if file is executable
Mar 102012
 

Flattr this!

Video: Atviras kodas bei jo svarba nūdienos visuomenėje

Prezentacija: Atviras kodas bei jo svarba nūdienos visuomenėje

Prezentacija (Atviras kodas bei jo svarba nūdienos visuomenėje) su public RW teisėmis

Creative Commons Licence
Atviras kodas bei jo svarba nudienos visuomeneje by Ruslanas Gžibovskis is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at lpic.lt.
Permissions beyond the scope of this license may be available at http://lpic.lt/2012/03/10/atviras-kodas-bei-jo-svarba-nudienos-visuomeneje/.

Mar 052012
 

Flattr this!

Sveiki, nusprendžiau pasidalinti, savo mikro sąrašiuku, kiniškų el. parduotuvių:

Mar 012012
 

Flattr this!

Sveiki, radau toki straipsniuką, kur išrašyti visi meta htmltag’o parametriukai.

Atributas Šaltinis Apibūdinimas
Allow rfc1945 Gives allowed http methods
Alternates rfc2068 List alternate representations
Bulletin-Date Lotus Date, e.g. 1997-03-24 15:57
Bulletin-Text Lotus Document description
Cache-Control rfc2068 Directives to cacheing mechanisms
Content-Base rfc2068 Specify base URL for entity
Content-Disposition rfc2183 Specify content handler (Microsoft)
Content-Encoding rfc1945 Gives compression scheme
Content-language rfc1945 Natural Language of document
Content-Length rfc1945 Size of body in bytes
Content-Location rfc2068 Resource location for entity
Content-MD5 rfc2068 MD5 digest of entity body
Content-Range rfc2068 Range of partial response
Content-Script-Type html40 Specifies default scripting language
Content-Style-Type html40 Specifies default style sheet language
Content-Type rfc1945 Media type
Content-type rfc1945
Content-Version rfc2068 Version tag of evolving entity
Date rfc1945 Date message originated (HTTP format)
Default-Style html40 Set preferred style sheet
Derived-From rfc2068 Version tag of previous version
ETag rfc2068 Entity tag for resource identification
Expires rfc1945 Expiry date of document (HTTP date format)
Ext-cache Netscape Alternate cache path
Instance-Delegate SHOE Pointer to Ontology Key
Instance-Key SHOE Ontology Key
Last-Modified rfc1945 Date resource was last changed
Link rfc1945 Relationship to other resources
Location rfc1945 URL of resource
MIME-Version rfc1945 May indicate MIME-compliance. Ignore.
Page-Enter MSIE 4 Sets page entry transistion
Page-Exit MSIE 4 Sets page exit transistion
PICS-Label PICS Document content labelling
Pragma rfc1945 no-cache prevents cacheing
Public rfc2068 List of supported methods by server
Range rfc2068 Specify subrange (bytes)
Refresh Netscape Delay till browser reloads (optional URL)
Server rfc1945 Gives information about server
Set-Cookie Netscape Sets cookie value
Site-Enter MSIE 4 Sets site entry transistion
Site-Exit MSIE 4 Sets site exit transistion
Title rfc1945 Title of entity (obsoleted in rfc2068)
Transfer-Encoding rfc2068 Specify transfer (cf. entity) encoding
URI rfc1945 URIs by which resource is located. (obsoleted in rfc2068)
Vary rfc2068 Specify that request was selected from alternates (e.g. different languages)
Via rfc2068 Generated by gateways
Warning rfc2068 Warning about cache problems, etc.
Window-target Netscape Specify target window of current document
Feb 252012
 

Flattr this!


Original

– čia pateikiamas tik vertimas!

Jei norite leisti prisijungti root naudotojui per SSH tik iš vieno IP, o kitiems naudotojams iš betkur kitur. Tokį sprendimą galime realizuoti per PAM autentifikacijos modulius. Naudosime pam_access PAM modulį, kuris naudojamas prieigos valdymui. Šis suteikia galimybę kontroliuoti prisijungimus atsižvelgiant į:

  • Naudotojo prisijungimo vardą (Login names)
  • Kompą ar domeną (Host or domain names)
  • IP ar IP tinklas (Internet addresses or network IP numbers)
  • Terminal line names etc

Kam naudojam pam_access?

Prie serverio gali reikėti prisijungti iš betkurio tinkle esančio kompiuterio. taigi turime pasirūpinti gera prieigos kontrole, naudojant OpenSSH servisą.

Kaip susikonfiguruoti pam_access?

Reikės keisti šiuos failiukus:

  1. /etc/pam.d/sshd
  2. Linux PAM konfiguracinis failas.

  3. /etc/security/access.conf
  4. Taisyklių paėmimui pagal nutylėjimą yra naudojamas šis failas.

Kai kasnors jungiasi, perbėgama per 2 bylos turinį ir jei yra sutapimas įvykdoma taisyklė. Mes galime nurodyti, ar priimti tokį prisijungimą ar atmesti. sintaksė: permission : username: origins kur:
permission : Teisių laukelis “+” (prieiga suteikiama) ar “-” (prieiga atšaukiama)
username : Linux sisteminis naudotojas (username)/login‘as (root ir kiti). Galima nurodyti ir grupės vardą. Arba galima nurodyti specialų trumpinį: ALL (Jei norime, kad tai būtų skirta visiems).
origins : Čia pateikiamas sąrašas terminalo langų, kompo vardų, IP adresų, domenų, kurie prasideda . ar specialų trumpinį ALL ar LOCAL

Visų pirma, kad tolesni pakeitimai veiktų reikia įjungti pam_access palaikymą byloje /etc/pam.d/sshd:


# vi /etc/pam.d/sshd
# Papildome eilute:
account required pam_access.so


Išsaugome ir uždarome.

Tarkime norime leisti naudotojam root ir lpic prisijungti tik iš IP adreso 1.1.1.1.

Atidarome bylą: /etc/security/access.conf su root’o teisėmis:


# vi /etc/security/access.conf
# Papildome eilute:
-: ALL EXCEPT root lpic:1.1.1.1


Išsaugome bylą.

Dabar SSH leis prisijungimus naudotojų root ir lpic tik iš 1.1.1.1 IP adreso. Jei naudotojas root ir lpic bandys jungtis iš kito IP adreso, jiems parašys: ‘Connection closed by xxx.xxx.xxx.xxx’ ir error pranešimu turėtų būti papildytas Jūsų žurnaliukas (log’as):


# tailf /var/log/message
Feb 20 19:02:39 hostname pam_access[2091]: access denied for user `lpic' from `xxx.xxx.xxx.xxx'


Kur, jau kaip ir minėjau xxx.xxx.xxx.xxx1.1.1.1.
Beje, jei įrašėte savo naudotojo vardą ir išsaugojote… VISOS TAISYKLĖS taikomos IŠKART po IŠSAUGOJIMO /etc/security/access.conf bylos! Būkite atsargūs!

Daugiau pavyzdukų:

a) Kartais reiktų sukurti taisykles, kurios leistų prisijungti visiems išskyrus rootbetkur, o root tik iš localhost:


-:root:ALL EXCEPT LOCAL
# ar
-:root:ALL EXCEPT localhost


b) Deny network and local login to all users except for user root and vivek:

-:ALL EXCEPT root vivek:ALL

c) Tik iš 192.168.1.0/24 leisti prisijungti root naudotoju:


+ : root : 192.168.1.0/24

Pastebėjimas: taip galime leisti ir drausti jungtis visoms tarnyboms, kurios naudoja PAM, pvz.: ftpd, telnet ir t.t.

P.S. + : root : yyy.yyy.yyy.yyy
- : root : ALL

Oct 122011
 

Flattr this!

Sveiki,

norėdami įdiegti Solaris 10u9 mdb programėlę susidiekime SUNWmdb ir SUNWmdbr paketus. Visų pirma prijunkime CD.ISO, kas gali būti atlikta tik iš globalios zonos (Jei nenaudojate konteinerių, tai galėjote pabraukto teksto ir neskaityti :) ):
lofiadm -a /tmp/software.iso /dev/lofi/1
mount -F hsfs -o ro /dev/lofi/1 /mnt

Pereikim į mum reikiamą aplanką
cd /mnt/Solaris_10/Product
Susimeskim visą tai:
pkgadd -d . SUNWmdb
pkgadd -d . SUNWmdbr

Toliau beliko arba prisijungti (ir sustabdyti) procesą: mdb -p ĖPID arba atidaryti core/dump failą: mdb core_dump
Na va o daba mdb komandos:

Control Commands
$< or $<< Replace input with a macro or source a macro.
$>filename or
::log filename
Log session to a file. If no filename, use default.
| Pipe. Allows simple commands to be joined.
! Shell escape. Acts as a pipe to a shell command. (Not available in kmdb.)
// Comment. Following words on the same line are ignored.
$M Show built-in macros (Kernel debugger only).
$Pstring Set prompt to string.
$Q
::quit
Quit. (From kmdb, use -u option to avoid exiting to ok> prompt.)
$W Re-open target in writable mode.
$p Change target context.
$w Control output page width.
:A Attach to a process or core file.
:R Release attachment.
:k Kill and release targets.
$v Print non-zero variables.
>
::typeset
Assign a variable.
::dcmds Print available commands.
::nm Print symbol table. (-P specifies a private symbol table. Manipulated with ::nmaddand ::nmdelete
::help dcmd Provide usage notes on a dcmd.
::typeset Manipulate variable.
::walk Walk data structure.
::walkers List available walkers.

 

 

Input & Output Commands
$< 
$<<
Replace input with a macro or source a macro.
$>filename Log session to a file. If no filename, use default.
address/format-spec
/format-spec
Read the value in a memory addressformatted as format-spec. If no address is provided, use dot.
address/W value Write the value in the four bytes starting with address. If no address is provided, usedotvw or Z may also be used instead of Wto write 1, 2 or 8 bytes, respectively.
address=format-spec
=format-spec
Format immediate value of address or dot.
? Read/write primary object file.
@format-spec Read/write physical address as format-spec.
\format-spec Read/write physical address as format-spec.

The difference between / and = is subtle. For example, to find the address holding the value of the maxphys symbol in decimal, we would run:
maxphys=D
To find the value inside the above address, we would use / like:
maxphys/D

 

 

Format Specification
Note that the ::formats dcmd prints out a full list of supported formats.
D Display in signed decimal.
i Display as a disassembled instruction.
U Display in unsigned decimal.
X Display in signed hexidecimal.
0txyz Specifies xyz as a decimal value.

 

 

System Examination
cpu$<cpus Display cpu0.
cpun$<cpu Display cpu #n.
$<msgbuf Display message buffer, including all console messages up to panic.
<sp$<stacktrace Use the stack pointer address (sp) to display a detailed stack trace.
$r
::regs
Display general registers, including program counter and stack pointer.
::callout Print callout table.
::cpuinfo -v Information about activities of CPUs, including runqueue inhabitants.
::cpuregs
::cpuregs -c cpuid
Print CPU registers. kmdb only. Can specify a cpu.
::cpustack
::cpustack -ccpuid
Print CPU stack. kmdb only. Can specify a cpu.
::dnlc Print DNLC contents.
::ipcs Print SVR4 IPC information.
::kmalog Display kernel memory log and stack traces.
::kmastat Print current kernel memory allocations
::memstat Print current memory usage.
::nm Print symbol table. (-P specifies a private symbol table. Manipulated with ::nmaddand ::nmdelete
::ps List processes with associated threads and lwps
::ptree Print process tree.

 

 

Target Examination
$? Print status and registers.
$C Show call trace and arguments, saved frame pointer and saved program counter for each stack frame.
$X$Y$x$y and::fpregs Display floating point registers.
$c Display stack backtrace.
$e Print list of global symbols.
$f Print list of source files.
$l Print representative thread’s lwp ID.
$m Print address space mappings.
$r
::regs
Display general registers, including program counter and stack pointer.
as::as2proc Convert as pointer to a proc_t pointer.
::devbindings devinfo nodes bound to device-name ormajor-num.
::devinfo Detailed devinfo of node.
::devinfo2driver Driver name for this node.
::devnames Print devnames array.
::devt Display dev_t‘s major & minor numbers.
::did2thread Kernel thread for this ID.
::dumpaddress Dump memory from address.
::findfalse Find potentially falsely shared structures.
::findleaks Search for potential kernel memory leaks.
::findlocks Find locks held by specified thread.
threadp::findstack Find kernel thread stack for associated thread.
::inode Display summary of inode_t.
::kmsqid Display message queue structure (kmsqid).
::ksemid Display a semaphore structure (ksemid).
::kshmid Display a shared memory structure (kshmid).
::pgrep pattern Find proc_t pointers matching the pattern.
0tPID::pid2proc Convert decimal PID to a proc_t pointer.
procp::ps Process information matching the associated proc_t.
::status Print summary of target status.
sobj::walk blocked Walk threads blocked on a particular synchronization object (sobj).
procp::walk thread Walk threads of associated process.
sobj::wchaninfo -v Blocked on condition variables for a particular synchronization object (sobj).
address::whatis Attempts to identify address contents.
vnode::whereopen Processes with vnode open.

 

 

Tracing, Watchpoints and Breakpoints
(Breakpoints for kernel debugger only.)
$b Show all breakpoints.
$i Print list of ignored signals.
:a Set a watchpoint.
:b Set a breakpoint.
:c or ::cont Continue target execution.
:d Delete a breakpoint.
:e Step over next instruction.
:i Step over next instruction.
:k Kill and release targets.
:p Set execute access watchpoints.
:r Run new target process.
:s Step target to next instruction.
:t Stop on delivery of specified signals.
:u Step out of current function.
:w Set write access watchpoint.
:z Delete all breakpoints.

 

 

General Debugging
$G Toggle C++ demangling.
$V Toggle disassembly mode.
$g Toggle C++ demangling.
address::dis Disassemble text starting at address.

 

 

Comparison Operators
== Logical equality.
!= Logical inequality.
& Bitwise AND.
| Bitwise OR.
^ Bitwise XOR.
Oct 082011
 

Flattr this!

Sveiki, turiu darbo, taiatsiranda laiko parašyt skriptukus, nusprendžiau vienu jų pasidalinti.

Pasirašiau 88×31 uptime baneriuką: .

$uptime=shell_exec ("cat /proc/uptime | awk '{print $1}'");
function getTime ($unix_laikas) {
if ($unix_laikas<60) {
$returnas=intval($unix_laikas);
if ($returnas<10) {$returnas="0".$returnas;} return $returnas."!";
} elseif (60<=$unix_laikas && $unix_laikas<3600) {
$returnas=intval($unix_laikas/60);
if ($returnas<10) {$returnas="0".$returnas;} return $returnas;
} elseif (3600<=$unix_laikas && $unix_laikas < 86400) {
$returnas=intval($unix_laikas/3600);
if ($returnas<10) {$returnas="0".$returnas;} return $returnas;
} else {
return intval($unix_laikas/86400);
}
}

function uptime ($s0, $s1, $s2) {
$iwidth=88; $iheight=31;
// create a true colour, transparent image
// turn blending OFF and draw a background rectangle in our transparent colour
$image=imagecreatetruecolor($iwidth,$iheight);
imagealphablending($image,false);
$col=imagecolorallocatealpha($image,255,255,255,127);
imagefilledrectangle($image,0,0,$iwidth,$iheight,$col);
imagealphablending($image,true);
// Alpha blanding is back on.
// insert image manipulation stuff in here
$font=3;
$red=imagecolorallocatealpha($image,0,0,0,0);
imagestring($image, $font, 1, 0, $s0, $red);
imagestring($image, $font, 1, 9, $s1, $red);
imagestring($image, $font, 1, 20, $s2, $red);
// output the results...
header("Content-Type: image/png;");
imagealphablending($image,false);
imagesavealpha($image,true);
imagepng($image);
}
if ($uptime<60) { // Sekundes
$s1="up 0 days";
$s2="00:00:".getTime($uptime);
} elseif (60<=$uptime && $uptime<3600) { // Minutes
$tmp=getTime($uptime);
$s1="up 0 days";
$s2="00:".$tmp.":".getTime($uptime-($tmp*60));
} elseif (3600<=$uptime && $uptime<86400) { // Valandos
$tmp=getTime($uptime);
$s1="up 0 days";
$s2=$tmp.":";
$uptime-=$tmp*3600;
$tmp=getTime($uptime);
$s2.=$tmp.":".getTime($uptime-($tmp*60));
} else {
$tmp=getTime($uptime);
$s1="up ".$tmp ." days";
$uptime-=$tmp*86400;
$tmp=getTime($uptime);
$s2=$tmp.":";
$uptime-=$tmp*3600;
$tmp=getTime($uptime);
$s2.=$tmp.":".getTime($uptime-($tmp*60));
}

$s0=shell_exec("hostname -d");
$s0=substr($s0, 0, strlen($s0)-1);
uptime ($s0, $s1, $s2);
?>

Jeigu turite idėjų, kaip visą tai atnaujinti brūkūtelėkite.