發表文章

目前顯示的是 6月, 2017的文章

drupal簡潔網址設定

簡潔網址要怎麼設定?看了網路上的一些參考資料有點迷糊了!這裡簡單敘述一下該怎麼做? cd /etc/apache2 sudo nano apache.conf 修改裡面的Directory <Directory /var/www/>  …  AllowOverride None  … </Directory> 改成 <Directory /var/www/>  …  AllowOverride All  … </Directory> 好了以後 查看rewrite_mod是否有開啟? apache2ctl -M 或 apachectl -M 沒有看到rewrite_mod要輸入以下指令讓它開啟 a2enmod rewrite 再回到Drupal資料夾,將.htaccess檔案裡# RewriteBase / 井字拿掉,沒有Domain在斜線後加上資料夾名稱,有Domain斜線後面空著,重啟apache即可。(不一定要設定這部分)

Drupal移機

將系統檔與sql搬移至新主機,把setting.php刪掉,輸入對應的網址,會自動進入安裝畫面,按照新主機的資訊輸入,即可完成,直接進入首頁。

查詢Ubuntu目前啟用的服務

service --status-all

停啟用SSL

 啟用 sudo a2enmod ssl 停用 How to Disable SSL? sudo a2dismod ssl sudo a2dissite default-ssl sudo service apache2 restart 功能設定檔 啟用/停用 : a2enconf / a2disconf 模組 啟用/停用 : a2enmod / a2dismod 網站 啟用/停用 : a2ensite / a2dissite

主機分散風險管理

資料庫與網頁DATA分別存放於兩台伺服器,其中Mysql的設定,如何允許外部網頁服務取得資料庫存取權? 查詢3306 port是開放狀態可使用以下指令查詢 netstat -ntlp | grep LISTEN 剛架好的伺服器,預設是會開啟的,再來更改MySQL設定檔 sudo nano /etc/mysql/my.cnf or sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf 找到 bind-address = 127.0.0.1,把ip位置改掉,通常兩台伺服器內網是可通聯的,改為本機內部ip位置即可,以內部ip取用較為安全。 Mysql使用者帳號的權限,主機名稱要設為%,如果覺得%太危險,可設定為指定主機ip或是localhost。

Ubuntu16.04 安裝Drush 相關套件

以drush下載drupal主程式出現  Directory /home/user/.drush/cache/default exists, but is not writable. Please check directory           [error] permissions. PHP Fatal error:  Uncaught Error: Call to undefined function simplexml_load_file() in /usr/share/php/drush/commands/pm/release_info/updatexml.inc:402 Stack trace: #0 /usr/share/php/drush/commands/pm/release_info/updatexml.inc(45): updatexml_get_release_history_xml(Array) #1 /usr/share/php/drush/commands/pm/download.pm.inc(92): release_info_fetch(Array, '', 'auto', false) #2 /usr/share/php/drush/includes/command.inc(334): drush_pm_download('drupal') #3 /usr/share/php/drush/includes/command.inc(208): _drush_invoke_hooks('pm-download', Array, 'pm') #4 /usr/share/php/drush/includes/command.inc(175): drush_command('drupal') #5 /usr/share/php/drush/drush.php(92): drush_dispatch(Array) #6 /usr/share/php/drush/drush.php(61): _drush_bootstrap_and_dispatch() #7 /usr/share/php/drush/drush.php(...

學校Moodle平台以openLDAP部屬管理帳號策略

每學期開學該做的事情: 1.建立好新生的帳號於LDAP伺服器 2.將舊生班級、座號、學年度更新 3.將轉學生做上標記,在Moodle上以此標記篩選出來停用 4.建立好班級,以學年度為單位,下學期需再做一次調整 5.新學年度則將班級開設新的架構,上一學年度則可保留至上學年的課程 缺點:課程會越開越多,DATA則會吃掉越來越多伺服器的空間 優點:管理起來學生名單比較單純,只有該學年度之學生

LDAP與AD之對應欄位

Name in AD LDAP Name (header in CSV file) First Name givenName Middle Name / Initials initials Last Name sn Logon Name userPrincipalName Logon Name (Pre Windows 2000) sAMAccountName Display Name displayName Full  Name name/cn Description description Office physicalDeliveryOfficeName Telephone Number telephoneNumber Email mail Web Page wWWHomePage Password password Street streetAddress PO Box postOfficeBox City l State/Province st Zip/Postal Code postalCode Country  co Country 2 Digit Code - eg. US c Country code -eg. for US country code is 840 countryCode Group memberOf Account Expires (use same date format as server) accountExpires User Account Control  userAccountControl Profile Path profilePath Login Script scriptPath Home Folder homeDirectory Home Drive homeDrive Log on to userWorkstations Home homePhone Pager pager Mobile mobile Fax facsimileTelephoneNumber IP Phone ipPhone Notes info Title title Department department Company co...

用openLDAP來做Moodle帳號管理

