<?xml version="1.0"?>
-<Opengate ConfigVersion="1.5.0">
+<Opengate ConfigVersion="1.5.13">
<!-- #################################################
####### NEED TO MODIFY FOLLOWING PARAMETERS ##### -->
## Authentication servers (can set multiple servers) ##
## REFER document at the end of this file ## -->
- <AuthServer>
- <Protocol>pop3s</Protocol>
+ <AuthServer>
+ <Protocol>pop3s</Protocol>
<Address>192.168.0.2</Address>
- </AuthServer>
+ </AuthServer>
<!-- ##########################################################
#### usually, need not to modify following parameters #### -->
</AuthServer>
# The user is accepted or denied without inquiry.
# This setting is prepared for debugging.
+
+ #### TYPE 6 (Shibboleth) ####
+ <AuthServer>
+ <Protocol>shibboleth</Protocol>
+ <UidAttribute>-uid-env-var-</UidAttribute>
+ </AuthServer>
+
+ # Auth by Shibboleth
+ # Set 'opengatesrv.cgi/opengateauth.cgi' as SHIB-AUTH in .htaccess
+ # <FILES opengateauth.cgi>
+ # AuthType shibboleth
+ # ShibRequestSetting requireSession 1
+ # ShibRequireSession On
+ # ShibUseHeaders On
+ # require valid-user
+ # </FILES>
+ # <FILES opengatesrv.cgi>
+ # AuthType shibboleth
+ # ShibRequestSetting requireSession 1
+ # ShibRequireSession On
+ # ShibUseHeaders On
+ # require valid-user
+ # </FILES>
+ # 'UidAttiribute' means the environment variable for UserId
+
+ #### TYPE 7 (Http Basic) ####
+ <AuthServer>
+ <Protocol>httpbasic</Protocol>
+ </AuthServer>
+
+ # Auth by http-basic
+ # Set 'opengatesrv.cgi' as BASIC-AUTH in .htaccess
+ # <FILES opengatesrv.cgi>
+ # AuthType Basic
+ # AuthUserFile /tmp/passwd.dat
+ # AuthName "User"
+ # require valid-user
+ # </FILES>
+ # environment variable REMOTE_USER is used for userid
-->
<!-- ######## Examples of Auth Server Setting ##############
Ver.1.5.12 at 2011.6.16
</DT><DD>
Fixed error on reconnecting [contributed by S.Horikawa].
+ </DD><DT>
+ Ver.1.5.13 at 2011.9.29
+ </DT><DD>
+ Added Shibboleth/HttpBasic authentication.
</DD>
</DL>
<P>
align=center bgColor=lightyellow border=1>
<TR><TD>
<p align=center><a href="%%STARTURL%%" target=_blank>
-<b>NEXT ></b></a></p>
+<b>Portal Site ></b></a></p>
</TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=10
align=center bgColor=lightyellow border=1>
<TR><TD>
-<p align=center><a href="%%STARTURL%%" target=_blank>NEXT ></a></p>
+<p align=center><a href="%%STARTURL%%" target=_blank>Portal Site ></a></p>
</TD></TR>
</TABLE>
</p>
-<HTML>
-<link rel="shortcut icon" href="/opengate/favicon.ico" type="image/x-icon">
-<link rel="icon" href="/opengate/favicon.ico" type="image/x-icon">
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
-<HEAD>
-<TITLE>Opengatemain</TITLE>
-</HEAD>
-<BODY>
-You are authenticated. You can use the network.
-<P>
-<P>
-Your authentication is valid until you quit your browser.
-Do not forget to close your WEB brower when you have finished using the network.
-</P>
-
-<HR>
-<P>Saga university related sites</P>
-<A HREF="http://www.saga-u.ac.jp/">Official Page</A>
-<A HREF="http://www.cc.saga-u.ac.jp/">Computer and Network Center</A>
-(<A HREF="http://webmailer.cc.saga-u.ac.jp/">WebMailer</A>)
-<A HREF="http://www.domino.lib.saga-u.ac.jp/">University Library</A>
-<A HREF="http://job.admin.saga-u.ac.jp/">Job Consultant</A>
-</P>
-<HR>
-<P>Search Engines and Potal sites</P>
-<a href="http://www.yahoo.co.jp/">Yahoo! Japan</a>
-<a href="http://www.google.com/">Google</a>
-<a href="http://www.excite.co.jp/">Exite Japan</a>
-<a href="http://www.goo.ne.jp/">Goo</a>
-<a href="http://www.infoseek.co.jp/">Infoseek</a>
-<a href="http://www.ocn.ne.jp/">OCN</a>
-<a href="http://www.msn.co.jp/">MSN</a>
-<a href="http://www.fresheye.com/">Fresheye</a>
-<a href="http://www.livedoor.com/">Livedoor</a>
-<a href="http://www.isize.com/">ISIZE</a>
-
-</BODY>
+<?php
+$RedirectURL = "Location: " . "https://www.cc.saga-u.ac.jp/redirect/";
+header("$RedirectURL");
+?>
Click below button to create a new window for browsing.</p>
<FORM onclick='window.open("%%STARTURL%%")'>
-<div align=center><INPUT TYPE="button" VALUE=" NEXT > "></div>
+<div align=center><INPUT TYPE="button" VALUE=" Portal Site > "></div>
</FORM>
<noscript>
-<p align=center><a href="%%STARTURL%%" target=_blank>NEXT></a></p>
+<p align=center><a href="%%STARTURL%%" target=_blank>Portal Site></a></p>
</noscript>
<P align=center>
<P>If you do not need IPv4/IPv6 dual stack support, use one of the following links. This way, the system will only controls either IPv4 or IPv6.
</P>
<P>
-<a href="https://%%AUTHCGIURL%%?addr=0-0-0&lang=en">Network Authentication</a>
-<a href="http://%%AUTHCGIURL%%?addr=0-0-0&lang=en">Network Authentication(Unuse SSL)</a>
+<a href="https://%%AUTHCGIURL%%?0-0-0&en">Network Authentication</a>
+<a href="http://%%AUTHCGIURL%%?0-0-0&en">Network Authentication(Unuse SSL)</a>
</P>
</SMALL>
</BODY>
<P>
If you cannot move to the page automatically, click the following.
<P>
-<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication</a><br>
-<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication(Unuse SSL)</a>
+<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication(SSL)</a><br>
+<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication(NonSSL)</a>
<hr>
Saga University
</BODY>
-<html>
+<html>
<head>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
align=center bgColor=lightyellow border=1>
<TR><TD>
<p align=center><a href="%%STARTURL%%" target=_blank>
-<b>次へ ></b></a></p>
+<b>ポータルサイトの表示 ></b></a></p>
</TD></TR>
</TABLE>
-<html>
+<html>
<head>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
-<HTML>
-<link rel="shortcut icon" href="/opengate/favicon.ico" type="image/x-icon">
-<link rel="icon" href="/opengate/favicon.ico" type="image/x-icon">
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
-<HEAD>
-<TITLE>Opengatemain</TITLE>
-</HEAD>
-<BODY>
-利用者認証が通りました。ネットワークを利用できます。
-<P>
-<P>
-Webブラウザが終了したときに、ネットワーク利用許可も自動的に取り消されます。悪用されないために、利用が終ったら必ずWebブラウザを終了してください。
-</P>
-
-<HR>
-<P>佐賀大学関係サイト</P>
-<A HREF="http://www.saga-u.ac.jp/">大学公式ページ</A>
-<A HREF="http://www.cc.saga-u.ac.jp/">総合情報基盤センターのページ</A>
-(<A HREF="http://webmailer.cc.saga-u.ac.jp/">ウェブメイラー</A>)
-<A HREF="http://www.lib.saga-u.ac.jp/">大学附属図書館のページ</A>
-<A HREF="http://job.admin.saga-u.ac.jp/">大学就職相談室のページ</A>
-<A HREF="http://www.sagadirect.net/index.php">SAGAダイレクト</A>
-</P>
-<HR>
-<P>検索エンジン&ポータルサイト</P>
-<a href="http://www.yahoo.co.jp/">Yahoo! Japan</a>
-<a href="http://www.google.com/">Google</a>
-<a href="http://www.excite.co.jp/">Exite Japan</a>
-<a href="http://www.goo.ne.jp/">Goo</a>
-<a href="http://www.infoseek.co.jp/">Infoseek</a>
-<a href="http://www.ocn.ne.jp/">OCN</a>
-<a href="http://www.msn.co.jp/">MSN</a>
-<a href="http://www.fresheye.com/">Fresheye</a>
-<a href="http://www.livedoor.com/">Livedoor</a>
-<a href="http://www.isize.com/">ISIZE</a>
-
-</BODY>
+<?php
+$RedirectURL = "Location: " . "https://www.cc.saga-u.ac.jp/redirect/";
+header("$RedirectURL");
+?>
\ No newline at end of file
-<HTML>
+<HTML>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
-<html>
+<html>
<head>
<link rel="shortcut icon" href="http://%%OPENGATESERVERNAME%%%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="http://%%OPENGATESERVERNAME%%%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<script type="text/JavaScript" src="%%MD5JSURL%%"></script>
</head>
+<style TYPE="text/css">
+<!--
+.button {font-size:16pt;}
+-->
+</style>
<body onunload="endHttpkeep();">
このページを移動したり閉じたりすると、ネットワークが閉鎖されます。<p>
<P align=center>
-Webの利用には下のボタンを押して表示される別ウインドウを使ってください。
+Webの利用には下のボタンを押して表示されるポータルサイトを使ってください。
</p>
<FORM onclick='window.open("%%STARTURL%%")'>
- <div align=center><INPUT TYPE="button" VALUE=" 次 へ > "></div>
+<div align=center><INPUT TYPE="button" VALUE="ポータルサイトの表示" class="button"></div>
</FORM>
</p>
<p>上の2本の線の間に[Error!]が表示されたときは、別のページを利用してください。動作がおかしい時はブラウザを終了してから再試行してください。また認証画面の利用時間フィールドに値をいれると、その時間だけ使用することができます。
</p>
+
<script type="text/JavaScript">
//<!--
window.open("%%STARTURL%%","window1");
-<html>
+<html>
<head>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<b>以下は、切断が頻発して利用継続できない場合に限って設定して下さい
(推奨されません)。</b><br>
必要とする利用継続時間: <input type="TEXT" size="4" name="duration" value="Auto">
-分(指定可能:1~%%DURATIONMAX%%分)。
+分(指定可能:1〜%%DURATIONMAX%%分)。
この時間が経過するまで、ネットワークをあなたの利用資格で開放しています。
あなたが去った後で他人が不正利用すると、それに伴うトラブルに巻き込まれます。
指定した時間より前に利用を終わるには、許可ページにある「利用中断」のリンクを
-<html>
+<html>
<head>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<b>以下は、切断が頻発して利用継続できない場合に限って設定して下さい
(推奨されません)。</b><br>
必要とする利用継続時間: <input type="TEXT" size="4" name="duration" value="Auto">
-分(指定可能:1~%%DURATIONMAX%%分)。
+分(指定可能:1〜%%DURATIONMAX%%分)。
この時間が経過するまで、ネットワークをあなたの利用資格で開放しています。
あなたが去った後で他人が不正利用すると、それに伴うトラブルに巻き込まれます。
指定した時間より前に利用を終わるには、許可ページにある「利用中断」のリンクを
-<HTML>
+<HTML>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
以下のリンクも使用できますが、IPv4とIPv6のどちらか一方のみを制御します。
</P>
<P>
-<a href="https://%%AUTHCGIURL%%?addr=0-0-0&lang=ja">ネットワーク利用者認証</a> <a href="http://%%AUTHCGIURL%%?addr=0-0-0&lang=ja">ネットワーク利用者認証(SSL非対応)</a>
+<a href="https://%%AUTHCGIURL%%?0-0-0&ja">ネットワーク利用者認証</a> <a href="http://%%AUTHCGIURL%%?0-0-0&ja">ネットワーク利用者認証(SSL非対応)</a>
</P>
</SMALL>
</BODY>
-<html>
+<html>
<head>
<link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
<link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
</HEAD>
<BODY onload="document.form1.submit();">
-<P align=CENTER>
-ネットワークが閉鎖しました。再開放を確認します。<BR>
-自動移動できない方は下のボタンをクリックして下さい。
-</P>
-
<TABLE align=CENTER>
<TR><TD>
<FORM NAME="form1" METHOD="POST" ACTION="%%PROTOCOL%%://%%CGIURL%%">
-<HTML>
+<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<P>
自動移動できない方はこちらをクリックして下さい。
<P>
-<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証</a><br>
-<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証(SSL非対応)</a>
+<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証(SSL)</a><br>
+<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証(NonSSL)</a><br>
<HR>
佐賀大学
</BODY>
clean:
rm -f ${MAINPROG} ${AUTHPROG} ${FWDPROG} ${TESTPROGS} ${CLEANFILES}
${MAKE} clean -C ../ezxml
+ rm -f ../*/*~ ../*~ ../*/*/*~
install: del-lockfile install-cgi install-html install-conf
int authResult;
int timeout;
- /* if no userid or no passwd, then deny */
- //if(userid[0]=='\0')return DENY;
- //if(passwd[0]=='\0')return DENY;
-
/* authserver get timeout value */
timeout=atoi(GetConfValue("AuthServer/Timeout"));
/* authenticate by ftps-implicit */
authResult=AuthFtpsi(userid, passwd);
+ }else if(strcmp(proto, "shibboleth")==0){
+ /* deny all request */
+ /* if shibboleth auth is accepted, cannot reach at this point */
+ authResult=DENY;
+
+ }else if(strcmp(proto, "httpbasic")==0){
+ /* deny all request */
+ /* if httpbasic auth is accepted, cannot reach at this point */
+ authResult=DENY;
+
}else if(strcmp(proto, "deny")==0){
/* deny all request */
authResult=DENY;
Programmed by Yoshiaki WATANABE
Modified by Shin-ichi TADAKI
Modified by Katsuhiko Eguchi
+Modified by Makoto Otani
**************************************************/
#include "opengatesrv.h"
/********************************************/
+/* get userid from environment variable */
+/********************************************/
+int getUserIdFromEnv(char *userid){
+
+ int ret=FALSE;
+
+ /* if shibboleth or httpbasic, get uid from environment var */
+ if(strcmp(GetConfValue("AuthServer/Protocol"), "shibboleth")==0){
+ if(!isNull(getenv(GetConfValue("AuthServer/UidAttribute")))){
+ strncpy(userid,getenv(GetConfValue("AuthServer/UidAttribute")),USERMAXLN);
+ ret=TRUE;
+ }else{
+ err_msg("ERR at %s#%d: Cannot get user info from shibboleth",__FILE__,__LINE__);
+ ret=FALSE;
+ PutClientMsg("Cannot get user info from shibboleth<br>Check shibboleth setting in .htaccess and other");
+ exit(0);
+ }
+ }
+ else if(strcmp(GetConfValue("AuthServer/Protocol"), "httpbasic")==0){
+ if(!isNull(getenv("REMOTE_USER"))){
+ strncpy(userid,getenv("REMOTE_USER"),USERMAXLN);
+ ret=TRUE;
+ }else{
+ err_msg("ERR at %s#%d: Cannot get user info from httpbasic",__FILE__,__LINE__);
+ ret=FALSE;
+ PutClientMsg("Cannot get user info from http basic<br>Check http basic setting in .htaccess and other");
+ exit(0);
+ }
+ }
+ return ret;
+}
+
+/********************************************/
/* get data related to cookie from client */
/********************************************/
int getCookieData(char *userid, char *clientAddr4, int *duration, int *durationEntered, char *language)
return ret;
}
+int GetUserIdFromEnv(char *userid){
+ int ret;
+ if(debug>1) err_msg("DEBUG:=>getUserIdFromEnv(%s)",userid);
+ ret=getUserIdFromEnv(userid);
+ if(debug>1) err_msg("DEBUG:%d<=getUserIdFromEnv(%s)",ret,userid);
+ return ret;
+}
+
void PutClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, int durationEntered, char *language, char *cookie, int cookieAuth, char *redirectedUrl)
{
if(debug>1) err_msg("DEBUG:=>putClientAccept(%s,%s,%d,%d,%s,%s,%d,%d,%d,%s,%s,%d,%s)",userid,sessionId,port,pid,clientAddr4,clientAddr6,ipStatus, duration, durationEntered, language, cookie, cookieAuth, redirectedUrl);
#include "opengatesrv.h"
#include "../ezxml/ezxml.h"
-#define CONFIG_VERSION "1.5.0"
+#define CONFIG_VERSION "1.5.13"
#define SEPARATOR "/"
int debug=0;
int selectNextAuthServer(void){
ezxml_t xmlTmp; /* temporary variable */
-
+
/* first call (initialize) */
/* xmlAuthPointer is the static variable to save authserver pointer */
if(xmlAuthServer==NULL){
}
/* if not found return False */
- if(xmlAuthServer==NULL) return FALSE;
- else return TRUE;
+ if(xmlAuthServer==NULL){
+ return FALSE;
+ }else{
+ return TRUE;
+ }
+}
+
+/**********************************************
+reset pointer for auth server list
+**********************************************/
+void resetAuthServerPointer(void){
+ xmlAuthServer=NULL;
}
/***********************************************/
return ret;
}
+void ResetAuthServerPointer(void){
+ if(debug>1) err_msg("DEBUG:=>resetAuthServerPointer( )");
+ resetAuthServerPointer();
+ if(debug>1) err_msg("DEBUG:<=resetAuthServerPointer( )");
+}
int authResult=DENY;
int authNum=1; /* present authserver number to check user */
int cookieAuth=FALSE; /* Auth with HTTP-Cookie is passed */
+ int isUidInEnv=FALSE; /* userid is included in environment (shibb/basic) */
/* drop root privilege */
seteuid(getuid());
return 0;
}
+ /* get userid from environment var(available on shbboleth or httpbasic) */
+ isUidInEnv=GetUserIdFromEnv(userid);
+
/* try to authentication with cookie data, */
/* if cookie auth is enabled. */
if( (*GetConfValue("EnableCookieAuth")!='0') ){
GetMacAddr(clientAddr4, macAddr4, clientAddr6, macAddr6,ipStatus);
/* check user by authenticate servers */
- if(cookieAuth) authResult=ACCEPT;
+ if(cookieAuth||isUidInEnv) authResult=ACCEPT;
else{
+ ResetAuthServerPointer();
while(SelectNextAuthServer()){
/* authenticate the user with authentication servers */
char *value[1];
char *next[1];
char *ptr;
+ char *authProtocol;
/* keyword pairs */
/* the left key is replaced by the right value */
sprintf(htmlFile, "%s%s/%s/", GetConfValue("DocumentRoot"),
opengateDir, lang);
- /*** if http-cookie for opengate authentication exist */
- /* and cookie auth is enabled, */
+ /*** if http-cookie exists or auth by shibboleth/httpbasic */
/* skip authenticaion */
- if( (*GetConfValue("EnableCookieAuth")!='0')
- && GetAuthCookie(cookie,userid)){
+ authProtocol=GetConfValue("AuthServer/Protocol");
+ if(((*GetConfValue("EnableCookieAuth")!='0') && GetAuthCookie(cookie,userid))
+ || strcmp(authProtocol, "shibboleth")==0
+ || strcmp(authProtocol, "httpbasic")==0 ){
+
strncat(htmlFile, GetConfValue("SkipAuthDoc"), BUFFMAXLN);
/* ssl or non-ssl protocol */
void PutClientMsg(char *message);
void PutClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, int durationEntered, char *language, char *cookie, int cookieAuth, char *redirectedUrl);
void split(char content[], char *name[], char *value[], char *next[]);
+int GetUserIdFromEnv(char *userid);
/* db interface*/
int PutSessionBeginToDb(char* cookie, char* userid,
int AddrEncode(char encodeAddr[], char dotSepAddr[]);
int AddrDecode(char dotSepAddr[], char encodeAddr[]);
-/* replace keywords in html document */
+/* htmltemplate.c */
int HtmlTemplate(char* filename,struct html_key* key);
int htmlReplace(char* buff,char *before,char *after);
char* strSplit(char* str,const char* delimStr);
+/* get-param.c */
int OpenConfFile(void);
void CloseConfFile(void);
void SetupConfExtra(char *userId, char *extraId);
int SelectNextAuthServer(void);
void InitConf();
int RegExMatch(const char *inStr, const char *regEx);
+void ResetAuthServerPointer(void);
+/* ctrl-alarms.c */
int AddAlarm(char *name, int timeout, int preceding, Sigfunc *func);
int RemoveAlarm(char *name);
int EnableAlarm(void);