code:
# Global Postfix configuration file. This file lists only a subset
# of all 300+ parameters. See the postconf(5) manual page for a
# complete list.
#
# The general format of each line is: parameter = value. Lines
# that begin with whitespace continue the previous line. A value can
# contain references to other $names or ${name}s.
#
# NOTE - CHANGE NO MORE THAN 2-3 PARAMETERS AT A TIME, AND TEST IF
# POSTFIX STILL WORKS AFTER EVERY CHANGE.

# SOFT BOUNCE
#
# The soft_bounce parameter provides a limited safety net for
# testing.  When soft_bounce is enabled, mail will remain queued that
# would otherwise bounce. This parameter disables locally-generated
# bounces, and prevents the SMTP server from rejecting mail permanently
# (by changing 5xx replies into 4xx replies). However, soft_bounce
# is no cure for address rewriting mistakes or mail routing mistakes.
#
#soft_bounce = no

# LOCAL PATHNAME INFORMATION
#
# The queue_directory specifies the location of the Postfix queue.
# This is also the root directory of Postfix daemons that run chrooted.
# See the files in examples/chroot-setup for setting up Postfix chroot
# environments on different UNIX systems.
#
queue_directory = /var/spool/postfix

# The command_directory parameter specifies the location of all
# postXXX commands.
#
command_directory = /usr/sbin

# The daemon_directory parameter specifies the location of all Postfix
# daemon programs (i.e. programs listed in the master.cf file). This
# directory must be owned by root.
#
daemon_directory = /usr/lib/postfix

# QUEUE AND PROCESS OWNERSHIP
#
# The mail_owner parameter specifies the owner of the Postfix queue
# and of most Postfix daemon processes.  Specify the name of a user
# account THAT DOES NOT SHARE ITS USER OR GROUP ID WITH OTHER ACCOUNTS
# AND THAT OWNS NO OTHER FILES OR PROCESSES ON THE SYSTEM.  In
# particular, don't specify nobody or daemon. PLEASE USE A DEDICATED
# USER.
#
mail_owner = postfix

# The default_privs parameter specifies the default rights used by
# the local delivery agent for delivery to external file or command.
# These rights are used in the absence of a recipient user context.
# DO NOT SPECIFY A PRIVILEGED USER OR THE POSTFIX OWNER.
#
#default_privs = nobody

# INTERNET HOST AND DOMAIN NAMES
#
# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
myhostname = localhost

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
mydomain = localdomain

# SENDING MAIL
#
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites.  If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
#myorigin = $myhostname
#myorigin = $mydomain

# RECEIVING MAIL

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on.  By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
# See also the proxy_interfaces parameter, for network addresses that
# are forwarded to us via a proxy or network address translator.
#
# Note: you need to stop/start Postfix when this parameter changes.
#
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost

# The proxy_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on by way of a
# proxy or network address translation unit. This setting extends
# the address list specified with the inet_interfaces parameter.
#
# You must specify your proxy/NAT addresses when your system is a
# backup MX host for other domains, otherwise mail delivery loops
# will happen when the primary MX host is down.
#
#proxy_interfaces =
#proxy_interfaces = 1.2.3.4

# The mydestination parameter specifies the list of domains that this
# machine considers itself the final destination for.
#
# These domains are routed to the delivery agent specified with the
# local_transport parameter setting. By default, that is the UNIX
# compatible delivery agent that lookups all recipients in /etc/passwd
# and /etc/aliases or their equivalent.
#
# The default is $myhostname + localhost.$mydomain.  On a mail domain
# gateway, you should also include $mydomain.
#
# Do not specify the names of virtual domains - those domains are
# specified elsewhere (see VIRTUAL_README).
#
# Do not specify the names of domains that this machine is backup MX
# host for. Specify those names via the relay_domains settings for
# the SMTP server, or use permit_mx_backup if you are lazy (see
# STANDARD_CONFIGURATION_README).
#
# The local machine is always the final destination for mail addressed
# to user@[the.net.work.address] of an interface that the mail system
# receives mail on (see the inet_interfaces parameter).
#
# Specify a list of host or domain names, /file/name or type:table
# patterns, separated by commas and/or whitespace. A /file/name
# pattern is replaced by its contents; a type:table is matched when
# a name matches a lookup key (the right-hand side is ignored).
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
mydestination = $myhostname, localhost.$mydomain, localhost
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
#	mail.$mydomain, www.$mydomain, ftp.$mydomain

# REJECTING MAIL FOR UNKNOWN LOCAL USERS
#
# The local_recipient_maps parameter specifies optional lookup tables
# with all names or addresses of users that are local with respect
# to $mydestination, $inet_interfaces or $proxy_interfaces.
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown local users. This parameter is defined by default.
#
# To turn off local recipient checking in the SMTP server, specify
# local_recipient_maps = (i.e. empty).
#
# The default setting assumes that you use the default Postfix local
# delivery agent for local delivery. You need to update the
# local_recipient_maps setting if:
#
# - You define $mydestination domain recipients in files other than
#   /etc/passwd, /etc/aliases, or the $virtual_alias_maps files.
#   For example, you define $mydestination domain recipients in
#   the $virtual_mailbox_maps files.
#
# - You redefine the local delivery agent in master.cf.
#
# - You redefine the "local_transport" setting in main.cf.
#
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
#   feature of the Postfix local delivery agent (see local(8)).
#
# Details are described in the LOCAL_RECIPIENT_README file.
#
# Beware: if the Postfix SMTP server runs chrooted, you probably have
# to access the passwd file via the proxymap service, in order to
# overcome chroot restrictions. The alternative, having a copy of
# the system passwd file in the chroot jail is just not practical.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify a bare username, an @domain.tld
# wild-card, or specify a user@domain.tld address.
#
#local_recipient_maps = unix:passwd.byname $alias_maps
#local_recipient_maps = proxy:unix:passwd.byname $alias_maps
#local_recipient_maps =

# The unknown_local_recipient_reject_code specifies the SMTP server
# response code when a recipient domain matches $mydestination or
# ${proxy,inet}_interfaces, while $local_recipient_maps is non-empty
# and the recipient address or address local-part is not found.
#
# The default setting is 550 (reject mail) but it is safer to start
# with 450 (try again later) until you are certain that your
# local_recipient_maps settings are OK.
#
unknown_local_recipient_reject_code = 550

# TRUST AND RELAY CONTROL

# The mynetworks parameter specifies the list of "trusted" SMTP
# clients that have more privileges than "strangers".
#
# In particular, "trusted" SMTP clients are allowed to relay mail
# through Postfix.  See the smtpd_recipient_restrictions parameter
# in postconf(5).
#
# You can specify the list of "trusted" network addresses by hand
# or you can let Postfix do it for you (which is the default).
#
# By default (mynetworks_style = subnet), Postfix "trusts" SMTP
# clients in the same IP subnetworks as the local machine.
# On Linux, this does works correctly only with interfaces specified
# with the "ifconfig" command.
#
# Specify "mynetworks_style = class" when Postfix should "trust" SMTP
# clients in the same IP class A/B/C networks as the local machine.
# Don't do this with a dialup site - it would cause Postfix to "trust"
# your entire provider's network.  Instead, specify an explicit
# mynetworks list by hand, as described below.
#
# Specify "mynetworks_style = host" when Postfix should "trust"
# only the local machine.
#
#mynetworks_style = class
#mynetworks_style = subnet
#mynetworks_style = host

# Alternatively, you can specify the mynetworks list by hand, in
# which case Postfix ignores the mynetworks_style setting.
#
# Specify an explicit list of network/netmask patterns, where the
# mask specifies the number of bits in the network part of a host
# address.
#
# You can also specify the absolute pathname of a pattern file instead
# of listing the patterns here. Specify type:table for table-based lookups
# (the value on the table right-hand side is not used).
#
mynetworks = 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table

# The relay_domains parameter restricts what destinations this system will
# relay mail to.  See the smtpd_recipient_restrictions description in
# postconf(5) for detailed information.
#
# By default, Postfix relays mail
# - from "trusted" clients (IP address matches $mynetworks) to any destination,
# - from "untrusted" clients to destinations that match $relay_domains or
#   subdomains thereof, except addresses with sender-specified routing.
# The default relay_domains value is $mydestination.
#
# In addition to the above, the Postfix SMTP server by default accepts mail
# that Postfix is final destination for:
# - destinations that match $inet_interfaces or $proxy_interfaces,
# - destinations that match $mydestination
# - destinations that match $virtual_alias_domains,
# - destinations that match $virtual_mailbox_domains.
# These destinations do not need to be listed in $relay_domains.
#
# Specify a list of hosts or domains, /file/name patterns or type:name
# lookup tables, separated by commas and/or whitespace.  Continue
# long lines by starting the next line with whitespace. A file name
# is replaced by its contents; a type:name table is matched when a
# (parent) domain appears as lookup key.
#
# NOTE: Postfix will not automatically forward mail for domains that
# list this system as their primary or backup MX host. See the
# permit_mx_backup restriction description in postconf(5).
#
relay_domains = $mydestination

# INTERNET OR INTRANET

# The relayhost parameter specifies the default host to send mail to
# when no entry is matched in the optional transport(5) table. When
# no relayhost is given, mail is routed directly to the destination.
#
# On an intranet, specify the organizational domain name. If your
# internal DNS uses no MX records, specify the name of the intranet
# gateway host instead.
#
# In the case of SMTP, specify a domain, host, host:port, [host]:port,
# [address] or [address]:port; the form [host] turns off MX lookups.
#
# If you're connected via UUCP, see also the default_transport parameter.
#
#relayhost = $mydomain
#relayhost = [gateway.my.domain]
#relayhost = [mailserver.isp.tld]
#relayhost = uucphost
#relayhost = [an.ip.add.ress]

# REJECTING UNKNOWN RELAY USERS
#
# The relay_recipient_maps parameter specifies optional lookup tables
# with all addresses in the domains that match $relay_domains.
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown relay users. This feature is off by default.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify an @domain.tld wild-card, or specify
# a user@domain.tld address.
#
#relay_recipient_maps = hash:/etc/postfix/relay_recipients