在Moodle的網站管理輸入LDAP搜尋,找到使用一個LDAP伺服器,將其啟用。 輸入主機網址,輸入可區辨的名稱(base_dn),以及密碼。 用戶類型使用posixAccount(rfc2307bis)。 情境輸入使用者群的ou位置,搜尋子條件選擇是(我是在使用者群裡再分群所以選是)。 用戶屬性輸入cn,密碼格式選擇MD5加密。 其他欄位可以依所好新增對應。 即可成功連線。 原有想過以S牌NAS來架設LDAP,因為想要有停用功能,但經過測試後,其停用功能僅限於該系統內部,停用後,在moodle平台上,還是能以停用後的帳號登入,就此作罷。

安裝Moodle

資料庫設定好後,開始安裝,會遇到php套件擴展的問題,看缺什麼安裝一下就好了 php-curl、php-zip、php-xmlrpc、php-soap、php-intl

OpenLDAP帳號管理

帳號管理,以表格的方式來製作會比較方便,但要輸入至LDAP伺服器裡時,卻只能以ldif及LDAP格式的xml匯入,此時,我們需要的是一個轉檔程式,能夠將csv格式的檔案轉製成ldif。 一開始,登入phpLDAPadmin後,先找到帳號的類別(底下即為帳號群),將其匯出為csv,編輯csv檔,先將'|'替換為',',可輸入sed -i 's/ | /,/g' sample.csv。 再將帳號類別的列位刪除,只屬於帳號類別的欄位也刪除,隨後將objectclass欄位底下的資料拆開,也加上objectclass的標題。 好了以後再使用轉檔程式 csv2ldif ,使用AddData2.pl(輸入perl ./AddData2.pl,出現Name of file to be converted from CSV to LDIF 'Add' File:輸入檔案位置)先產生ldif的內容。 隨後以FixData2.pl(輸入perl ./FixData2.pl)加入修改內容的標記(因為phpLDAPadmin沒有選項讓你選擇是否要覆蓋既有帳號),出現Will these attributes be in replace or add mode?[replace]: 直接按 Enter,覆蓋原本的檔案。 接著,回到phpLDAPadmin使用import,將檔案上傳,即可加入帳號。

管理OpenLDAP

Apache Directory 會是一個不錯的選擇,它可支援三大系統Windows、Mac、Linux。

Ubuntu & OpenLDAP & Drupal

在Ubuntu架設OpenLDAP Server,使用於drupal,成功取出群組資料,關鍵在於LDAP資料屬性結構名稱。 群組的objectClass使用posixGroup 帳號的objectClass就要使用posixAccount 在群組也要將memberUid加上去 Drupal就能找到帳號與群組的關聯

在Ubuntu裡安裝中文輸入法

安裝好系統後,在系統設定值裡,找到語言支援,安裝搜尋完的支援檔,登出系統再登入,進入小鍵盤裡的ConfigureFcitx選項,按下"加號",就可以看到"新酷音"輸入法,把它加入即可。

memberof overlay設定

在openldap預設裡是沒有memberof這個overlay,要自己去手動新增,可參考 此篇 。 First install the openldap package sudo apt-get install slapd Then add the memberOf module and overlay to the schema. vi member.ldif Add the following to the file: dn: cn=module,cn=config cn: module objectclass: olcModuleList objectclass: top olcmoduleload: memberof.la olcmodulepath: /usr/lib/ldap dn: olcOverlay={0}memberof,olcDatabase={1}hdb,cn=config objectClass: olcConfig objectClass: olcMemberOf objectClass: olcOverlayConfig objectClass: top olcOverlay: memberof P.S. 要自己切換成BDB,HDB,MDB 我是用mdb所以要改成{1}mdb,下面也是 Save the file and add it to the OpenLDAP config with the following command: ldapadd -Y EXTERNAL -H ldapi:/// -f member.ldif [AdSense-B] Add referential integrety to the ldap config vi refint.ldif Add the following to the file: dn: cn=module,cn=config cn: module objectclass: olcModuleList objectclass: top olcmoduleload: refint.la olcmodulepath: /usr/lib/ldap dn: olcOverlay={1}refint,olcDatab...

Moodle測驗學生做完了但從未繳交該怎麼處理?

請參考以下資料 Re: Moodle Quiz: How to submit a quiz with "Never Submitted" status Tim Hunt 2014年 02月 13日(四) 16:58 Try this: Work out the ids for the 4 problem attempts. You can get this by going to the quiz reports, and reviewing the 4 attempts. The URL will end .../mod/quiz/review.php?attempt={id here}. Change the quiz settings to When time expires: attempts are submitted automatically. (being very careful) edit the data in the database. In the quiz_attempts table, matching the ids with the id column, find the rows for those 4 attempts. Edit the value in the 'state' column from 'abandoned' to 'inprogress'.(我是改為finished) Wait until cron runs. The attempts should then be submitted. I think that will work, but it is just an educated guess. Proceed at your own risk. The sensible thing would be to try this on a test server, with a dummy quiz and attempt you created just for testing, before trying it wilt real data. 連結 將測驗設定裡的"當作答時間限制已到時...

以Synology DiskStation架設LDAP Sever

安裝Directory Sever套件,啟動LDAP伺服器,設定好FQDN、密碼,新增一些使用者、群組,利用phpLDAPadmin來查看結構,登入時的Login DN為uid=root,cn=users,dc=網域名稱。