This script carries out the necessary for setting up a safe anonymous ftp server on a sun workstation running SunOS4.1.
#!/local/gnu/bin/cfengine -f ############################################################## # # Cfengine script to set up an outgoing ftp server under # SunOS 4.1.*. Suitable for anonymous access. # ############################################################### control: addclasses = ( local global ) actionsequence = ( editfiles.global directories shellcommands files editfiles.local ) ftp_root = ( /oih/saga/local/ftp ) # macro for convenience ftp_id = ( 99 ) # uid/gid for ftp ################################################################ editfiles: # Note the file /etc/ftpusers can contain a list of users # who can NOT use ftp to access files. global:: { /etc/passwd AppendIfNoSuchLine "ftp:*:$(ftp_id):$(ftp_id): (line continues) Anonymous ftp:$(ftp_root):/usr/ucb/ftp" } { /etc/group AppendIfNoSuchLine "ftp:*:$(ftp_id):" } ################################################################ directories: $(ftp_root) mode=0555 owner=ftp $(ftp_root)/pub mode=0555 owner=ftp $(ftp_root)/bin mode=0555 owner=root $(ftp_root)/usr mode=0555 owner=root $(ftp_root)/dev mode=0555 owner=root $(ftp_root)/etc mode=0555 owner=root $(ftp_root)/dev mode=0555 owner=root $(ftp_root)/usr/lib mode=0555 owner=root ############################################################### shellcommands: "/bin/cp /bin/ls $(ftp_root)/bin/ls" "/bin/cp /lib/libc.so.1.8* $(ftp_root)/usr/lib" "/bin/cp /usr/lib/ld.so $(ftp_root)/usr/lib" "/bin/cp /usr/lib/libdl.so.1.0 $(ftp_root)/usr/lib/libdl.so.1.0" "/usr/etc/mknod $(ftp_root)/dev/zero c 3 12 > /dev/null 2>&1" ########################################################################## files: $(ftp_root)/bin/ls mode=111 owner=root action=fixall $(ftp_root)/usr/lib mode=555 owner=root action=fixall r=1 $(ftp_root)/etc/passwd mode=444 owner=root action=touch $(ftp_root)/etc/group mode=444 owner=root action=touch $(ftp_root)/pub mode=644 owner=root action=fixall ################################################################ editfiles: local:: { $(ftp_root)/etc/passwd AppendIfNoSuchLine "ftp:*:$(ftp_id):$(ftp_id): (line continues) Anonymous ftp:$(ftp_root):/usr/ucb/ftp" } { $(ftp_root)/etc/group AppendIfNoSuchLine "ftp:*:$(ftp_id):" }
Go to the first, previous, next, last section, table of contents.