# INPUT RATE CONTROL
#
# The in_flow_delay configuration parameter implements mail input
# flow control. This feature is turned on by default, although it
# still needs further development (it's disabled on SCO UNIX due
# to an SCO bug).
#
# A Postfix process will pause for $in_flow_delay seconds before
# accepting a new message, when the message arrival rate exceeds the
# message delivery rate. With the default 100 SMTP server process
# limit, this limits the mail inflow to 100 messages a second more
# than the number of messages delivered per second.
#
# Specify 0 to disable the feature. Valid delays are 0..10.
#
#in_flow_delay = 1s

# ADDRESS REWRITING
#
# The ADDRESS_REWRITING_README document gives information about
# address masquerading or other forms of address rewriting including
# username->Firstname.Lastname mapping.

# ADDRESS REDIRECTION (VIRTUAL DOMAIN)
#
# The VIRTUAL_README document gives information about the many forms
# of domain hosting that Postfix supports.

# "USER HAS MOVED" BOUNCE MESSAGES
#
# See the discussion in the ADDRESS_REWRITING_README document.

# TRANSPORT MAP
#
# See the discussion in the ADDRESS_REWRITING_README document.

# ALIAS DATABASE
#
# The alias_maps parameter specifies the list of alias databases used
# by the local delivery agent. The default list is system dependent.
#
# On systems with NIS, the default is to search the local alias
# database, then the NIS alias database. See aliases(5) for syntax
# details.
#
# If you change the alias database, run "postalias /etc/aliases" (or
# wherever your system stores the mail alias file), or simply run
# "newaliases" to build the necessary DBM or DB file.
#
# It will take a minute or so before changes become visible.  Use
# "postfix reload" to eliminate the delay.
#
#alias_maps = dbm:/etc/aliases
alias_maps = hash:/etc/mail/aliases
#alias_maps = hash:/etc/aliases, nis:mail.aliases
#alias_maps = netinfo:/aliases

# The alias_database parameter specifies the alias database(s) that
# are built with "newaliases" or "sendmail -bi".  This is a separate
# configuration parameter, because alias_maps (see above) may specify
# tables that are not necessarily all under control by Postfix.
#
#alias_database = dbm:/etc/aliases
#alias_database = dbm:/etc/mail/aliases
alias_database = hash:/etc/mail/aliases
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases

# ADDRESS EXTENSIONS (e.g., user+foo)
#
# The recipient_delimiter parameter specifies the separator between
# user names and address extensions (user+foo). See canonical(5),
# local(8), relocated(5) and virtual(5) for the effects this has on
# aliases, canonical, virtual, relocated and .forward file lookups.
# Basically, the software tries user+foo and .forward+foo before
# trying user and .forward.
#
#recipient_delimiter = +

# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user's home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user.  Specify
# "Maildir/" for qmail-style delivery (the / is required).
#
#home_mailbox = Mailbox
home_mailbox = Maildir/

# The mail_spool_directory parameter specifies the directory where
# UNIX-style mailboxes are kept. The default setting depends on the
# system type.
#
#mail_spool_directory = /var/mail
#mail_spool_directory = /var/spool/mail

# The mailbox_command parameter specifies the optional external
# command to use instead of mailbox delivery. The command is run as
# the recipient with proper HOME, SHELL and LOGNAME environment settings.
# Exception:  delivery for root is done as $default_user.
#
# Other environment variables of interest: USER (recipient username),
# EXTENSION (address extension), DOMAIN (domain part of address),
# and LOCAL (the address localpart).
#
# Unlike other Postfix configuration parameters, the mailbox_command
# parameter is not subjected to $parameter substitutions. This is to
# make it easier to specify shell syntax (see example below).
#
# Avoid shell meta characters because they will force Postfix to run
# an expensive shell process. Procmail alone is expensive enough.
#
# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#

#If Using Dovecot for delivery:
#mailbox_command = /usr/libexec/dovecot/deliver

#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a "$EXTENSION"

# The mailbox_transport specifies the optional transport in master.cf
# to use after processing aliases and .forward files. This parameter
# has precedence over the mailbox_command, fallback_transport and
# luser_relay parameters.
#
# Specify a string of the form transport:nexthop, where transport is
# the name of a mail delivery transport defined in master.cf.  The
# :nexthop part is optional. For more details see the sample transport
# configuration file.
#
# NOTE: if you use this feature for accounts not in the UNIX password
# file, then you must update the "local_recipient_maps" setting in
# the main.cf file, otherwise the SMTP server will reject mail for
# non-UNIX accounts with "User unknown in local recipient table".
#
#mailbox_transport = lmtp:unix:/file/name
#mailbox_transport = cyrus

# The fallback_transport specifies the optional transport in master.cf
# to use for recipients that are not found in the UNIX passwd database.
# This parameter has precedence over the luser_relay parameter.
#
# Specify a string of the form transport:nexthop, where transport is
# the name of a mail delivery transport defined in master.cf.  The
# :nexthop part is optional. For more details see the sample transport
# configuration file.
#
# NOTE: if you use this feature for accounts not in the UNIX password
# file, then you must update the "local_recipient_maps" setting in
# the main.cf file, otherwise the SMTP server will reject mail for
# non-UNIX accounts with "User unknown in local recipient table".
#
#fallback_transport = lmtp:unix:/file/name
#fallback_transport = cyrus
#fallback_transport =

# The luser_relay parameter specifies an optional destination address
# for unknown recipients.  By default, mail for unknown@$mydestination,
# unknown@[$inet_interfaces] or unknown@[$proxy_interfaces] is returned
# as undeliverable.
#
# The following expansions are done on luser_relay: $user (recipient
# username), $shell (recipient shell), $home (recipient home directory),
# $recipient (full recipient address), $extension (recipient address
# extension), $domain (recipient domain), $local (entire recipient
# localpart), $recipient_delimiter. Specify ${name?value} or
# ${name:value} to expand value only when $name does (does not) exist.
#
# luser_relay works only for the default Postfix local delivery agent.
#
# NOTE: if you use this feature for accounts not in the UNIX password
# file, then you must specify "local_recipient_maps =" (i.e. empty) in
# the main.cf file, otherwise the SMTP server will reject mail for
# non-UNIX accounts with "User unknown in local recipient table".
#
#luser_relay = $user@other.host
#luser_relay = $local@other.host
#luser_relay = admin+$local

# JUNK MAIL CONTROLS
#
# The controls listed here are only a very small subset. The file
# SMTPD_ACCESS_README provides an overview.

# The header_checks parameter specifies an optional table with patterns
# that each logical message header is matched against, including
# headers that span multiple physical lines.
#
# By default, these patterns also apply to MIME headers and to the
# headers of attached messages. With older Postfix versions, MIME and
# attached message headers were treated as body text.
#
# For details, see "man header_checks".
#
#header_checks = regexp:/etc/postfix/header_checks

# FAST ETRN SERVICE
#
# Postfix maintains per-destination logfiles with information about
# deferred mail, so that mail can be flushed quickly with the SMTP
# "ETRN domain.tld" command, or by executing "sendmail -qRdomain.tld".
# See the ETRN_README document for a detailed description.
#
# The fast_flush_domains parameter controls what destinations are
# eligible for this service. By default, they are all domains that
# this server is willing to relay mail to.
#
#fast_flush_domains = $relay_domains

# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# code in the SMTP server's greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
#
# You MUST specify $myhostname at the start of the text. That is an
# RFC requirement. Postfix itself does not care.
#
smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)

#SSL/TLS Options (You can use mkselfsigncert.sh script in /etc/postfix/ssl)
#smtpd_use_tls = yes
#smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
#smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.cert
#smtpd_tls_CAfile = /etc/postfix/ssl/smtpd.pem

# Enabling SASL authentication in the Postfix SMTP server
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated
                               permit_mynetworks
                               reject_unauth_destination
                               reject_rbl_client sbl.spamhaus.org
                               reject_rbl_client opm.blitzed.org
                               reject_rbl_client dnsbl.njabl.org
                               reject_rbl_client blackholes.wirehub.net

# PARALLEL DELIVERY TO THE SAME DESTINATION
#
# How many parallel deliveries to the same user or domain? With local
# delivery, it does not make sense to do massively parallel delivery
# to the same user, because mailbox updates must happen sequentially,
# and expensive pipelines in .forward files can cause disasters when
# too many are run at the same time. With SMTP deliveries, 10
# simultaneous connections to the same domain could be sufficient to
# raise eyebrows.
#
# Each message delivery transport has its XXX_destination_concurrency_limit
# parameter.  The default is $default_destination_concurrency_limit for
# most delivery transports. For the local delivery agent the default is 2.

#local_destination_concurrency_limit = 2
#default_destination_concurrency_limit = 20

# DEBUGGING CONTROL
#
# The debug_peer_level parameter specifies the increment in verbose
# logging level when an SMTP client or server host name or address
# matches a pattern in the debug_peer_list parameter.
#
debug_peer_level = 2

# The debug_peer_list parameter specifies an optional list of domain
# or network patterns, /file/name patterns or type:name tables. When
# an SMTP client or server host name or address matches a pattern,
# increase the verbose logging level by the amount specified in the
# debug_peer_level parameter.
#
#debug_peer_list = 127.0.0.1
#debug_peer_list = some.domain

# The debugger_command specifies the external command that is executed
# when a Postfix daemon program is run with the -D option.
#
# Use "command .. & sleep 5" so that the debugger can attach before
# the process marches on. If you use an X-based debugger, be sure to
# set up your XAUTHORITY environment variable before starting Postfix.
#
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 xxgdb $daemon_directory/$process_name $process_id & sleep 5

# If you can't use X, use this to capture the call stack when a
# daemon crashes. The result is in a file in the configuration
# directory, and is named after the process name and the process ID.
#
# debugger_command =
#	PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont;
#	echo where) | gdb $daemon_directory/$process_name $process_id 2>&1
#	>$config_directory/$process_name.$process_id.log & sleep 5
#
# Another possibility is to run gdb under a detached screen session.
# To attach to the screen sesssion, su root and run "screen -r
# <id_string>" where <id_string> uniquely matches one of the detached
# sessions (from "screen -list").
#
# debugger_command =
#	PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; screen
#	-dmS $process_name gdb $daemon_directory/$process_name
#	$process_id & sleep 1

# INSTALL-TIME CONFIGURATION INFORMATION
#
# The following parameters are used when installing a new Postfix version.
#
# sendmail_path: The full pathname of the Postfix sendmail command.
# This is the Sendmail-compatible mail posting interface.
#
sendmail_path = /usr/sbin/sendmail

