PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : HowTo zum erstellen eines ProFTP SuSE 10.1 rpm's



Ulli Ivens
24.08.06, 12:44
Hallo zusammen,

bislang gab es kein rpm für proFTPD 1.3.0 und SuSE 10.1. Ich habe mal eines gebaut und ein Startscript dafür geschrieben/angepasst. Das Start-Script sieht so aus:



#! /bin/sh
### BEGIN INIT INFO
# Provides: proftpd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: proftp
# Description: Start proftp Server
### END INIT INFO

# Check for missing binaries (stale symlinks should not happen)
PROFTPD_BIN=/usr/sbin/proftpd
test -x $PROFTPD_BIN || { echo "$PROFTPD_BIN not installed"; exit 5; }

# proftpd runs as this user
PROFTPDUSER=root

. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
start)
echo -n "Starting proftpd "
startproc -u $PROFTPDUSER $PROFTPD_BIN
rc_status -v
;;
stop)
echo -n "Shutting down proftpd "
killproc -TERM $PROFTPD_BIN
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status -v
;;
status)
echo -n "Checking for service proftpd "
checkproc $PROFTPD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
rc_exit


Das Startscript (bei mir heisst es proftpd) muss dann nach /etc/init.d/ gelegt werden.

Damit der Server dann nicht als root läuft muss man die proftpd.conf entsprechend bearbeiten (siehe rote Hervorhebung)

Hier meine Konfiguration die astrein läuft:

- Vorraussetzung:

1.) Die Firewall muss mitmachen
2.) Der User "foo" muss existieren, der Gruppe "users" angehören und ein Passwort haben. Damit dann nicht jeder per ssh (wenns dann läuft) connecten kann, solltet ihr als shell für den User "foo" /bin/false setzten (in der Datei /etc/passwd)



ServerName "blabla ProFTP Server 1.3.0"
ServerType standalone
DefaultServer on

# Allow FTP resuming.
# Remember to set to off if you have an incoming ftp for upload.
AllowStoreRestart on

# Port 21 is the standard FTP port.
Port 21
PassivePorts 5000 5010

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 5

# Set the user and group under which the server will run.
User nobody
Group nogroup

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite on

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit>

# Needed for NIS.

PersistentPasswd off

# Default root can be used to put users in a chroot environment.
# As an example if you have a user foo and you want to put foo in /home/foo
# chroot environment you would do this:
#
# DefaultRoot /home/foo foo
DefaultRoot /mnt/data/foo foo

<Anonymous /mnt/data/foo>
#grundsaetzliche einstellungen fuer foo account
User foo
Group users
Umask 011
RequireValidShell off
AnonRequirePassword on
AuthAliasOnly off
AuthUsingAlias off
AllowOverwrite on
AllowStoreRestart on
AllowRetrieveRestart on

#schreiben generell nicht erlauben
<Directory *>
<Limit WRITE MKD STOR>
DenyAll
</Limit>
</Directory>

#im verzeichnis upload freie hand lassen, ausser loeschen von verzeichnissen und dateien
<Directory upload>
<Limit WRITE STOR READ CWD MKD>
AllowAll
</Limit>
<Limit RMD DELE>
DenyAll
</Limit>
</Directory>

</Anonymous>




Das RPM kann ich hier leider nicht posten, wer's haben will kann mich anmailen oder folgendermaßen selber bauen:

1.) proftpd-1.3.0.tar.bz2 (ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0.tar.bz2) von www.proftpd.org runterladen

2.) Eine Kopie dieser Datei in /usr/src/packages/SOURCES legen (nicht entpacken)
3.) Das in dieser Datei enthaltene spec-file proftpd.spec nach /usr/src/packages/SPECS legen.
4.) rpmbuild -ba proftpd.spec im Verzeichnis /usr/src/packages/SPECS ausführen
5) Das fertige RPM aus /usr/src/packages/RPMS/[architektur] installieren.

Ist eigentlich gar nicht so schwer. Wenn das compilieren Abhängigkeiten benötigt, müssen diese mit YAST nachinstalliert werden.

Wenn dann alles wunderbar läuft kann man das startscript mittels

chkconfig proftpd on

dauerhaft beim Systemstart einbinden.

Rain_maker
23.10.06, 10:59
Da das tar.bz2 ein geeignetes spec-File enthält, geht der BUILD auch einfacher, namentlich direkt aus dem Tarball.


rpmbuild -ta /Pfad_zum_tar.bz2/proftpd-1.3.0.tar.bz2

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.94222
+ umask 022

-------snip ------- (*ratter ratter*)-----------------------

Checking for unpackaged file(s): /usr/lib/rpm/check-files /usr/src/packages/BUILD/proftpd-1.3.0-root
Wrote: /usr/src/packages/SRPMS/proftpd-1.3.0-1.src.rpm
Wrote: /usr/src/packages/RPMS/i586/proftpd-1.3.0-1.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/proftpd-inetd-1.3.0-1.i586.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.7835
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd proftpd-1.3.0
+ rm -rf /usr/src/packages/BUILD/proftpd-1.3.0-root
+ rm -rf /usr/src/packages/BUILD/proftpd-1.3.0
+ exit 0Voilà

Greetz,

RM