Halaman

Tampilkan postingan dengan label Apache. Tampilkan semua postingan
Tampilkan postingan dengan label Apache. Tampilkan semua postingan

Senin, 18 Oktober 2021

Cassandra Installation Using Docker On Windows

1. Make sure you have installed Docker Desktop for Windows.

2. Open Windows PowerShell

3. Download Cassandra image from the Docker Hub registry. 
Let’s pull Cassandra 4.01 image by type this command: docker pull cassandra:4.0.1


4. Start Cassandra

To start Cassandra, use docker run command that first creates a writeable container layer over the specified image, and then starts it using the specified command in a new container 

docker run --rm --name fercassandra -dp 9042:9042 cassandra:4.0.1


The --rm flag automatically removes the container (fercassandra) when it exits,
--name flag assign a name to the container
--detach , -d flag run container in background and print container ID
--publish , -p flag publish a container's port(s) to the host

5. Cassandra is running


6. CQL Shell

a.  Click CLI button to open window for interacting with Cassandra using CQL,

 then type this query: 

SELECT cluster_name, listen_address, listen_port, data_center, rpc_address, rpc_port FROM system.local;


b. Use docker exec command to run CQL Shell in a running container, then type the query:

c. Use docker exec command to run CQL shell cqlsh for interacting with Cassandra using CQL (the Cassandra Query Language). It is shipped with every Cassandra package, and can be found in the bin/ directory alongside the cassandra executable.


7.  Show more..
a. Use docker ps command to shows running containers:


b. Use docker port command to list port mappings or a specific mapping for the container:


That's enough for now, hope it helps someone.

Sabtu, 09 Oktober 2010

Using PHP Radius Extension


The FreeRADIUS server software package includes several tools to assist in testing and using the server, some pf them is Radclient and Radtest. To work with applications such as Web inventory Systems, the system has to connect with Radius server using Radius Client. Today I use PHP Radius Extension as Radius client.

PHP Radius client library
This package is PECL extension for Radius (Remote Authentication Dial In User Service). This extension is based on the libradius of FreeBSD. It allows clients to perform authentication and accounting by means of network requests to remote servers.


Auth_RADIUS
This package is a php wrapper around the php radius extension. There are different Classes for the different authentication methods available through RADIUS. If we are using CHAP-MD5 or MS-CHAP authentication, we will also need the Crypt_CHAP package. In addition, if using MS-CHAP authentication, we will need to enable the mhash and mcrypt extension in php.ini. Documentation of the radius extension is available through the PHP manual at http://www.php.net/radius

In previous install link, my sistem has these modules installed
# php -m
[PHP Modules]
Core
date
ereg
gd
libxml
mysql
mysqlnd
pcre
Reflection
session
SPL
standard

I started the installation with the following sequence:

1. Install Auth_Radius a PEAR wrapper classes for the RADIUS PECL.
#/usr/ports/net/pear-Auth_RADIUS
#make
===> Registering installation for pear-1.9.1
===> Returning to build of pear-Auth_RADIUS-1.0.6
===> Configuring for pear-Auth_RADIUS-1.0.6
===> Registering installation for pecl-radius-1.2.5
#make install
----------------------------------------------------------------------
Libraries have been installed in:
/usr/ports/net/pecl-radius/work/radius-1.2.5/modules
****************************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini
configuration file to automatically load the installed extension:
extension=radius.so
****************************************************************************
===> Returning to build of pear-Auth_RADIUS-1.0.6
===> Generating packing list
===> Generating temporary packing list
===> Checking if net/pear-Auth_RADIUS already installed
===> Installing examples in /usr/local/share/examples/pear/Auth_RADIUS.
install ok: channel://pear.php.net/Auth_RADIUS-1.0.6
===> Registering installation for pear-Auth_RADIUS-1.0.6