# newaliases_path: The full pathname of the Postfix newaliases command.
# This is the Sendmail-compatible command to build alias databases.
#
newaliases_path = /usr/bin/newaliases

# mailq_path: The full pathname of the Postfix mailq command.  This
# is the Sendmail-compatible mail queue listing command.
#
mailq_path = /usr/bin/mailq

# setgid_group: The group for mail submission and queue management
# commands.  This must be a group name with a numerical group ID that
# is not shared with other accounts, not even with the Postfix account.
#
setgid_group = postdrop

# html_directory: The location of the Postfix HTML documentation.
#

html_directory = /usr/share/doc/postfix/html

# manpage_directory: The location of the Postfix on-line manual pages.
#
manpage_directory = /usr/share/man

# sample_directory: The location of the Postfix sample configuration files.
# This parameter is obsolete as of Postfix 2.1.
#
sample_directory = /etc/postfix

# readme_directory: The location of the Postfix README files.
#
readme_directory = /usr/share/doc/postfix/readme


code:
#!/bin/sh

# Accept one parameter as output file names
# Generates a self-signed certificate.
# Edit EOF section before running

if [ $# -ne 1 ]
then
    echo -e "\nUse with a single name paramater for output files will be generated into current folder.\nAnd don't forget to edit [ req_dn ] section in script.\n"
    echo -e "Example:\n\n./mkcert.sh foo\n\n"
    exit 1
fi

OPENSSL=openssl
DIR=`pwd`
CONFIG=$1-ssl.config

CERTDIR=$SSLDIR
KEYDIR=$SSLDIR

CERTFILE=$DIR/$1.cert
KEYFILE=$DIR/$1.key
REQFILE=$DIR/$1.req

KEYBITS=1024
DAYS=3650

if [ ! -f $CONFIG ]; then
  cat > $CONFIG << EOF
[ req ]
default_bits = 1024
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
prompt = no

[ req_dn ]
# country (2 letter code)
C=XY

# State or Province Name (full name)
ST=SomeState

# Locality Name (eg. city)
L=SomeCity

# Organization (eg. company)
O=SomeCompany

# Organizational Unit Name (eg. section)
OU=PisiLinux

# Common Name (*.example.com is also possible)
CN=mail.example.com

# E-mail contact
#emailAddress=admin@example.com

[ cert_type ]
nsCertType = server
EOF
fi

if [ -f $CERTFILE ]; then
  echo "$CERTFILE already exists, won't overwrite"
  exit 1
fi

if [ -f $KEYFILE ]; then
  echo "$KEYFILE already exists, won't overwrite"
  exit 1
fi

#Generate key. Use -des3 for password protected key.
$OPENSSL genrsa -out $KEYFILE $KEYBITS
chmod 0600 $KEYFILE

#Unmask password protected key
#mv $KEYFILE $KEYFILE.orig
#$OPENSSL rsa -in $KEYFILE.orig -out $KEYFILE

#Generate request file
$OPENSSL req -new -key $KEYFILE -out $REQFILE -config $CONFIG

#Generate self signed certificate
$OPENSSL x509 -req -days $DAYS -in $REQFILE  -signkey $KEYFILE -out $CERTFILE

#Verify
$OPENSSL x509 -subject -fingerprint -noout -in $CERTFILE || exit 2

repo_name: ayhanyalcinsoy/main


code:
Changing the postfix-files config file won't work right on upgrades because
it's a noreplace configuration (the new version with the right paths in it is
installed as postfix-files.rpmnew), so we just munge the post-install script.
--- postfix-1.1.3/conf/post-install	Thu Feb 28 16:15:08 2002
+++ postfix-1.1.3/conf/post-install	Thu Feb 28 16:14:54 2002
@@ -429,6 +429,16 @@
 	case $path in
 	no|no/*) continue;;
 	esac
+	# Munge paths for alternatives.
+	case $path in
+		/usr/bin/mailq) path=$path.postfix ;;
+		/usr/bin/newaliases) path=$path.postfix ;;
+		/usr/bin/rmail) path=$path.postfix ;;
+		/usr/sbin/sendmail) path=$path.postfix ;;
+		/usr/share/man/man1/mailq.1.gz) path=/usr/share/man/man1/mailq.postfix.1.gz ;;
+		/usr/share/man/man1/newaliases.1.gz) path=/usr/share/man/man1/newaliases.postfix.1.gz ;;
+		/usr/share/man/man5/aliases.5.gz) path=/usr/share/man/man5/aliases.postfix.5.gz ;;
+	esac
 	# Pick up the flags.
 	case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac
 	case $flags in *c*) create_flag=1;; *) create_flag=;; esac


code:
diff -up postfix-2.5.5/src/util/sys_defs.h.large-fs postfix-2.5.5/src/util/sys_defs.h
--- postfix-2.5.5/src/util/sys_defs.h.large-fs	2008-01-15 01:51:44.000000000 +0100
+++ postfix-2.5.5/src/util/sys_defs.h	2008-10-21 17:55:29.000000000 +0200
@@ -709,8 +709,8 @@ extern int initgroups(const char *, int)
 #define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
 #define FIONREAD_IN_TERMIOS_H
-#define USE_STATFS
-#define STATFS_IN_SYS_VFS_H
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
 #define PREPEND_PLUS_TO_OPTSTRING
 #define HAS_POSIX_REGEXP
 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
diff -up postfix-2.5.5/src/util/fsspace.c.large-fs postfix-2.5.5/src/util/fsspace.c
--- postfix-2.5.5/src/util/fsspace.c.large-fs	2006-06-15 20:07:16.000000000 +0200
+++ postfix-2.5.5/src/util/fsspace.c	2008-10-21 17:56:29.000000000 +0200
@@ -91,8 +91,15 @@ void    fsspace(const char *path, struct

     if (statvfs(path, &fsbuf) < 0)
 	msg_fatal("statvfs %s: %m", path);
-    sp->block_size = fsbuf.f_frsize;
-    sp->block_free = fsbuf.f_bavail;
+    if (fsbuf.f_frsize > 0)
+	sp->block_size = fsbuf.f_frsize;
+    else
+	sp->block_size = fsbuf.f_bsize;
+    /* 4G of FS blocks is surely enough space to put a mail in */
+    sp->block_free = 0;
+    sp->block_free = ~sp->block_free;
+    if (fsbuf.f_bavail < sp->block_free)
+	sp->block_free = fsbuf.f_bavail;
 #endif
     if (msg_verbose)
 	msg_info("%s: %s: block size %lu, blocks free %lu",


code: # remotehost user:password

path: server/postfix/files/saslpass


code:
#%PAM-1.0

auth     include system-auth
account  include system-auth


code:
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>postfix</Name>
        <Homepage>http://www.postfix.com/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>IPL-1</License>
        <IsA>service</IsA>
        A fast and secure drop-in replacement for sendmail
        <Description>Postfix is Wietse Venema's mailer that started life as an alternative to the widely-used Sendmail program.</Description>
        <Archive sha1sum="ce95aa5288735970abf806b719a09d517294e071" type="targz">http://de.postfix.org/ftpmirror/official/postfix-3.2.0.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>db-devel</Dependency>
            <Dependency>libpcre-devel</Dependency>
            <Dependency>openssl-devel</Dependency>
            <Dependency>mariadb-lib</Dependency>
            <Dependency>cyrus-sasl-devel</Dependency>
            <Dependency>openldap-client</Dependency>
            <Dependency>postgresql-lib</Dependency>
            <Dependency>mit-kerberos</Dependency>
        </BuildDependencies>
        <Patches>

            <Patch level="1">postfix-large-fs.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>postfix</Name>
        <RuntimeDependencies>
            <Dependency>db</Dependency>
            <Dependency>pam</Dependency>
            <Dependency>zlib</Dependency>
            <Dependency>libpcre</Dependency>
            <Dependency>openssl</Dependency>
            <Dependency>mariadb-lib</Dependency>
            <Dependency>cyrus-sasl</Dependency>
            <Dependency>bind-libs</Dependency>
            <Dependency>openldap-client</Dependency>
            <Dependency>postgresql-lib</Dependency>
            <Dependency>mit-kerberos</Dependency>
            <Dependency>comar-api</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="data">/var</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="doc">/usr/share/doc/postfix/AAAREADME</Path>
            <Path fileType="doc">/usr/share/doc/postfix/COMPATIBILITY</Path>
            <Path fileType="doc">/usr/share/doc/postfix/HISTORY</Path>
            <Path fileType="doc">/usr/share/doc/postfix/LICENSE</Path>
            <Path fileType="doc">/usr/share/doc/postfix/RELEASE_NOTES</Path>
            <Path fileType="doc">/usr/share/doc/postfix/defaults</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/etc/sasl2/smtpd.conf">smtpd.conf</AdditionalFile>
            <AdditionalFile owner="root" permission="0600" target="/etc/postfix/saslpass">saslpass</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/postfix/main.cf">main.cf</AdditionalFile>
            <AdditionalFile owner="root" permission="0755" target="/etc/postfix/ssl/mkcert.sh">mkcert.sh</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/mail/aliases">aliases</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/mail/mailcap">mailcap</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/pam.d/smtp">smtp.pam</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/pam.d/pop">common.pam</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/pam.d/imap">common.pam</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/doc/postfix/defaults/bounce.cf.tr">bounce.cf.tr</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="package.py">System.Package</COMAR>
            <COMAR script="service.py">System.Service</COMAR>
        </Provides>
    </Package>

    <Package>
        <Name>postfix-docs</Name>
        Help files for postfix package
        <RuntimeDependencies>
            <Dependency release="current">postfix</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="doc">/usr/share/doc</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-04-11</Date>
            <Version>3.2.0</Version>
            <Comment>Rebuild with new toolchain</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-08</Date>
            <Version>3.1.0</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-02-27</Date>
            <Version>3.1.0</Version>
            <Comment>First release</Comment>
            <Name>Kamil Atlı</Name>
            <Email>suvari@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>postfix</Name>
        Hızlı ve güvenli bir e-posta sunucusu
        <Description xml:lang="tr">Postfix, Wietse Venema tarafından yazılmış, sendmail a alternatif güçlü bir e-posta sunucusudur.</Description>
    </Source>

    <Package>
        <Name>postfix-docs</Name>
        Postfix paketine ait yardım dosyaları
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools

shelltools.export("JOBS", get.makeJOBS().replace("-j", ""))

MODULES = "idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2,\
pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4,\
auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4"

def setup():
    pisitools.flags.add("-D_FILE_OFFSET_BITS=64", "-D_GNU_SOURCE", "-DLDAP_DEPRECATED", "-fPIC")

    autotools.configure("\
                         --libdir=/usr/lib \
                         --with-cachedir=/var/lib/samba \
                         --with-configdir=/etc/samba \
                         --with-lockdir=/var/cache/samba \
                         --with-logfilebase=/var/log/samba \
                         --with-modulesdir=/usr/lib/samba \
                         --with-pammodulesdir=/lib/security \
                         --with-piddir=/run/samba \
                         --with-privatedir=/var/lib/samba/private \
                         --with-sockets-dir=/run/samba \
                         --disable-rpath \
                         --disable-rpath-install \
                         --enable-fhs \
                         --enable-gnutls \
                         --nopyc \
                         --nopyo \
                         --with-acl-support \
                         --with-ads \
                         --with-automount \
                         --with-cluster-support \
                         --with-dnsupdate \
                         --with-pam \
                         --with-quotas \
                         --with-sendfile-support \
                         --with-shared-modules=%s \
                         --with-syslog \
                         --with-utmp \
                         --with-winbind \
                         --bundled-libraries=!tdb,!talloc,!pytalloc-util,!tevent,!popt \
                        " % MODULES)
    # !ldb,!pyldb-util

def build():
    shelltools.system("make")

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())
    pisitools.dosym("samba-4.0/libsmbclient.h", "/usr/include/libsmbclient.h")

    # remove unneeded files
    pisitools.removeDir("/usr/share/ctdb")


