[LON-CAPA-users] IP address of student submission

Raeburn, Stuart raeburn at msu.edu
Tue Aug 20 07:55:09 EDT 2019


GS,

>
> Any advice on using $env ?
>

The value of $ENV{'REMOTE_ADDR'}  is stored in $env{'request.host'} as part of session initialization when a user logs-in to LON-CAPA.  

Within a problem script you could retrieve the value set in $env{'request.host'} using an &EXT() call, e.g.,

$ip = &EXT('request.host');

However, $env{'request.host'} is only set at log-in time, and once a user's browser has a LON-CAPA session cookie, the same browser could connect to the same LON-CAPA server from a different IP address (e.g., by changing WiFi network) and the current $ENV{'REMOTE_ADDR'} would differ from $env{'request.host'}.

Because of that, $ENV{'REMOTE_ADDR'} is used internally by LON-CAPA instead of  $env{'request.host'} whenever IP checking is needed, as is the case where access to resources is being restricted by IP address, e.g., the acc parameter (Client IP/Name Access Control) is set, or slots (with IP restrictions) are in use.

A modification is needed to /home/httpd/lib/perl/Apache/lonnet.pm to allow the value of $ENV{'REMOTE_ADDR'} to be retrieved via an &EXT(() call in a loncapa perl script block. 

See the changes shown in: mail.lon-capa.org/pipermail/lon-capa-cvs/Week-of-Mon-20190819/028747.html
which support retrieval of the value with a call to: &EXT('client.remote_addr') in a script block.

Policies on privacy may apply at an institution regarding access to a user's IP address, e.g., for compliance with GDPR.  In the future, an option will be added to the LON-CAPA domain configuration, such that a user's preferences can include either an opt-in or an opt-out for storage of the user's IP address. 

>
> $timestamp=time();
>

Notes:

1. The approved method to access the current UNIX time from a script block is to call:

&EXT('system.time')

2 .If a LON-CAPA instance has been set up to use a reverse proxy, then $ENV{'REMOTE_ADDR'} will record the IP address of the reverse proxy, instead of the remote IP address of the client.  In such cases $ENV{HTTP_X_FORWARDED_FOR} may include the original client IP address. 

The value of the X-Forwarded-For request header is a comma separated string of IP addresses:

<client>, <proxy1>, <proxy2>

where <client> is the remote IP address, and <proxy1> (and optionally <proxy2>) are IP address(es) of intermediate prox(ies).  In order for the value of <client>to be reliable, <proxy1> (and optionally <proxy2>) must be IP addresses of trusted proxy server(s).  Institutional policies on privacy may apply to use of information from $ENV{HTTP_X_FORWARDED_FOR}.

Stuart Raeburn
LON-CAPA Academic Consortium

________________________________________
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> on behalf of SIMIN, GRIGORY <SIMIN at engr.sc.edu>
Sent: Monday, August 19, 2019 6:08 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] IP address of student submission

Stuart,
Any advice on using $env ?
I tried including it in my script as follows

$timestamp=time();
$Time=localtime();
$IP=$ENV{'REMOTE_ADDR'};

However it did not work.
Timestamp and local time are displayed correctly
$IP was not assigned any value.
Thanks,
GS

-----Original Message-----
From: LON-CAPA-users [mailto:lon-capa-users-bounces at mail.lon-capa.org] On Behalf Of Raeburn, Stuart
Sent: Monday, August 19, 2019 17:49
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] IP address of student submission

GS,

Currently the IP address shown in LON-CAPA in grade details is the stored IP address of the remote client from which the submission was made.  The IP address recorded in the submission transaction for each student is the value of: $ENV{'REMOTE_ADDR'}.  Note: a situation where that IP address will be a LON-CAPA server's own IP address is when you are viewing grade details for transactions resulting from bubblesheet grading (of a printed exam), by a Course Coordinator.

The IP address might also be different from a student's actual IP address if students at your institution use an institutional VPN,  or a proxy for web access to your LON-CAPA instance.

Stuart Raeburn
LON-CAPA Academic Consortium
________________________________________
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> on behalf of SIMIN, GRIGORY <SIMIN at engr.sc.edu>
Sent: Monday, August 19, 2019 5:13 PM
To: Discussion list for LON-CAPA users
Subject: [LON-CAPA-users] IP address of student submission

All,
Is there a way to check the IP address of a machine that student submitted the answer from?
In the grade details I can see the host name and the IP address, which is not the user IP address but the IP address of the LON-CAPA server.
Being able to track the student IP address would be very helpful to prevent cheating. Some students these days simply allow paid "ghosts" to login and solve the problems for them.

Thank you all,
GS
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__protect2.fireeye.com_url-3Fk-3D40c30202-2D1c513955-2D40c34cc3-2Dac1f6b0e67e4-2De219c5328f1cc789-26q-3D1-26u-3Dhttps-253A-252F-252Furldefense.proofpoint.com-252Fv2-252Furl-253Fu-253Dhttp-2D3A-5F-5Fmail.lon-2D2Dcapa.org-5Fmailman-5Flistinfo-5Flon-2D2Dcapa-2D2Dusers-2526d-253DDwICAg-2526c-253DnE-5F-5FW8dFE-2DshTxStwXtp0A-2526r-253DVsGo3jOm8tGLd6f-2DKlhT-2Dg-2526m-253DVJwZXH9WVorK7sD-2DyOjgs2GjMUO8PDKpjiIBxDWm4ik-2526s-253DjVp7Wx-2DhMDUq0A5zopNnKHLKN3Cd1f-2D7znIbW-2DZrocM-2526e-253D&d=DwICAg&c=nE__W8dFE-shTxStwXtp0A&r=VsGo3jOm8tGLd6f-KlhT-g&m=D-GiYyrbDvL7kTIdfyVgJAQDOGqIwGo2P9OnQX4nK50&s=QzCPK_685F2S8bix0Swe6QWoNW5j7Po690X4jzO6YOY&e=
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__protect2.fireeye.com_url-3Fk-3Ddcc76de5-2D805556b2-2Ddcc72324-2Dac1f6b0e67e4-2D2958c9bd566926a9-26q-3D1-26u-3Dhttp-253A-252F-252Fmail.lon-2Dcapa.org-252Fmailman-252Flistinfo-252Flon-2Dcapa-2Dusers&d=DwICAg&c=nE__W8dFE-shTxStwXtp0A&r=VsGo3jOm8tGLd6f-KlhT-g&m=D-GiYyrbDvL7kTIdfyVgJAQDOGqIwGo2P9OnQX4nK50&s=Thx7FHijIrTdko-W272JHcwTfen-ls1Ov4cAH8gCMns&e=
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.lon-2Dcapa.org_mailman_listinfo_lon-2Dcapa-2Dusers&d=DwICAg&c=nE__W8dFE-shTxStwXtp0A&r=VsGo3jOm8tGLd6f-KlhT-g&m=D-GiYyrbDvL7kTIdfyVgJAQDOGqIwGo2P9OnQX4nK50&s=QOlWViQk7gzec3IYd2AbkycvO3i3_fwsq3B6d4Z-jBo&e=


More information about the LON-CAPA-users mailing list