# make clean
===> Cleaning for pear-1.9.1 ###PEAR framework for PHP
===> Cleaning for php5-5.3.3_2
===> Cleaning for pecl-radius-1.2.5 ###Radius client library for PHP
===> Cleaning for php5-xml-5.3.3_2
===> Cleaning for pear-Auth_RADIUS-1.0.6 ###PEAR wrapper classes for the RADIUS PECL


2. Install additional package
#/usr/ports/security/pear-Crypt_CHAP
extension=mcrypt.so
extension=hash.so

3. List modules installed
# php -m
[PHP Modules]
Core
date
ereg
gd
hash
libxml
mcrypt
mhash
mysql
mysqlnd
pcre
radius
Reflection
session
SPL
standard
xml

# pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.7 stable
Auth_RADIUS 1.0.6 stable
Console_Getopt 1.2.3 stable
Crypt_CHAP 1.0.2 stable ### here version 1.0.2
PEAR 1.9.1 stable
Structures_Graph 1.0.3 stable


4.I have to upgrade Crypt_CHAP (replace mhash function to hash function, because I'm on php5.3)
# pear upgrade
downloading Crypt_CHAP-1.5.0.tar ...
Starting to download Crypt_CHAP-1.5.0.tar (Unknown size)
........done: 22,528 bytes
upgrade ok: channel://pear.php.net/Crypt_CHAP-1.5.0
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.7 stable
Auth_RADIUS 1.0.6 stable
Console_Getopt 1.2.3 stable
Crypt_CHAP 1.5.0 stable
PEAR 1.9.1 stable
Structures_Graph 1.0.3 stable

5. Restart Apache service
#apachectl graceful

6. Start Radius in debug mode



7. Test authentication



8. Use sample number 2 from here and modify arguments as needed, and test it. It works.




Jumat, 08 Oktober 2010

Installation of Mondes' LAB1

Steps to install Mondes' LAB1. This was done remotely via telnet, from 11.50pm to 02.30am.

1. Install Apache web server with prefork MPM (apache-2.0.63_16)
#cd /usr/ports/www/apache20 (released 2008-01-19)
#make install clean
(current Apache is v2.2.16, released 2010-07-25)


2. Install current version of PHP5 (php5-5.3.3_2, released 2010-07-22)
#cd /usr/ports/lang/php5
#make install clean
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
***************************************************************
This port has installed the following files which may act as network servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache2/libphp5.so
/usr/local/bin/php
/usr/local/bin/php-cgi

AddType application/x-httpd-php .php <<.html>>
AddType application/x-httpd-php-source .phps


3. Install mysql shared extension for php (php5-mysql-5.3.3_2)
#cd /usr/ports/databases/php5-mysql
#make install clean
***************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini configuration file to automatically load the installed extension:
extension=mysql.so
***************************************************************


4. Install session shared extension for php (php5-session-5.3.3_2)
#cd /usr/ports/www/php5-session
#make install clean
***************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini
configuration file to automatically load the installed extension:
extension=session.so
***************************************************************


5. Install gd shared extension for php (php5-session-5.3.3_2)
#cd /usr/ports/graphics/php5-gd
#make install clean
****************************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini
configuration file to automatically load the installed extension:
extension=gd.so
****************************************************************************

6. Install text-based web browser
#cd /usr/local/www/lynx
#make install clean
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/bin/lynx


7. Make FreeBSD reread the files in the path so it knows what's there
#rehash


8. Adding PHP5 module to Apache
#cd /usr/local/etc/apache2/
===>modify httpd.conf


9. Create test page
# echo ""  >> /usr/local/www/data/tester.php


10.Test the installation
#apachectl start
#lynx localhost/tester.php

ready for web management (RADIUS and Monitoring).

Kamis, 08 April 2010

Conditional Logging in Apache

Apache server records all incoming requests and all requests processed to a log file. This article will show how to conditionally records or prevents log entries into access log file.

The location and content of the access log are controlled by the CustomLog directive. To find Apache access log file location, we could grep httpd.conf file, for example:
#grep CustomLog /usr/local/etc/apache22/httpd.conf

CustomLog /var/log/httpd-accessviaproxy.log combined env=!is-forwarder
CustomLog /var/log/httpd-accessfwd.log fwd env=is-forwarder
CustomLog /var/log/httpd-accessviaproxy.log combined env=!gbrnolog
CustomLog /var/log/httpd-accessfwd.log fwd env=!gbrnolog

The CustomLog directive is used to log requests to the server. A log format is specified, and the logging can optionally be made conditional on request characteristics using environment variables. The syntax is:
CustomLog filepipe formatnickname [env=[!]environment-variable]

The first argument, which specifies the location to which the logs will be written, can take one of the following two types of values:file i.e A filename, relative to the ServerRoot; and pipe i.e The pipe character "", followed by the path to a program to receive the log information on its standard input.

The third argument is optional and controls whether or not to log a particular request based on the presence or absence of a particular variable in the server environment. If the specified environment variable is set for the request (or is not set, in the case of a 'env=!name' clause), then the request will be logged.

For example, the following two sets of directives have exactly the same effect:

# CustomLog with format nickname
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common


# CustomLog with explicit format string
CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"


In the following example, we separate log file for accessing through a proxy and the other for external access of a web server.


<--IfModule log_config_module>
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" fwd

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
# If you do not specify an ErrorLog directive within a

# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a
# container, that host's errors will be logged there and not here.
ErrorLog /var/log/httpd-error.log
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder


#ignore these elements into logs.
# Here we exclude some files from our log
SetEnvIf Request_URI "(\.png\.gif\.jpg\.ico\.css)$" nologimage
#CustomLog /var/log/httpd-access.log common
CustomLog /var/log/httpd-accessviaproxy.log combined env=!is-forwarder
CustomLog /var/log/httpd-accessfwd.log fwd env=is-forwarder
CustomLog /var/log/httpd-accessviaproxy.log combined env=!nologimage
CustomLog /var/log/httpd-accessfwd.log fwd env=!nologimage
< /ifmodule>

When using conditional logging, the environment variable system sets a variable based on the request. The CustomLog directive accepts an environment condition that will be applied to the CustomLog configured.

If we would like to exclude our own IP address for example localhost, use this:

SetEnvIf Remote_Addr "127\.0\.0\.1" ignoreme

or to mark requests for the robots.txt file

SetEnvIf Request_URI "^/robots\.txt$" ignoreme
CustomLog "logs/access.log" common env=!ignoreme


The format of the access log is highly configurable. Here some of format string for LogFormat:
%a Remote IP-address
%A Local IP-address
%b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.
%B Size of response in bytes, excluding HTTP headers.
%h Remote host
%H The request protocol
%l Remote logname (from identd, if supplied). This will return a dash unless mod_ident is present and IdentityCheck is set On.
%r First line of request
%R The handler generating the response (if any).
%s Status. For requests that got internally redirected, this is the status of the *original* request --- %>s for the last.%u Remote user (from auth; may be bogus if return status (%s) is 401)
%U The URL path requested, not including any query string.
%t Time the request was received (standard english format)
%T The time taken to serve the request, in seconds.

By using conditional logging, we could ignore or prevent writing entry at our log file.

For detail:
http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html
http://httpd.apache.org/docs/2.2/mod/mod_log_config.html

Rabu, 24 Maret 2010

Apache status di Debian dan BSD

1. DEBIAN
debpc:~# uname -a
Linux debpc 2.6.26-2-686 #1 SMP Wed Aug 19 06:06:52 UTC 2009 i686 GNU/Linux

debpc:~# apache2 -v
Server version: Apache/2.2.9 (Debian)Server built: Nov 14 2009 20:23:49
debpc:~# /etc/init.d/apache2 restart
Restarting web server: apache2 ... waiting .

debpc:~# ps -ef | grep apache2 | grep -v grep
root 8825 1 0 08:39 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 8832 8825 0 08:39 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 8833 8825 0 08:39 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 8834 8825 0 08:39 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 8835 8825 0 08:39 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 8836 8825 0 08:39 ? 00:00:00 /usr/sbin/apache2 -k start

debpc:~# ps ax | grep apache2 | grep -v grep
 8825 ? Ss 0:00 /usr/sbin/apache2 -k start
 8832 ? S 0:00 /usr/sbin/apache2 -k start
 8833 ? S 0:00 /usr/sbin/apache2 -k start
 8834 ? S 0:00 /usr/sbin/apache2 -k start
 8835 ? S 0:00 /usr/sbin/apache2 -k start
 8836 ? S 0:00 /usr/sbin/apache2 -k start

debpc:~# ps -ef | grep apache2 | grep -v grep| wc -l
6
debpc:~# netstat -l | grep www
tcp 0 0 192.168.70.11:www *:* LISTEN
tcp 0 0 192.168.70.10:www *:* LISTEN


2. OpenBSD
# uname -a
OpenBSD tobi.binsar.com 4.4 GENERIC#1021 i386

# httpd -v
Server version: Apache/1.3.29 (Unix)

# apachectl stop
/usr/sbin/apachectl stop: httpd stopped

# apachectl start
/usr/sbin/apachectl start: httpd started

# apachectl restart
/usr/sbin/apachectl restart: httpd restarted

# ps axu | grep httpd
www 25207 0.0 0.9 1536 2412 ?? Ss Thu10PM 0:07.98 httpd: parent
www 28902 0.0 0.7 1544 1904 ?? I Thu10PM 0:00.08 httpd: child
www 30060 0.0 0.7 1544 1868 ?? I Thu10PM 0:00.09 httpd: child
www 27591 0.0 0.7 1544 1908 ?? I Thu10PM 0:00.12 httpd: child
www 14283 0.0 0.7 1544 1920 ?? I Thu10PM 0:00.11 httpd: child
www 12608 0.0 0.7 1544 1936 ?? I Thu10PM 0:00.10 httpd: child
www 28818 0.0 0.7 1544 1872 ?? I Thu10PM 0:00.10 httpd: child
www 25051 0.0 0.7 1536 1928 ?? I Thu10PM 0:00.10 httpd: child
www 3824 0.0 0.7 1544 1876 ?? I Fri12AM 0:00.06 httpd: child
www 3047 0.0 0.7 1544 1908 ?? I Fri12AM 0:00.08 httpd: child
www 27223 0.0 0.7 1544 1932 ?? I Fri12AM 0:00.07 httpd: child


3. FreeBSD
fbdpc# uname -a
FreeBSD fbdpc.binsar.com 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Thu Jan 15 16:15:25 WIT 2009 root@fbdpc.binsar.com:/usr/src/sys/i386/compile/FERRYBSD i386

fbdpc# httpd -v
Server version: Apache/2.2.9 (FreeBSD)
Server built: Jan 9 2009 16:10:00

fbdpc# ps ax | grep httpd | grep -v grep
13007 ?? Ss 0:04.31 /usr/local/sbin/httpd -k start
13073 ?? I 0:02.68 /usr/local/sbin/httpd -k start
13074 ?? I 0:02.59 /usr/local/sbin/httpd -k start
13075 ?? I 0:02.45 /usr/local/sbin/httpd -k start
13077 ?? I 0:02.52 /usr/local/sbin/httpd -k start
13078 ?? I 0:02.54 /usr/local/sbin/httpd -k start
13098 ?? I 0:02.03 /usr/local/sbin/httpd -k start
32289 ?? I 0:01.79 /usr/local/sbin/httpd -k start
32290 ?? I 0:01.75 /usr/local/sbin/httpd -k start
32291 ?? I 0:01.66 /usr/local/sbin/httpd -k start
32599 ?? I 0:01.29 /usr/local/sbin/httpd -k start