code:
#/usr/bin/python

import os

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    if not os.path.exists("/home/samba"):
        os.system("/bin/mkdir /home/samba")
        os.system("/bin/chmod 0777 /home/samba")

    # needed by non-root sharing support.
    os.system("/bin/mkdir /var/lib/samba/usershares")
    os.system("/bin/chgrp users /var/lib/samba/usershares")
    os.system("/bin/chmod 1777 /var/lib/samba/usershares")

    os.system("/bin/chmod 0750 /var/lib/samba/winbindd_privileged")


code:
from comar.service import *
import os

serviceType = "server"
serviceDesc = _({"en": "SMB Network Sharing",
                 "tr": "SMB Ağ Paylaşımı"})

WINBINDD_PIDFILE = "/run/samba/winbindd.pid"
NMBD_PIDFILE = "/run/samba/nmbd.pid"
SMBD_PIDFILE = "/run/samba/smbd.pid"

@synchronized
def start():
    startService(command="/usr/sbin/smbd",
                 args="-D",
                 donotify=True)

    startService(command="/usr/sbin/nmbd",
                 args="-D")

    if config.get("winbind", "no") == "yes":
        startService(command="/usr/sbin/winbindd",
                     args="-D")

@synchronized
def stop():
    stopService(pidfile=WINBINDD_PIDFILE,
                donotify=True)
    stopService(pidfile=NMBD_PIDFILE,
                donotify=True)
    stopService(pidfile=SMBD_PIDFILE,
                donotify=True)

def reload():
    if os.path.exists(WINBINDD_PIDFILE):
        os.kill(int(file(WINBINDD_PIDFILE).read().strip()), signal.SIGHUP)

    if os.path.exists(NMBD_PIDFILE):
        os.kill(int(file(NMBD_PIDFILE).read().strip()), signal.SIGHUP)

    if os.path.exists(SMBD_PIDFILE):
        os.kill(int(file(SMBD_PIDFILE).read().strip()), signal.SIGHUP)

def status():
    result = isServiceRunning(SMBD_PIDFILE) and isServiceRunning(NMBD_PIDFILE)
    if config.get("winbind", "no") == "yes":
        result = result and isServiceRunning(WINBINDD_PIDFILE)
    return result


code:
#
# pam_winbind configuration file
#
# /etc/security/pam_winbind.conf
#

[global]

# turn on debugging
;debug = no

# turn on extended PAM state debugging
;debug_state = no

# request a cached login if possible
# (needs "winbind offline logon = yes" in smb.conf)
;cached_login = no

# authenticate using kerberos
;krb5_auth = no

# when using kerberos, request a "FILE" krb5 credential cache type
# (leave empty to just do krb5 authentication but not have a ticket
# afterwards)
;krb5_ccache_type =

# make successful authentication dependend on membership of one SID
# (can also take a name)
;require_membership_of =

# password expiry warning period in days
;warn_pwd_expire = 14

# omit pam conversations
;silent = no

# create homedirectory on the fly
;mkhomedir = no


