|
|
This public source tool allows to upload / download via HTTP IFS stream files to / from
an iSeries server.
1. Updates |
- Updates to this package are documented on
this page.
- To find out the release date of a FUPLOAD package installed on your IBM i,
run command FUPLOAD/RELEASED .
|
2. Installation
|
Download
Download it from the Easy400 site. Registration is required.
Prerequisites
- OS/400 V5R2 or subsequent
- Library QHTTPSVR (product 5722DG1)
- RPG-ILE compiler (just for the installation)
Installation procedure
- unzip the fupload.zip file you have downloaded.
It contains a readme.txt instructions file and file
fupload.savf
- crtsavf qgpl/fupload
- use FTP to load PC file fupload.savf
into save file qgpl/fupload
- rstlib fupload *savf savf(qgpl/fupload)
- to complete the installation, run the following
REXX procedure:
strrexprc srcmbr(install) srcfile(fupload/qrexsrc)
This procedures performs the following
- compiles modules, creates programs
- restores directory /fupload
- displays the stream file /fupload/conf/httpd.conf
containing the directives for an HTTP instance able to run this tool.
To install the HTTP instance, run command
cpyf fromfile(fupload/qatmhinstc) tofile(qusrsys/qatmhinstc)
frommbr(fuploadapa) tombr(fuploadapa)
mbropt(*replace) crtfile(*yes)
- To start the HTTP instance
strtcpsvr server(*http) httpsvr(fuploadapa)
|
3. Running the utilities
|
- To run the File Upload utilities, see this page.
- To run the File Download utility, see this page.
|
4. Protection
|
Most likely you will need to protect your file upload / download
service, in such a way that only authorized users may access it.
We have already provided for some basic protection,
based on the validation list "FUPLOADDT/FUPLOAD".
Should you feel unconfortable with validation lists
for protecting sensitive programs, may we recommend that you take a look at
a very popular Easy400 delivery: Work with Validation Lists.
Here is how you can easily take advantage of the existing
protection set up:
- run command
CHGSYSVAL SYSVAL(QRETSVRSEC) VALUE('1')
- create the following user profile:
crtusrprf usrprf(fupload) inlmnu(*signoff)
text('To implement file upload protection') aut(*use)
- enable HTTP protection directives:
- uncomment the following HTTP directives in the IFS stream file /fupload/conf/httpd.conf :
#<Location /fuploadp/*>
# AuthType Basic
# AuthName FILE_UPLOAD
# PasswdFile FUPLOADDT/FUPLOAD
# UserID FUPLOAD
# Require valid-user
#</Location> |
- STRTCPSVR SERVER(*HTTP) RESTART(*HTTP) HTTPSVR(FUPLOADAPA)
- Validation list FUPLOADDT/FUPLOAD is delivered
with a single entry:
user name: |
fred |
password: |
fred |
You may want to take advantage of this
to test our basic protection.
- use command "fupload/wrkvldle"
to maintain the validation list
"FUPLOADDT/FUPLOAD":
Wrk with a vldl entry (WRKVLDLE)
Type choices, press Enter.
action . . . . . . . . . . . . . *ADD, *CHG, *RMV
user name for logon . . . . . .
password for logon . . . . . . .
'user full name' . . . . . . . .
validation list . . . . . . . . FUPLOAD Name
library . . . . . . . . . . . FUPLOADDT Name, *LIBL, *CURLIB
|
This command also maintains database file
"FUPLOADDT/USERS"
that can be used for a local customized version of an upload program.
- If you want to create a customized tool for maintaining
authorized users:
- review ILE-RPG module
"wrkvldle"
- note that program
"fupload"
retrieves the logged-in user name in variable
"UserName".
- program
"fuploadX"
can be added a routine to make sure that the logged-in user ("UserName")
is authorized to the IFS target
directory (variable "ServerDir")
|
5. HTTP access to the uploaded files
If you want to enable the HTTP access to the uploaded files
(as an example, the files in the IFS directory /sales/2012)
you must:
- grant *public authority for the objects, like
CHGAUT OBJ('/sales') USER(*PUBLIC) DTAAUT(*RX)
CHGAUT OBJ('/sales/2012') USER(*PUBLIC) DTAAUT(*RX)
CHGAUT OBJ('/sales/2012/*') USER(*PUBLIC) DTAAUT(*RX)
- provide some HTTP directives to the configuration file of the HTTP instance.
The following example shows how to enable access to the files uploaded to IFS directory
/sales/2012 :
Alias /sales/ /sales/
<Directory /sales>
Options None
order allow,deny
allow from all
</Directory> |
If you also want to restrict the access to the only people authorized to upload PC files, use the following HTTP directives instead:
Alias /sales/ /sales/
<Directory /sales>
AuthType Basic
AuthName RESTRICTED_MATERIAL
PasswdFile FUPLOADDT/FUPLOAD
UserID FUPLOAD
Require valid-user
</Directory> |
|
|
|