code:
/var/log/samba/* {
    notifempty
    olddir /var/log/samba/old
    missingok
    sharedscripts
    copytruncate
}


code:
#%PAM-1.0
auth       required	pam_nologin.so
auth       include	password-auth
account    include	password-auth
session    include	password-auth
password   include	password-auth


code:
# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
#	       to configure your Samba server. To use SWAT, \
#	       connect to port 901 with your favorite web browser.
service swat
{
	port		= 901
	socket_type	= stream
	wait 		= no
	only_from 	= 127.0.0.1
	user		= root
	server		= /usr/sbin/swat
	log_on_failure	+= USERID
	disable		= yes
}


code:
# This is the main Samba configuration file. For detailed information about the
# options listed here, refer to the smb.conf(5) manual page. Samba has a huge
# number of configurable options, most of which are not shown in this example.
#
# The Official Samba 3.2.x HOWTO and Reference Guide contains step-by-step
# guides for installing, configuring, and using Samba:
# http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# The Samba-3 by Example guide has working examples for smb.conf. This guide is
# generated daily: http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# In this file, lines starting with a semicolon (;) or a hash (#) are
# comments and are ignored. This file uses hashes to denote commentary and
# semicolons for parts of the file you may wish to configure.
#
# Note: Run the "testparm" command after modifying this file to check for basic
# syntax errors.
#
#---------------
# Security-Enhanced Linux (SELinux) Notes:
#
# Turn the samba_domain_controller Boolean on to allow Samba to use the useradd
# and groupadd family of binaries. Run the following command as the root user to
# turn this Boolean on:
# setsebool -P samba_domain_controller on
#
# Turn the samba_enable_home_dirs Boolean on if you want to share home
# directories via Samba. Run the following command as the root user to turn this
# Boolean on:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory, such as a new top-level directory, label it
# with samba_share_t so that SELinux allows Samba to read and write to it. Do
# not label system directories, such as /etc/ and /home/, with samba_share_t, as
# such directories should already have an SELinux label.
#
# Run the "ls -ldZ /path/to/directory" command to view the current SELinux
# label for a given directory.
#
# Set SELinux labels only on files and directories you have created. Use the
# chcon command to temporarily change a label:
# chcon -t samba_share_t /path/to/directory
#
# Changes made via chcon are lost when the file system is relabeled or commands
# such as restorecon are run.
#
# Use the samba_export_all_ro or samba_export_all_rw Boolean to share system
# directories. To share such directories and only allow read-only permissions:
# setsebool -P samba_export_all_ro on
# To share such directories and allow read and write permissions:
# setsebool -P samba_export_all_rw on
#
# To run scripts (preexec/root prexec/print command/...), copy them to the
# /var/lib/samba/scripts/ directory so that SELinux will allow smbd to run them.
# Note that if you move the scripts to /var/lib/samba/scripts/, they retain
# their existing SELinux labels, which may be labels that SELinux does not allow
# smbd to run. Copying the scripts will result in the correct SELinux labels.
# Run the "restorecon -R -v /var/lib/samba/scripts" command as the root user to
# apply the correct SELinux labels to these files.
#
#--------------
#
#======================= Global Settings =====================================

[global]

# ----------------------- Network-Related Options -------------------------
#
# workgroup = the Windows NT domain name or workgroup name, for example, MYGROUP.
#
# server string = the equivalent of the Windows NT Description field.
#
# netbios name = used to specify a server name that is not tied to the hostname.
#
# interfaces = used to configure Samba to listen on multiple network interfaces.
# If you have multiple interfaces, you can use the "interfaces =" option to
# configure which of those interfaces Samba listens on. Never omit the localhost
# interface (lo).
#
# hosts allow = the hosts allowed to connect. This option can also be used on a
# per-share basis.
#
# hosts deny = the hosts not allowed to connect. This option can also be used on
# a per-share basis.
#
# max protocol = used to define the supported protocol. The default is NT1. You
# can set it to SMB2 if you want experimental SMB2 support.
#
	workgroup = MYGROUP
	server string = Samba Server Version %v

;	netbios name = MYSERVER

;	interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
;	hosts allow = 127. 192.168.12. 192.168.13.

;	max protocol = SMB2

# --------------------------- Logging Options -----------------------------
#
# log file = specify where log files are written to and how they are split.
#
# max log size = specify the maximum size log files are allowed to reach. Log
# files are rotated when they reach the size specified with "max log size".
#

	# log files split per-machine:
	log file = /var/log/samba/log.%m
	# maximum size of 50KB per log file, then rotate:
	max log size = 50

# ----------------------- Standalone Server Options ------------------------
#
# security = the mode Samba runs in. This can be set to user, share
# (deprecated), or server (deprecated).
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#

	security = user
	passdb backend = tdbsam

# ----------------------- Domain Members Options ------------------------
#
# security = must be set to domain or ads.
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#
# realm = only use the realm option when the "security = ads" option is set.
# The realm option specifies the Active Directory realm the host is a part of.
#
# password server = only use this option when the "security = server"
# option is set, or if you cannot use DNS to locate a Domain Controller. The
# argument list can include My_PDC_Name, [My_BDC_Name], and [My_Next_BDC_Name]:
#
# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
#
# Use "password server = *" to automatically locate Domain Controllers.

;	security = domain
;	passdb backend = tdbsam
;	realm = MY_REALM

;	password server = <NT-Server-Name>

# ----------------------- Domain Controller Options ------------------------
#
# security = must be set to user for domain controllers.
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#
# domain master = specifies Samba to be the Domain Master Browser, allowing
# Samba to collate browse lists between subnets. Do not use the "domain master"
# option if you already have a Windows NT domain controller performing this task.
#
# domain logons = allows Samba to provide a network logon service for Windows
# workstations.
#
# logon script = specifies a script to run at login time on the client. These
# scripts must be provided in a share named NETLOGON.
#
# logon path = specifies (with a UNC path) where user profiles are stored.
#
#
;	security = user
;	passdb backend = tdbsam

;	domain master = yes
;	domain logons = yes

	# the following login script name is determined by the machine name
	# (%m):
;	logon script = %m.bat
	# the following login script name is determined by the UNIX user used:
;	logon script = %u.bat
;	logon path = \\%L\Profiles\%u
	# use an empty path to disable profile support:
;	logon path =

	# various scripts can be used on a domain controller or a stand-alone
	# machine to add or delete corresponding UNIX accounts:

;	add user script = /usr/sbin/useradd "%u" -n -g users
;	add group script = /usr/sbin/groupadd "%g"
;	add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u"
;	delete user script = /usr/sbin/userdel "%u"
;	delete user from group script = /usr/sbin/userdel "%u" "%g"
;	delete group script = /usr/sbin/groupdel "%g"

# ----------------------- Browser Control Options ----------------------------
#
# local master = when set to no, Samba does not become the master browser on
# your network. When set to yes, normal election rules apply.
#
# os level = determines the precedence the server has in master browser
# elections. The default value should be reasonable.
#
# preferred master = when set to yes, Samba forces a local browser election at
# start up (and gives itself a slightly higher chance of winning the election).
#
;	local master = no
;	os level = 33
;	preferred master = yes

#----------------------------- Name Resolution -------------------------------
#
# This section details the support for the Windows Internet Name Service (WINS).
#
# Note: Samba can be either a WINS server or a WINS client, but not both.
#
# wins support = when set to yes, the NMBD component of Samba enables its WINS
# server.
#
# wins server = tells the NMBD component of Samba to be a WINS client.
#
# wins proxy = when set to yes, Samba answers name resolution queries on behalf
# of a non WINS capable client. For this to work, there must be at least one
# WINS server on the network. The default is no.
#
# dns proxy = when set to yes, Samba attempts to resolve NetBIOS names via DNS
# nslookups.

;	wins support = yes
;	wins server = w.x.y.z
;	wins proxy = yes

;	dns proxy = yes

# --------------------------- Printing Options -----------------------------
#
# The options in this section allow you to configure a non-default printing
# system.
#
# load printers = when set you yes, the list of printers is automatically
# loaded, rather than setting them up individually.
#
# cups options = allows you to pass options to the CUPS library. Setting this
# option to raw, for example, allows you to use drivers on your Windows clients.
#
# printcap name = used to specify an alternative printcap file.
#

	load printers = yes
	cups options = raw

;	printcap name = /etc/printcap
	# obtain a list of printers automatically on UNIX System V systems:
;	printcap name = lpstat
;	printing = cups

# --------------------------- File System Options ---------------------------
#
# The options in this section can be un-commented if the file system supports
# extended attributes, and those attributes are enabled (usually via the
# "user_xattr" mount option). These options allow the administrator to specify
# that DOS attributes are stored in extended attributes and also make sure that
# Samba does not change the permission bits.
#
# Note: These options can be used on a per-share basis. Setting them globally
# (in the [global] section) makes them the default for all shares.

;	map archive = no
;	map hidden = no
;	map read only = no
;	map system = no
;	store dos attributes = yes

#============================ Share Definitions ==============================

[homes]
	comment = Home Directories
	browseable = no
	writable = yes
;	valid users = %S
;	valid users = MYDOMAIN\%S

[printers]
	comment = All Printers
	path = /var/spool/samba
	browseable = no
	guest ok = no
	writable = no
	printable = yes

# Un-comment the following and create the netlogon directory for Domain Logons:
;	[netlogon]
;	comment = Network Logon Service
;	path = /var/lib/samba/netlogon
;	guest ok = yes
;	writable = no
;	share modes = no

# Un-comment the following to provide a specific roving profile share.
# The default is to use the user's home directory:
;	[Profiles]
;	path = /var/lib/samba/profiles
;	browseable = no
;	guest ok = yes

# A publicly accessible directory that is read only, except for users in the
# "staff" group (which have write permissions):
;	[public]
;	comment = Public Stuff
;	path = /home/samba
;	public = yes
;	writable = yes
;	printable = no
;	write list = +staff


code:
[Desktop Entry]
Name=Samba Configuration
Name[de]=Samba Konfiguration
Name[tr]=Samba Yapılandırması
Type=Application
Comment=Configure Samba with a web based interface
Comment[tr]=Web tabanlı Samba yapılandırması
Exec=htmlview http://127.0.0.1:901/
Terminal=false
Categories=X-Red-Hat-Extra;Application;System;X-Red-Hat-ServerConfig;


code: 127.0.0.1 localhost

path: server/samba/files/lmhosts


code:
#set winbind="yes" if you want winbind
winbind="no"


code:
/var/log/samba/*.log /var/log/samba/log.* {
    notifempty
    missingok
    sharedscripts
    copytruncate
    postrotate
    /bin/kill -HUP `cat /run/smbd.pid /run/nmbd.pid /run/winbindd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}


code:
#%PAM-1.0
auth       required     pam_smbpass.so nodelay
account    include      system-auth
session    include      system-auth
password   required     pam_smbpass.so nodelay smbconf=/etc/samba/smb.conf


code:
# PiSiLinux samba configuration

[global]
workgroup = PiSiLinuxWorkGroup
server string = %h (workstation)
log file = /var/log/samba/samba.log
max log size = 50
dns proxy = no

# We are using share model security
security = user

map to guest = Bad User
usershare allow guests = Yes
usershare max shares = 40
usershare owner only = False
usershare path = /var/lib/samba/usershares

# Sample sharings are defined here.
# Modify these according to your taste.

# Un-comment the following and create the
# netlogon directory for Domain Logons

; [netlogon]
;   comment = Network Logon Service
;   path = /usr/local/samba/lib/netlogon
;   guest ok = yes
;   writable = no
;   share modes = no

# All printers are by default shared by Samba.
# Use "browseable = yes" for other clients
# to browse this printer share.

[printers]
comment = All printers
path = /var/spool/samba
browseable = no
guest ok = no
printable = yes
writable = no
create mode = 0700

# A sample share that is enabled by default

[share]
comment = Samba Linux share
path = /home/samba
browseable = yes
guest ok = yes

# A sample sharing that everyone can access to.
# Modify the "path" statement so that it points
# to your directory you want to share.

;[public]
;   path = /usr/somewhere/else/public
;   public = yes
;   only guest = yes
;   writable = no
;   printable = no


code:
# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
nobody = guest pcguest smbguest

path: server/samba/files/smbusers


code:
#%PAM-1.0

auth        required      /lib/security/pam_env.so
auth        sufficient    /lib/security/pam_winbind.so
auth        sufficient    /lib/security/pam_unix.so likeauth nullok use_first_pass
auth        required      /lib/security/pam_deny.so

account     sufficient    /lib/security/pam_winbind.so
account     required      /lib/security/pam_unix.so

password    required      /lib/security/pam_cracklib.so retry=3
password    sufficient    /lib/security/pam_unix.so nullok use_authtok md5 shadow
password    required      /lib/security/pam_deny.so

session     required      /lib/security/pam_mkhomedir.so skel=/etc/skel/ umask=0022
session     required      /lib/security/pam_limits.so
session     required      /lib/security/pam_unix.so

path: server/samba/files/system-auth-winbind


code: D /run/samba 0755 root root


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>samba</Name>
        <Homepage>http://www.samba.org</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>service</IsA>
        A suite of SMB and CIFS client/server programs for UNIX
        <Description>samba is a free software implementation of Microsoft's networking protocol released under the GNU General Public License. As of version 4, Samba not only provides file and print services for various Microsoft Windows clients but can also integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a Domain Member. It can also be part of an Active Directory domain.</Description>
        <Archive sha1sum="cff0168e67ef797c0d71c13b6b1208d2ecdc4e6b" type="targz">http://us1.samba.org/samba/ftp/stable/samba-4.5.5.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>keyutils</Dependency>
            <Dependency>acl-devel</Dependency>
            <Dependency>pam-devel</Dependency>
            <Dependency>attr-devel</Dependency>
            <Dependency>popt-devel</Dependency>
            <Dependency>zlib-devel</Dependency>
            <Dependency>libcap-devel</Dependency>
            <Dependency>python-devel</Dependency>
            <Dependency>ncurses-devel</Dependency>
            <Dependency>readline-devel</Dependency>
            <Dependency>e2fsprogs-devel</Dependency>
            <Dependency>libgcrypt-devel</Dependency>
            <Dependency>libbsd-devel</Dependency>
            <Dependency>avahi-libs</Dependency>

            <Dependency>cups-devel</Dependency>
            <Dependency>avahi-devel</Dependency>
            <Dependency>dmapi-devel</Dependency>

            <Dependency>gnutls-devel</Dependency>
            <Dependency>libaio-devel</Dependency>

            <Dependency>mit-kerberos</Dependency>
            <Dependency>iniparser-devel</Dependency>
            <Dependency>libtalloc-devel</Dependency>
            <Dependency>libtevent-devel</Dependency>
            <Dependency>openldap-client</Dependency>
            <Dependency>libarchive-devel</Dependency>
            <Dependency>nss-devel</Dependency>
            <Dependency>docbook-xsl</Dependency>
            <Dependency>libxslt</Dependency>
            <Dependency versionFrom="1.2.12">libtdb-devel</Dependency>
            <Dependency versionFrom="2.1.26">cyrus-sasl-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>samba</Name>
        <RuntimeDependencies>
            <Dependency>acl</Dependency>
            <Dependency>pam</Dependency>
            <Dependency>attr</Dependency>
            <Dependency>popt</Dependency>
            <Dependency>zlib</Dependency>
            <Dependency>libcap</Dependency>
            <Dependency>python</Dependency>
            <Dependency>ncurses</Dependency>
            <Dependency>readline</Dependency>
            <Dependency>e2fsprogs</Dependency>
            <Dependency>libgcrypt</Dependency>
            <Dependency>libarchive</Dependency>
            <Dependency>cups</Dependency>
            <Dependency>avahi</Dependency>
            <Dependency>gdb</Dependency>

            <Dependency>gnutls</Dependency>
            <Dependency>libbsd</Dependency>
            <Dependency>libaio</Dependency>

            <Dependency>keyutils</Dependency>
            <Dependency>iniparser</Dependency>
            <Dependency>libtalloc</Dependency>
            <Dependency>libtevent</Dependency>
            <Dependency>avahi-libs</Dependency>
            <Dependency>openldap-client</Dependency>
            <Dependency versionFrom="2.1.26">cyrus-sasl</Dependency>
            <Dependency versionFrom="1.2.12">libtdb</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="data">/run</Path>
            <Path fileType="config">/etc</Path>
            <Path fileType="data">/var/lib</Path>
            <Path fileType="data">/var/log</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="executable">/sbin</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="library">/lib/security</Path>
            <Path fileType="data">/usr/share/samba</Path>
            <Path fileType="data">/usr/share/perl5</Path>
            <Path fileType="data">/usr/libexec/samba/</Path>
            <Path fileType="data">/usr/libexec/ctdb/</Path>
            <Path fileType="data">/var/cache/samba</Path>
	        <Path fileType="data">/var/run/ctdb</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
            <Path fileType="config">/usr/lib/tmpfiles.d/samba.conf</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/etc/samba/lmhosts">lmhosts</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/pam.d/samba">samba.pam</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/samba/smbusers">smbusers</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/samba/smb.conf">smb.conf</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/conf.d/samba">samba.confd</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/samba.conf">tmpfiles.conf</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/samba/system-auth-winbind">system-auth-winbind</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="package.py">System.Package</COMAR>
            <COMAR script="service.py">System.Service</COMAR>
        </Provides>
    </Package>

    <Package>
        <Name>samba-devel</Name>
        Development files for samba
        <RuntimeDependencies>

            <Dependency>libtalloc-devel</Dependency>
            <Dependency>libtevent-devel</Dependency>
            <Dependency release="current">samba</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="header">/usr/include</Path>
            <Path fileType="data">/usr/lib/pkgconfig</Path>
        </Files>
    </Package>

    <History>
        <Update release="4">
            <Date>2017-02-28</Date>
            <Version>4.5.5</Version>
            <Comment>Version bump.</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
        <Update release="3">
            <Date>2016-07-24</Date>
            <Version>4.4.5</Version>
            <Comment>Version Bump fix service.py</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-15</Date>
            <Version>4.2.3</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-07-30</Date>
            <Version>4.2.3</Version>
            <Comment>First release</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>samba</Name>
        Linux için Windows ağ paylaşım servisi
        <Description xml:lang="tr">Samba, Linux ve Unix işletim sistemleri ile Windows NT ve Windows 9x işletim sistemleri arasındaki iletişimi sağlayan bir ağ sunucusu uygulamasıdır. Samba yalnızca Linux ve windows makinaların birbirlerini görmelerini sağlamaz aynı zamanda Linux çalıştıran bilgisayarların windows ağında yazıcı sunucusu gibi işlevleri edinmesi içinde kullanılır. Ayrıca Active Directory ile de uyumludur.</Description>
    </Source>

    <Package>
        <Name>samba-devel</Name>
        samba için geliştirme dosyaları
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

WorkDir = "httpd-%s" % get.srcVERSION()

def config_layout():
    return """
<Layout PisiLinux>
    prefix:          /usr
    exec_prefix:     /usr
    bindir:          /usr/bin
    sbindir:         /usr/sbin
    libdir:          /usr/lib
    libexecdir:      /usr/lib/apache2/modules
    mandir:          /usr/share/man
    infodir:         /usr/share/info
    includedir:      /usr/include/apache2
    installbuilddir: /usr/lib/apache2/build
    datadir:         /var/www/localhost
    errordir:        /var/www/localhost/error
    iconsdir:        /var/www/localhost/icons
    htdocsdir:       /var/www/localhost/htdocs
    cgidir:          /var/www/localhost/cgi-bin
    manualdir:       /usr/share/doc/version/manual
    sysconfdir:      /etc/apache2
    localstatedir:   /var
    runtimedir:      /run
    logfiledir:      /var/log/apache2
    proxycachedir:   /var/cache/apache2
</Layout>"""

def modules_config():
    disabled = ['bucketeer', 'example', 'optional-fn-export', 'optional-fn-import',
                'optional-hook-export','optional-hook-import']

    static = ['so']

    # auth_ldap, ldap needed
    shared = ['actions', 'alias', 'asis', 'auth_basic', 'authn_dbm', 'authn_file',
              'auth_digest', 'authz_host', 'autoindex', 'cache', 'case_filter',
              'case-filter-in', 'cern-meta', 'cgi', 'cgid', 'charset-lite', 'dav',
              'dav-fs', 'deflate', 'dir', 'disk-cache', 'echo', 'env', 'expires',
              'ext-filter', 'file-cache', 'headers', 'imagemap', 'include', 'info',
              'log_config', 'logio', 'mem-cache', 'mime', 'mime-magic', 'negotiation',
              'proxy', 'proxy-connect','proxy-ftp', 'proxy-http', 'rewrite', 'setenvif',
              'speling', 'status', 'unique-id', 'userdir', 'usertrack', 'vhost-alias']

    conf = ""

    for i in disabled:
        conf += "--disable-%s " % i
    for i in static:
        conf += "--enable-%s=yes " % i
    for i in shared:
        conf += "--enable-%s=shared " % i

    return conf

def setup():
    shelltools.echo("config.layout", config_layout())
    pisitools.dosed("config.layout", "version", get.srcNAME())

    #for d in ["apr","apr-util","pcre"]:
        #shelltools.unlinkDir("srclib/%s" % d)

    # this fixes segfaults, remember omit-frame-pointer will be default soon
    if get.ARCH() == "i686":
        shelltools.export("CFLAGS", "%s -fno-omit-frame-pointer" % get.CFLAGS())
    shelltools.export("LDFLAGS", "-Wl,-z,relro,-z,now")

    autotools.rawConfigure('--with-mpm=prefork \
                            --enable-layout=PisiLinux \
                            --enable-mods-shared=all \
                            --with-ssl=/usr \
                            --enable-ssl=shared \
                            %s \
                            --with-z=/usr \
                            --with-port=80 \
                            --with-program-name=apache2 \
                            --with-apr=/usr/bin/apr-1-config \
                            --with-apr-util=/usr/bin/apu-1-config \
                            --with-suexec-safepath="/usr/bin:/bin" \
                            --with-suexec-logfile=/var/log/apache2/suexec_log \
                            --with-suexec-bin=/usr/sbin/suexec \
                            --with-suexec-userdir="public_html" \
                            --with-suexec-caller=apache \
                            --with-suexec-docroot=/var/www \
                            --with-suexec-uidmin=1000 \
                            --with-suexec-gidmin=100 \
                            --with-suexec-umask=077 \
                            --enable-suexec=shared \
                            --enable-pie \
                            --with-pcre=/usr/bin/pcre-config' % modules_config())

    pisitools.dosed("include/ap_config_auto.h", "apache2\.conf", "httpd.conf")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s INSTALL_SUEXEC='setuid'" % get.installDIR())

    pisitools.dosym("/usr/lib", "/usr/lib/apache2/lib")
    pisitools.dosym("/var/log/apache2", "/usr/lib/apache2/logs")
    pisitools.dosym("/etc/apache2", "/usr/lib/apache2/conf")

    pisitools.dosbin("support/split-logfile")
    pisitools.dosbin("support/list_hooks.pl")
    pisitools.dosbin("support/logresolve.pl")
    pisitools.dosbin("support/log_server_status")

    pisitools.dosbin("apache2")

    pisitools.domove("/usr/sbin/envvars*", "/usr/lib/apache2/build")
    pisitools.dosed("%s/usr/bin/apxs" % get.installDIR(), \
                    "my \$envvars = get_vars\(\"bindir\"\) \. \"/envvars\";", \
                    "my $envvars = \"$installbuilddir/envvars\";")

    # Clean-up
    pisitools.remove("/etc/apache2/*")
    pisitools.remove("/var/www/localhost/htdocs/*")

    # Add conf.d for 3rd party configuration files
    pisitools.dodir("/etc/apache2/conf.d")

    # ssl enabled apache needs that one
    pisitools.dodir("/var/cache/apache2")

    # Fix wrong libtool path
    pisitools.dosed("%s/usr/lib/apache2/build/config_vars.mk" % get.installDIR(), \
                    "/usr/lib/apache2/build/libtool", \
                    "/usr/bin/libtool")

    # Remove cgi scripts which are vulnerable, see CVE-2007-4049
    pisitools.remove("/var/www/localhost/cgi-bin/*")

    pisitools.dodoc("ABOUT_APACHE", "CHANGES", "LAYOUT", "LICENSE", "README*")

    pisitools.removeDir("/run")


code:
#!/usr/bin/python

import os

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    os.system("/bin/chown root:apache /usr/sbin/suexec")
    os.system("/bin/chmod 04710 /usr/sbin/suexec")
    os.system("/bin/chown apache:apache /var/cache/apache2")


code:
from comar.service import *

serviceType = "server"
serviceDesc = _({"en": "Apache Web Server",
                 "tr": "Apache Web Sunucusu"})

serviceConf = "apache2"

PIDFILE = "/run/apache2.pid"

@synchronized
def start():
    import os
    os.environ["LC_ALL"] = "C"
    os.environ["LANG"] = "C"

    startService(command="/usr/sbin/apache2",
                 args="-d /usr/lib/apache2/ -f /etc/apache2/httpd.conf %s -k start"  % config.get("APACHE2_OPTS", ""),
                 pidfile=PIDFILE,
                 donotify=True)

@synchronized
def stop():
    stopService(command="/usr/sbin/apache2",
                args="-d /usr/lib/apache2/ -f /etc/apache2/httpd.conf %s -k stop"  % config.get("APACHE2_OPTS", ""),
                donotify=True)
    import time
    time.sleep(3)

def reload():
    stopService(command="/usr/sbin/apache2",
                args="-d /usr/lib/apache2/ -f /etc/apache2/httpd.conf %s -k graceful"  % config.get("APACHE2_OPTS", ""))

def status():
    return isServiceRunning(PIDFILE)


code:
#
# This configuration file allows the manual to be accessed at
# http://localhost/manual/
#
AliasMatch ^/manual(?:/(?:de|en|fr|ja|ko|ru))?(/.*)?$ "/usr/share/doc/apache/manual$1"
<Directory "/usr/share/doc/apache/manual">
    Options Indexes
    AllowOverride None
    Require all granted
</Directory>


code:
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
#    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
#</VirtualHost>

#
# The First Virtual Host is also your DEFAULT Virtual Host.
# This means any requests that do not match any other vhosts will
# goto this virtual host.
#

<IfDefine DEFAULT_VHOST>
<VirtualHost *:80>
    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "/var/www/localhost/htdocs"

    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/var/www/localhost/htdocs">

        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs-2.0/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks

        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride None

        #
        # Controls who can get stuff from this server.
        #
        Order allow,deny
        Allow from all
    </Directory>

    <IfModule peruser.c>
        # this must match a Processor
        ServerEnvironment apache apache

        # these are optional - defaults to the values specified in httpd.conf
        MinSpareProcessors 4
        MaxProcessors 20
    </IfModule>
</VirtualHost>
</IfDefine>


code:
<IfDefine SSL>
  <IfModule !mod_ssl.c>
    LoadModule ssl_module    modules/mod_ssl.so
  </IfModule>
</IfDefine>

<IfModule mod_ssl.c>
#
# This is the Apache server configuration file providing SSL support.
# It contains the configuration directives to instruct the server how to
# serve pages over an https connection. For detailing information about these
# directives see <URL:http://httpd.apache.org/docs-2.0/mod/mod_ssl.html>
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#

#
# Pseudo Random Number Generator (PRNG):
# Configure one or more sources to seed the PRNG of the SSL library.
# The seed data should be of good random quality.
# WARNING! On some platforms /dev/random blocks if not enough entropy
# is available. This means you then cannot use the /dev/random device
# because it would lead to very long connection times (as long as
# it requires to make more entropy available). But usually those
# platforms additionally provide a /dev/urandom device which doesn't
# block. So, if available, use this one instead. Read the mod_ssl User
# Manual for more details.
#
# Note: This must come before the <IfDefine SSL> container to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random  512
#SSLRandomSeed startup file:/dev/urandom 512
#SSLRandomSeed connect file:/dev/random  512
#SSLRandomSeed connect file:/dev/urandom 512

#
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#

Listen 443

##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##

#
#   Some MIME-types for downloading Certificates and CRLs
#

<IfModule mod_mime.c>
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</IfModule>

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is a internal
#   terminal dialog) has to provide the pass phrase on stdout.

SSLPassPhraseDialog  builtin

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism
#   to use and second the expiring timeout (in seconds).
#SSLSessionCache        none
#SSLSessionCache        shmht:logs/ssl_scache(512000)
#SSLSessionCache        shmcb:logs/ssl_scache(512000)
#SSLSessionCache        dbm:/var/cache/apache2/ssl_scache
SSLSessionCache         shm:/var/cache/apache2/ssl_scache(512000)
SSLSessionCacheTimeout  300

#   Semaphore:
#   Configure the path to the mutual exclusion semaphore the
#   SSL engine uses internally for inter-process synchronization.

SSLMutex  file:/var/cache/apache2/ssl_mutex
</IfModule>


code:
<IfDefine SSL>

  # We now wrap the entire default vhost in a seperate IfDefine to fix bug
  # 100624. If you are using this default vhost, add it to /etc/conf.d/apache2
  <IfDefine SSL_DEFAULT_VHOST>

<IfModule mod_ssl.c>
##
## SSL Virtual Host Context
##

<VirtualHost _default_:443>

#   General setup for the virtual host
DocumentRoot "/var/www/localhost/htdocs"
ServerName localhost:443
ServerAdmin root@localhost
ErrorLog logs/ssl_error_log
<IfModule mod_log_config.c>
	TransferLog logs/ssl_access_log
</IfModule>

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   SSL Cipher Suite:
#   List the ciphers that the client is permitted to negotiate.
#   See the mod_ssl documentation for a complete list.
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

#   Server Certificate:
#   Point SSLCertificateFile at a PEM encoded certificate.  If
#   the certificate is encrypted, then you will be prompted for a
#   pass phrase.  Note that a kill -HUP will prompt again. A test
#   certificate can be generated with `make certificate' under
#   built time. Keep in mind that if you've both a RSA and a DSA
#   certificate you can configure both in parallel (to also allow
#   the use of DSA ciphers, etc.)
SSLCertificateFile conf/ssl/server.crt

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)

SSLCertificateKeyFile conf/ssl/server.key

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
#SSLCertificateChainFile conf/ssl/ca.crt

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#   Note: Inside SSLCACertificatePath you need hash symlinks
#         to point to the certificate files. Use the provided
#         Makefile to update the hash symlinks after changes.
#SSLCACertificatePath conf/ssl/ssl.crt
#SSLCACertificateFile conf/ssl/ca-bundle.crt

#   Certificate Revocation Lists (CRL):
#   Set the CA revocation path where to find CA CRLs for client
#   authentication or alternatively one huge file containing all
#   of them (file must be PEM encoded)
#   Note: Inside SSLCARevocationPath you need hash symlinks
#         to point to the certificate files. Use the provided
#         Makefile to update the hash symlinks after changes.
#SSLCARevocationPath conf/ssl/ssl.crl
#SSLCARevocationFile conf/ssl/ca-bundle.crl

#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10

#   Access Control:
#   With SSLRequire you can do per-directory access control based
#   on arbitrary complex boolean expressions containing server
#   variable checks and other lookup directives.  The syntax is a
#   mixture between C and Perl.  See the mod_ssl documentation
#   for more details.
#<Location />
#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
#            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
#            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
#            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#</Location>

#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
#     Translate the client X.509 into a Basic Authorisation.  This means that
#     the standard Auth/DBMAuth methods can be used for access control.  The
#     user name is the `one line' version of the client's X.509 certificate.
#     Note that no password is obtained from the user. Every entry in the user
#     file needs this password: `xxj31ZMTZzkVA'.
#   o ExportCertData:
#     This exports two additional environment variables: SSL_CLIENT_CERT and
#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
#     server (always existing) and the client (only existing when client
#     authentication is used). This can be used to import the certificates
#     into CGI scripts.
#   o StdEnvVars:
#     This exports the standard SSL/TLS related `SSL_*' environment variables.
#     Per default this exportation is switched off for performance reasons,
#     because the extraction step is an expensive operation and is usually
#     useless for serving static content. So one usually enables the
#     exportation for CGI and SSI requests only.
#   o CompatEnvVars:
#     This exports obsolete environment variables for backward compatibility
#     to Apache-SSL 1.x, mod_ssl 2.0.x, Sioux 1.0 and Stronghold 2.x. Use this
#     to provide compatibility to existing CGI scripts.
#   o StrictRequire:
#     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
#     under a "Satisfy any" situation, i.e. when it applies access is denied
#     and no other module can change it.
#   o OptRenegotiate:
#     This enables optimized SSL connection renegotiation handling when SSL
#     directives are used in per-directory context.
#SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire

<Files ~ "\.(cgi|shtml|phtml|php?)$">
    SSLOptions +StdEnvVars
</Files>

<Directory "/var/www/localhost/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn't wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
#     This forces an unclean shutdown when the connection is closed, i.e. no
#     SSL close notify alert is send or allowed to received.  This violates
#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
#     this when you receive I/O errors because of the standard approach where
#     mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
#     This forces an accurate shutdown when the connection is closed, i.e. a
#     SSL close notify alert is send and mod_ssl waits for the close notify
#     alert of the client. This is 100% SSL/TLS standard compliant, but in
#     practice often causes hanging connections with brain-dead browsers. Use
#     this only for browsers where you know that their SSL implementation
#     works correctly.
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
#   "force-response-1.0" for this.
<IfModule mod_setenvif.c>
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
</IfModule>

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
<IfModule mod_log_config.c>
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions inherit
</IfModule>

</VirtualHost>

</IfModule>

  </IfDefine>
</IfDefine>


code:
<IfDefine DAV>
  <IfModule !mod_dav.c>
    LoadModule dav_module    modules/mod_dav.so
  </IfModule>
</IfDefine>

<IfDefine DAV_FS>
  <IfModule !mod_dav_fs.c>
    LoadModule dav_fs_module   modules/mod_dav_fs.so
  </IfModule>
</IfDefine>

<IfModule mod_dav.c>

    DavMinTimeout 600
#	<Location /mypages>
#		Options None
#		Dav On
#		<Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
#			Require user greg
#		</Limit>
#	</Location>

</IfModule>

<IfModule mod_dav_fs.c>

    # Location of the WebDAV lock database.
    DavLockDB /var/lib/dav/lockdb

</IfModule>


code:
<IfDefine LDAP>
  <IfModule !util_ldap.c>
    LoadModule ldap_module    modules/mod_ldap.so
  </IfModule>
</IfDefine>

<IfDefine AUTH_LDAP>
  <IfModule !mod_auth_ldap.c>
    LoadModule auth_ldap_module   modules/mod_auth_ldap.so
  </IfModule>
</IfDefine>

# Examples below are taken from the online documentation
# Refer to:
# http://localhost/manual/mod/mod_ldap.html
# http://localhost/manual/mod/mod_auth_ldap.html

<IfModule util_ldap.c>

    LDAPSharedCacheSize 200000
    LDAPCacheEntries 1024
    LDAPCacheTTL 600
    LDAPOpCacheEntries 1024
    LDAPOpCacheTTL 600

    <Location /ldap-status>
        SetHandler ldap-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>

</IfModule>

<IfModule mod_auth_ldap.c>

    #AuthLDAPURL ldap://ldap1.airius.com:389/ou=People, o=Airius?uid?sub?(objectClass=*)
    #require valid-user

</IfModule>


code:
[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=notify
EnvironmentFile=/etc/conf.d/apache2
PIDFile=/run/apache2.pid
ExecStart=/usr/sbin/apache2 -d /usr/lib/apache2/ -f /etc/apache2/httpd.conf $APACHE2_OPTS -k start
ExecReload=/usr/sbin/apache2 -d /usr/lib/apache2/ -f /etc/apache2/httpd.conf $APACHE2_OPTS -k graceful
ExecStop=/usr/sbin/apache2 -d /usr/lib/apache2/ -f /etc/apache2/httpd.conf $APACHE2_OPTS -k graceful-stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target


code:
# Original works belongs to Gentoo Linux

# Config file for /etc/conf. d/apache2

# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the APACHE2_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will be an
# <IfDefine NNN> where NNN is the option to enable that module.
# Here are the options available in the default configuration:
#   USERDIR   Enables /~username mapping to /home/username/public_html
#   INFO      Enables mod_info, a useful module for debugging
#   PROXY     Enables mod_proxy
#   DAV       Enables mod_dav
#   DAV_FS    Enables mod_dav_fs (you should enable this when you enable DAV
#             unless you know what you are doing)
#   SSL       Enables SSL
#   SSL_DEFAULT_VHOST  Enables default vhost for SSL (you should enable this
#                      when you enable SSL unless you know what you are doing)
#   LDAP      Enables mod_ldap
#   AUTH_LDAP Enables authentication through mod_ldap
#   DEFAULT_VHOST Enables the default virtual host in /var/www/localhost/htdocs
APACHE2_OPTS="-D DEFAULT_VHOST -D USERDIR"

# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.

# ServerRoot setting
#SERVERROOT=/usr/lib/apache2

# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# Environment variables to keep
# All environment variables are cleared from apache
# Use this to preserve some of them
# NOTE!!! It's very important that this contains PATH
# Also, it will fail if the _value_ of any of these variables contains a space
KEEPENV="PATH"


code:
- fail gracefully if links is not installed on target system
- source sysconfig/httpd for custom env. vars etc.
- make httpd -t work even in SELinux
- pass $OPTIONS to all $HTTPD invocation

Upstream-HEAD: vendor
Upstream-2.0: vendor
Upstream-Status: Vendor-specific changes for better initscript integration

--- httpd-2.4.1/support/apachectl.in.apctl
+++ httpd-2.4.1/support/apachectl.in
@@ -44,19 +44,25 @@
 # the path to your httpd binary, including options if necessary
 HTTPD='@exp_sbindir@/@progname@'
 #
-# pick up any necessary environment variables
-if test -f @exp_sbindir@/envvars; then
-  . @exp_sbindir@/envvars
-fi
 #
 # a command that outputs a formatted text version of the HTML at the
 # url given on the command line.  Designed for lynx, however other
 # programs may work.
-LYNX="@LYNX_PATH@ -dump"
+if [ -x "@LYNX_PATH@" ]; then
+  LYNX="@LYNX_PATH@ -dump"
+else
+  LYNX=none
+fi
 #
 # the URL to your server's mod_status status page.  If you do not
 # have one, then status and fullstatus will not work.
 STATUSURL="http://localhost:@PORT@/server-status"
+
+# Source /etc/conf.d/apache2 for $HTTPD setting, etc.
+if [ -r /etc/conf.d/apache2 ]; then
+   . /etc/conf.d/apache2
+fi
+
 #
 # Set this variable to a command that increases the maximum
 # number of file descriptors allowed per child process. This is
@@ -76,9 +82,16 @@
     ARGV="-h"
 fi

+function checklynx() {
+if [ "$LYNX" = "none" ]; then
+   echo "The 'links' package is required for this functionality."
+   exit 8
+fi
+}
+
 case $ACMD in
 start|stop|restart|graceful|graceful-stop)
-    $HTTPD -k $ARGV
+    $HTTPD $OPTIONS -k $ARGV
     ERROR=$?
     ;;
 startssl|sslstart|start-SSL)
@@ -88,17 +101,18 @@
     ERROR=2
     ;;
 configtest)
-    $HTTPD -t
-    ERROR=$?
+    testconfig
     ;;
 status)
+    checklynx
     $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
     ;;
 fullstatus)
+    checklynx
     $LYNX $STATUSURL
     ;;
 *)
-    $HTTPD "$@"
+    $HTTPD $OPTIONS "$@"
     ERROR=$?
 esac


code:
Bump up the core size limit if CoreDumpDirectory is
configured.

Upstream-Status: Was discussed but there are competing desires;
	there are portability oddities here too.

--- httpd-2.4.1/server/core.c.corelimit
+++ httpd-2.4.1/server/core.c
@@ -4433,6 +4433,25 @@ static int core_post_config(apr_pool_t *
     }
     apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper,
                               apr_pool_cleanup_null);
+
+#ifdef RLIMIT_CORE
+    if (ap_coredumpdir_configured) {
+        struct rlimit lim;
+
+        if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) {
+            lim.rlim_cur = lim.rlim_max;
+            if (setrlimit(RLIMIT_CORE, &lim) == 0) {
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
+                             "core dump file size limit raised to %lu bytes",
+                             lim.rlim_cur);
+            } else {
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL,
+                             "core dump file size is zero, setrlimit failed");
+            }
+        }
+    }
+#endif
+
     return OK;
 }


code:
Link straight against .la files.

Upstream-Status: vendor specific

--- httpd-2.4.1/configure.in.deplibs
+++ httpd-2.4.1/configure.in
@@ -707,9 +707,9 @@ APACHE_HELP_STRING(--with-suexec-umask,u

 dnl APR should go after the other libs, so the right symbols can be picked up
 if test x${apu_found} != xobsolete; then
-  AP_LIBS="$AP_LIBS `$apu_config --avoid-ldap --link-libtool --libs`"
+  AP_LIBS="$AP_LIBS `$apu_config --avoid-ldap --link-libtool`"
 fi
-AP_LIBS="$AP_LIBS `$apr_config --link-libtool --libs`"
+AP_LIBS="$AP_LIBS `$apr_config --link-libtool`"
 APACHE_SUBST(AP_LIBS)
 APACHE_SUBST(AP_BUILD_SRCLIB_DIRS)
 APACHE_SUBST(AP_CLEAN_SRCLIB_DIRS)


code:
- Fix config for /icons/ dir to allow symlink to poweredby.png.
- Avoid using coredump GIF for a directory called "core"

Upstream-Status: vendor specific patch

--- httpd-2.4.2/docs/conf/extra/httpd-autoindex.conf.in.icons
+++ httpd-2.4.2/docs/conf/extra/httpd-autoindex.conf.in
@@ -21,7 +21,7 @@ IndexOptions FancyIndexing HTMLTable Ver
 Alias /icons/ "@exp_iconsdir@/"

 <Directory "@exp_iconsdir@">
-    Options Indexes MultiViews
+    Options Indexes MultiViews FollowSymlinks
     AllowOverride None
     Require all granted
 </Directory>
@@ -53,7 +53,7 @@ AddIcon /icons/dvi.gif .dvi
 AddIcon /icons/uuencoded.gif .uu
 AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
 AddIcon /icons/tex.gif .tex
-AddIcon /icons/bomb.gif core
+AddIcon /icons/bomb.gif core.

 AddIcon /icons/back.gif ..
 AddIcon /icons/hand.right.gif README


code:
Upstream-Status: vendor specific patch

diff --git a/support/apachectl.in b/support/apachectl.in
index c6ac3ea..2599386 100644
--- a/support/apachectl.in
+++ b/support/apachectl.in
@@ -100,9 +100,24 @@ fi
 ERROR=$?
 }

+if [ "x$2" != "x" ] ; then
+    echo Passing arguments to httpd using apachectl is no longer supported.
+    echo You can only start/stop/restart httpd using this script.
+    echo If you want to pass extra arguments to httpd, edit the
+    echo /etc/sysconfig/httpd config file.
+fi
+
 case $ACMD in
-start|stop|restart|graceful|graceful-stop)
-    $HTTPD $OPTIONS -k $ARGV
+start|stop|restart|status)
+    /usr/bin/systemctl $ACMD httpd.service
+    ERROR=$?
+    ;;
+graceful)
+    /usr/bin/systemctl restart httpd.service
+    ERROR=$?
+    ;;
+graceful-stop)
+    /usr/bin/systemctl stop httpd.service
     ERROR=$?
     ;;
 startssl|sslstart|start-SSL)
@@ -114,10 +129,6 @@ startssl|sslstart|start-SSL)
 configtest)
     testconfig
     ;;
-status)
-    checklynx
-    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
-    ;;
 fullstatus)
     checklynx
     $LYNX $STATUSURL


code:
--- httpd-2.4.3/support/apxs.in.apxs
+++ httpd-2.4.3/support/apxs.in
@@ -25,7 +25,18 @@ package apxs;

 my %config_vars = ();

-my $installbuilddir = "@exp_installbuilddir@";
+# Awful hack to make apxs libdir-agnostic:
+my $pkg_config = "/usr/bin/pkg-config";
+if (! -x "$pkg_config") {
+    error("$pkg_config not found!");
+    exit(1);
+}
+
+my $libdir = `pkg-config --variable=libdir apr-1`;
+chomp $libdir;
+
+my $installbuilddir = $libdir . "/apache2/build";
+
 get_config_vars("$installbuilddir/config_vars.mk",\%config_vars);

 # read the configuration variables once
@@ -275,7 +286,7 @@ if ($opt_g) {
     $data =~ s|%NAME%|$name|sg;
     $data =~ s|%TARGET%|$CFG_TARGET|sg;
     $data =~ s|%PREFIX%|$prefix|sg;
-    $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg;
+    $data =~ s|%LIBDIR%|$libdir|sg;

     my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s);

@@ -453,11 +464,11 @@ if ($opt_c) {
     my $ldflags = "$CFG_LDFLAGS";
     if ($opt_p == 1) {

-        my $apr_libs=`$apr_config --cflags --ldflags --link-libtool --libs`;
+        my $apr_libs=`$apr_config --cflags --ldflags --link-libtool`;
         chomp($apr_libs);
         my $apu_libs="";
         if ($apr_major_version < 2) {
-            $apu_libs=`$apu_config --ldflags --link-libtool --libs`;
+            $apu_libs=`$apu_config --ldflags --link-libtool`;
             chomp($apu_libs);
         }

@@ -672,8 +683,8 @@ __DATA__

 builddir=.
 top_srcdir=%PREFIX%
-top_builddir=%PREFIX%
-include %INSTALLBUILDDIR%/special.mk
+top_builddir=%LIBDIR%/apache2
+include %LIBDIR%/apache2/build/special.mk

 #   the used tools
 APXS=apxs