Yapi集成进freeIPA进行统一认证

Freeipa接入Yapi. vi my-api/config.json ... "ldapLogin": { "enable": true, "server": "ldap://ldap.bybon.cn", "baseDn": "uid=manager,cn=users,cn=accounts,dc=bybon,dc=cn", "bindPassword": "xxxxxxxx", "searchDn": "cn=users,cn=accounts,dc=bybon,dc=cn", "searchStandard": "mail", "emailPostfix": "@bybon.cn", "emailKey": "mail", "usernameKey": "displayName" } 这里需要修改一下,vi my-yapi/vendors/server/controllers/user.js 理由如下,登录的时候,yapi的逻辑是先判断用户邮件,把邮件中的用户名摘出来,然后加上配置中的邮件域。 这个逻辑在ldap中就不对了,改成如下格式,这样直接输入ldap用户名就可以登录了 /** * ldap登录 * @interface /user/login_by_ldap * @method * @category user * @foldnumber 10 * @param {String} email email名称,不能为空 * @param {String} password 密码,不能为空 * @returns {Object} * */ async getLdapAuth(ctx) { try { const { email, password } = ctx.request.body; //no const username = email.split(/\@/g)[0]; //1 const { info: ldapInfo } = await ldap.ldapQuery(email, password); //2 const emailPrefix = email.split(/\@/g)[0]; //3 const emailPostfix = yapi.WEBCONFIG.ldapLogin.emailPostfix; //zrr const emailPrefix = email.split(/\@/g)[0]; const emailPostfix = yapi.WEBCONFIG.ldapLogin.emailPostfix; const { info: ldapInfo } = await ldap.ldapQuery( (emailPostfix ? emailPrefix + emailPostfix : email),password); //zrr const emailParams = ldapInfo[yapi.WEBCONFIG.ldapLogin.emailKey || 'mail'] || (emailPostfix ? emailPrefix + emailPostfix : email); const username = ldapInfo[yapi.WEBCONFIG.ldapLogin.usernameKey] || emailPrefix;

2023年04月12日 · 1 分钟 · 140 字 · 八戒

Dell得Idrac临时license

新公司的dell服务器idrac居然没有license,无法远程,找了dell要了一个临时license给装上,其实装好系统就不会太用到了,记录一下,以后备用。 <?xml version="1.0"?> <!--Copyright (c) 2010-2011 Dell Inc. All Rights Reserved.--> <lns:LicenseClass xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lns="http://www.dell.com/2011/12G/licensing"> <lns:LicenseData> <lns:Schema lns:Vendor="Dell" lns:ID="iDRAC" lns:maxDepth="255" lns:SchemaVersion="2.0"/> <lns:TransferableLicense>false</lns:TransferableLicense> <lns:UTCdateSold>2011-09-20T16:10:37Z</lns:UTCdateSold> <lns:EntitlementID>56r8irR7fV5w3MIxlJUFL9Ph_Lori_Matthews</lns:EntitlementID> <lns:DeviceClass lns:ID="iDRAC"/> <lns:ProductDescription> <lns:lang_en>iDRAC7 Enterprise Evaluation License</lns:lang_en> <lns:lang_es>iDRAC7 Enterprise Evaluation License</lns:lang_es> <lns:lang_fr>iDRAC7 Enterprise Evaluation License</lns:lang_fr> <lns:lang_de>iDRAC7 Enterprise Evaluation License</lns:lang_de> <lns:lang_it>iDRAC7 Enterprise Evaluation License</lns:lang_it> <lns:lang_ja>iDRAC7 Enterprise Evaluation License</lns:lang_ja> <lns:lang_zh>iDRAC7 Enterprise Evaluation License</lns:lang_zh> </lns:ProductDescription> <lns:LicenseTerm> <lns:Evaluation lns:Duration="P30D"/> </lns:LicenseTerm> <lns:DeviceInfo lns:ID="1" lns:VendorID="0x1912" lns:DeviceID="0x0011"/> <lns:Feature lns:ID="1" lns:Description="License Management" lns:Enabled="true"/> <lns:Feature lns:ID="2" lns:Description="RACADM" lns:Enabled="true"/> <lns:Feature lns:ID="3" lns:Description="WSMAN" lns:Enabled="true"/> <lns:Feature lns:ID="4" lns:Description="SNMP" lns:Enabled="true"/> <lns:Feature lns:ID="5" lns:Description="Auto Discovery" lns:Enabled="true"/> <lns:Feature lns:ID="6" lns:Description="USC Firmware Update" lns:Enabled="true"/> <lns:Feature lns:ID="7" lns:Description="Update Package" lns:Enabled="true"/> <lns:Feature lns:ID="8" lns:Description="USC Operating System Deployment" lns:Enabled="true"/> <lns:Feature lns:ID="9" lns:Description="USC Device Configuration" lns:Enabled="true"/> <lns:Feature lns:ID="10" lns:Description="USC Diagnostics" lns:Enabled="true"/> <lns:Feature lns:ID="11" lns:Description="Power Budget" lns:Enabled="true"/> <lns:Feature lns:ID="12" lns:Description="Power Monitoring" lns:Enabled="true"/> <lns:Feature lns:ID="13" lns:Description="Virtual Media" lns:Enabled="true"/> <lns:Feature lns:ID="14" lns:Description="Telnet" lns:Enabled="true"/> <lns:Feature lns:ID="15" lns:Description="SMASH CLP" lns:Enabled="true"/> <lns:Feature lns:ID="16" lns:Description="IPv6" lns:Enabled="true"/> <lns:Feature lns:ID="17" lns:Description="Dynamic DNS" lns:Enabled="true"/> <lns:Feature lns:ID="18" lns:Description="Dedicated NIC" lns:Enabled="true"/> <lns:Feature lns:ID="19" lns:Description="Directory Services" lns:Enabled="true"/> <lns:Feature lns:ID="20" lns:Description="Two-Factor Authentication" lns:Enabled="true"/> <lns:Feature lns:ID="21" lns:Description="Single Sign-On" lns:Enabled="true"/> <lns:Feature lns:ID="22" lns:Description="PK Authentication" lns:Enabled="true"/> <lns:Feature lns:ID="23" lns:Description="Crash Screen Capture" lns:Enabled="true"/> <lns:Feature lns:ID="24" lns:Description="Crash Video Capture" lns:Enabled="true"/> <lns:Feature lns:ID="25" lns:Description="Boot Capture" lns:Enabled="true"/> <lns:Feature lns:ID="26" lns:Description="Virtual Console" lns:Enabled="true"/> <lns:Feature lns:ID="27" lns:Description="Virtual Flash Partitions" lns:Enabled="true"/> <lns:Feature lns:ID="28" lns:Description="Console Collaboration" lns:Enabled="true"/> <lns:Feature lns:ID="29" lns:Description="Device Monitoring" lns:Enabled="true"/> <lns:Feature lns:ID="30" lns:Description="Remote Inventory" lns:Enabled="true"/> <lns:Feature lns:ID="31" lns:Description="Storage Monitoring" lns:Enabled="true"/> <lns:Feature lns:ID="32" lns:Description="Remote Firmware Update" lns:Enabled="true"/> <lns:Feature lns:ID="33" lns:Description="Remote Firmware Configuration" lns:Enabled="true"/> <lns:Feature lns:ID="34" lns:Description="Remote Inventory Export" lns:Enabled="true"/> <lns:Feature lns:ID="35" lns:Description="Remote Operating System Deployment" lns:Enabled="true"/> <lns:Feature lns:ID="36" lns:Description="Backup and Restore" lns:Enabled="true"/> <lns:Feature lns:ID="37" lns:Description="Part Replacement" lns:Enabled="true"/> <lns:Feature lns:ID="38" lns:Description="SSH" lns:Enabled="true"/> <lns:Feature lns:ID="39" lns:Description="Remote File Share" lns:Enabled="true"/> <lns:Feature lns:ID="40" lns:Description="Virtual Folders" lns:Enabled="true"/> <lns:Feature lns:ID="41" lns:Description="Web GUI" lns:Enabled="true"/> <lns:Feature lns:ID="42" lns:Description="Network Time Protocol" lns:Enabled="true"/> <lns:Feature lns:ID="43" lns:Description="Email Alerts" lns:Enabled="true"/> <lns:Feature lns:ID="44" lns:Description="Security Lockout" lns:Enabled="true"/> <lns:Feature lns:ID="45" lns:Description="Remote Syslog" lns:Enabled="true"/> <lns:Feature lns:ID="253" lns:Description="Integrated Dell Remote Access Controller 7 Enterprise" lns:Enabled="true"/> </lns:LicenseData> <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> <dsig:SignedInfo> <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <dsig:Reference URI=""> <dsig:Transforms> <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <dsig:DigestValue>DrtnjP0vUsyT+18jazjmiaGrvc0=</dsig:DigestValue> </dsig:Reference> </dsig:SignedInfo> <dsig:SignatureValue>Qg4Omx1ZGrVllUPbg/X25aJxK5qlNCF/G04NLwXhbmpqoplSRkCCUgb+6TvVz9b3 Ut7sSa/WjA0mv+mbcqIENTAnpveIkIOQPR3mdjCBwX2cLYieV9nOIGobxqHU7o97 QjbSAkmTHcRo0PI6mP8tc7Od4WNWMZ48rrUBeOrVOr1EZeptPUbeaSofy4nvlzbC pcpzZLbjAITT157r9KiFe9joG2hCEClrQPO0ScXHgKXrAWrQE9wX7e2De4uCvJwI hGWpJzDQNJJZbsWhDoZJn/59G/KRjzxIHIzIpUt1XPPIGHl5yMXDaRFcIMES0RuJ SWZS8tt9E001Fr/8/jQNgA==</dsig:SignatureValue> <dsig:KeyInfo> <dsig:X509Data> <dsig:X509Certificate>MIIDTjCCAjagAwIBAgIBATANBgkqhkiG9w0BAQUFADBRMRMwEQYDVQQKEwpEZWxs LCBJbmMuMSEwHwYDVQQLExhFbWJlZGRlZCBMaWNlbnNlIE1hbmFnZXIxFzAVBgNV BAMTDkNBIENlcnRpZmljYXRlMB4XDTEwMDEwMTAwMDAwMFoXDTM1MTIzMTIzNTk1 OVowVjETMBEGA1UEChMKRGVsbCwgSW5jLjEhMB8GA1UECxMYRW1iZWRkZWQgTGlj ZW5zZSBNYW5hZ2VyMRwwGgYDVQQDExNTaWduaW5nIENlcnRpZmljYXRlMIIBIjAN BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqbRo2DZtkjxl5YtqD5ePYdzrWbkU YQJwVaWYe1tE7ZAdou5TLTsjPnaa1cLcPTexn+cq8YjukIVwkwJP7yJ5GkrYGUnf 0Q6unWWgwcgTStlpflz31e8AbxXqNYZEFvEktojYS0kAfiYES+H02GUU5PtV7B9Y BbtZEowU2DPuqRGG1FF8mAsp1vojcbQGx+nS2Of47oQJRrJlh28COXyf2w/+IRAz RmeYin+9pisfrT9fmlUtxa7sAAV/KZFRx8ED31YiktXgI/u/PNnHlchiCMaL6pzA HMBf115O7A2y6IZ9sXUHvH8V9QnDkWT1XHMn8GCW8HXOA5zA232OxiaRmQIDAQAB oywwKjAJBgNVHRMEAjAAMB0GA1UdDgQWBBQAoZ7yMjDHMAFtmmmO/zyz3BJ6hjAN BgkqhkiG9w0BAQUFAAOCAQEAHHgoOg57S+lAEejahdBE1HMwe6BF3b9bzUMCynn9 7buXa3cnRFO3H3674WKU6nBjv4nkT3qMyXwgi7MvXcu69msK4eM6QA8XeC7G1rD+ 2bb/ENR9R9Zo0BWLym/ij8uUA/BzX8hnbzWxN82+FMdY9WD4fJAJwJ5ZPEbU1Vfy 7wOWosHgDPXjeAhlhkxDQi6vlRTJdfED6tBY7iGD4AQXfzrHzAZpZlIvKbM2c54B 65wMSlqfEWMBDhT5qcwGCq82hmi7/sCtu9Z20g2s9F0fp4XlGX8L7l0hCa46zjay 37GffYsScEDFg/DmkIpcXnGzyx8l1msLzpj8Gt4zHhPlgA==</dsig:X509Certificate> </dsig:X509Data> </dsig:KeyInfo> </dsig:Signature></lns:LicenseClass> 文件下载:iDRAC7_Ent_Trial.xml ...

2023年04月06日 · 2 分钟 · 357 字 · 八戒

利用graphviz描述语言绘图

graphviz是很强烈的描述语言绘图工具 安装: apt install graphviz 或 yum install graphviz 生成png dot -Tpng hn.gv -o hn.png vi hg.gv digraph MyGraph { compound = true margin="0,0" ranksep = 1 nodesep = 1 rankdir=LR {rank=same;防火墙;日志审计} subgraph cluster_app { label="海南应用" rankdir=LR margin = 10 {rank=same;app01;app02} app01 [label="app01\n内网:192.168.0.10"] app02 [label="app02\n内网:192.168.0.11"] storage01 [label="storage01\n内网:192.168.0.30"] subgraph cluster_db { style = dotted label="数据库主/备" {rank=same;db02;db01} db01 [label="db01\n内网:192.168.0.20"] db02 [label="db02\n内网:192.168.0.21"] db01 -> db02 [dir=both] } app01 -> db01 [splines=true,lhead=cluster_db] app02 -> db01 [splines=true,lhead=cluster_db] app01 -> storage01 app02 -> storage01 } ​ ...

2023年04月03日 · 1 分钟 · 135 字 · 八戒

TrueNAS系统如何增加新硬盘

之前公司世纪互联和无锡的TureNAS现有硬盘都是38块,满配是60块,所以都需要扩容,扩满再增加22块。 TrueNAS的Raid是使用的RaidZ3,基于ZFS的,最多允许3块盘坏 首先会建立zpool,然后在zpool里面增加vdev,注意,vdev一旦增加,不可更改。 我们这里就犯了第一个错误,所有vdev的磁盘数量最好相等,所以第一次应该先增加30块盘,然后第二次再增加30块,这样两个vdev就是均衡的 现在我们这种状况,第一个vdev是38块,第二个vdev是22块,不对等了,会警告 具体添加步骤如下: 首先浪潮工程师到现场加盘,盘必须做好清除信息,用以下命令通过 dd if=/dev/zero of=/dev/da59 bs=1M count=32 然后插好盘后,必须重启Trunas,才能正常认出盘来,不能热插拔(很奇怪) Storage –> Pools –> 点击齿轮 –> Add Vdevs 然后选中所有左边的Available Disks,移到右边的Data VDevs 然后看最下面会立刻出红色警告,提示两个vdev的disks不对等 点击ADD VDEVS,会弹窗警告,选中Confirm,然后点Continue 会继续弹出一个警告窗,这回就明晰了,旧的数据不会破坏,然后继续选中Confirm,然后点ADD VDEVS 然后就会开始初始化硬盘 最后查看zpool,看到有两个RAIDZ3,就加好了

2023年03月31日 · 1 分钟 · 31 字 · 八戒

dell服务器idrac常用操作脚本

收录一下 dell 服务器 idrac 操作常用脚本 显示Raid卡硬盘 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid get controllers sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid get vdisks sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid get pdisks 清理Foreign磁盘状态 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm storage clearconfig:RAID.Integrated.1-1 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime 删除vdisk sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.5.14 racadm raid deletevd:Disk.Virtual.0:RAID.Integrated.1-1 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime 建立Raid0 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid createvd:RAID.Integrated.1-1 -rl r0 -wp wb -rp ra -name raid_0 -pdkey:Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime 建立Raid5 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm raid createvd:RAID.Integrated.1-1 -rl r5 -wp wb -rp ra -name raid_5 -pdkey:Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1,Disk.Bay.2:Enclosure.Internal.0-1:RAID.Integrated.1-1,Disk.Bay.3:Enclosure.Internal.0-1:RAID.Integrated.1-1 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create RAID.Integrated.1-1 -s TIME_NOW --realtime 重启服务器 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm serveraction hardreset 设置硬盘第一启动,禁止F1/F2等待 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set BIOS.biosbootsettings.BootSeq HardDisk.List.1-1,NIC.Integrated.1-1-1 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set BIOS.MiscSettings.ErrPrompt Disabled sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.5.16 racadm jobqueue create BIOS.Setup.1-1 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm serveraction hardreset 设置vnc sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.vncserver.enable Enabled sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.vncserver.Password calvin 设置idrac其他用户 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminUserName -i 4 newuser sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 4 123456 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminPrivilege -i 4 0x000001ff sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminEnable -i 4 1 改掉密码 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 4 987654 NTP的设置 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.ipv4static.dns1 8.8.8.8 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp1 0.asia.pool.ntp.org sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp2 1.asia.pool.ntp.org sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp3 2.asia.pool.ntp.org sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp1 129.250.35.250 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp2 180.211.88.50 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.ntp3 202.112.29.82 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.NTPEnable Enabled sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.NTPConfigGroup.NTPMaxDist 16 sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set idrac.time.timezone Japan 修改网卡启动为Legacy PXE sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm get nic.nicconfig.1 | grep Legacy sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm set nic.nicconfig.1.legacybootproto PXE sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm get nic.nicconfig.1 | grep Legacy sshpass -p "calvin" ssh -oLogLevel=ERROR -oStrictHostKeyChecking=no root@10.224.$1 racadm jobqueue create NIC.Integrated.1-1-1 ipmitool -I lanplus -H $ip -U root -P calvin chassis power reset

2023年03月31日 · 3 分钟 · 490 字 · 八戒

TureNAS系统在浪潮定制系统上的安装

无锡浪潮TrueNAS系统的安装 这一版的浪潮定制NAS机器比较特别,没有任何Raid卡,配了Avago的一块pcie sas直通卡:搏通9400卡 然后是定制机,整体4U的高度,满配是60块16T的大盘,主板在机箱侧面立着,2块小盘做系统。 由于机房限制,无法直接从本地访问10.18.30.97,导致无法将本地文件挂入idrac的cdrom,只能曲线救国,在172.18.31.2建立一个nfs share,把光盘文件放进去 到 idrac 的 Remote control , 再到Virtual media,配好nfs共享 ip: 172.18.31.2 path: /export/nfsshare 在remote image redirction中可以看到光盘文件,点击Start 然后重启,CDROM是第一启动媒介 开始安装,缺省会进入第一项进行安装 然后会报这个错,panic: AP #1 (PHY# 2) failed! 见了鬼了,唯一的地方可能是主板部分和博通卡冲突,我们重启进入BIOS,到SATA和sSATA的地方 把主板的SATA给关掉,禁止AHCI 同样关掉sSATA,也禁止AHCI 然后重启安装TrueNAS,这次就可以通过了 安装盘选择前两块SSD小盘,230G openbsd会自动将这两款小盘做成软Raid 提示会抹掉两块盘的所有数据 输入root的密码 选择Boot via BIOS 建立16G的swap空间 然后就开始安装,这里没什么动静,也没有进度条,会等很久 安装完成后会让你重启,然后出来配置界面 我们首先要配置第二项,Bonding端口 然后再配第一项的静态IP 再配第四项缺省路由 配完就http和https显示正确地址 输入地址:http://172.18.30.97 登录就完成安装了

2023年03月30日 · 1 分钟 · 49 字 · 八戒

GlusterFS的实际应用

特别注意 两台GFS主机172.18.30.18和172.18.30.36上面务必配置/etc/hosts,否则peer的时候会有问题 172.18.30.18 renhe-18-30-18 172.18.30.18 renhe-18-30-36 客户端安装 yum -y install epel-release 然后 yum install glusterfs-fuse 就可以了 挂载: mount.glusterfs 172.18.30.18:/borui-vol /data/br/nfs fstab 自动挂载 172.18.30.18:/borui-vol /data/br/nfs glusterfs defaults,_netdev,backupvolfile-server=172.18.30.36 0 0 在172.18.30.18上建立新卷,因为只有2个节点,就必须force了 gluster volume create test-zhichi-vol replica 2 transport tcp 172.18.30.18:/glusterfs/test-zhichi-vol 172.18.30.36:/glusterfs/test-zhichi-vol force 启动 gluster volume start test-zhichi-vol 查看一下 gluster volume info test-zhichi-vol 查看卷信息(禁止查看inode,太多了) gluster volume status test-zhichi-vol detail gluster volume status test-zhichi-vol clients gluster volume status test-zhichi-vol mem gluster volume status test-zhichi-vol fd gluster volume status test-zhichi-vol inode 开启限额 gluster volume quota test-zhichi-vol enable gluster volume quota test-zhichi-vol limit-usage / 50GB gluster volume quota test-zhichi-vol list 限制IP访问 例如允许172.18.31.*网段的主机访问rep-volume: ...

2023年03月30日 · 2 分钟 · 236 字 · 八戒

使用ipset来禁止国外的用户登录openvpn

突然来的个需求,要求屏蔽国外的用户登录公司的openvpn,防止滥用,搜了一下教程倒是真不少,问题不少都是要去下载那个无比大的ip地址库,好不容易找了一个可用的。 记录下来,备用,原理很简单,ipset建立一个china的hashset,不停添加条目,最后用iptalbes阻挡一下: #!/bin/sh ipset create china hash:net hashsize 10000 maxelem 1000000 ipset add china 1.0.1.0/24 ...... ipset add china 91.234.36.0/24 iptables -I INPUT -m set --match-set china src -p udp -m udp --dport 1194 -j ACCEPT iptables -A INPUT -p udp --dport 1194 -j DROP 相应脚本的下载: ipset-rules.txt

2023年03月29日 · 1 分钟 · 47 字 · 八戒

核心交换机的配置过程

换了公司,也搞起了桌面运维,配置交换机的过程记录一下,其实很简单,就是命令记不住。 拿到一台华为交换机,重新初始化后,配置如下: <HUAWEI>dis cur !Software Version V200R008C00SPC500 # sysname HUAWEI # aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password irreversible-cipher %^%#7:.iL]+u"4\j8ZFhGeg/-m.&"^0}kMznjk%>;BaUDO/'6m\X\=V8JGY:W;i,%^%# local-user admin service-type http # interface Vlanif1 # interface MEth0/0/1 # interface GigabitEthernet0/0/1 # interface NULL0 # user-interface con 0 authentication-mode password set authentication password cipher $1a$~!;$-JF0-W$Z><1.F]<sF.R_NBj34CJ/JPe=/tZDMM(Ws3'9u%+$ user-interface vty 0 4 user-interface vty 16 20 # return 一、配名称 sysname BJ_FANGHENG_JIERU 二、配置登录用户 1、aaa local-user admin password irreversible-cipher abcdefg local-user admin privilege level 3 local-user admin service-type telnet terminal ssh 2、user-interface con 0 authentication-mode aaa 3、user-interface vty 0 4 authentication-mode aaa protocol inbound all 三、配置下联交换机端口 interface GigabitEthernet0/0/23 description == H3cSW --> 24 port link-type trunk port trunk allow-pass vlan 2 to 4094 四、配置上联交换机端口 interface GigabitEthernet0/0/24 description == RuijieRoute --> lan0 port link-type trunk port trunk allow-pass vlan 2 to 4094 五、配置vlan地址 vlan 11 vlan 100 vlan 11 interface Vlanif11 ip address 10.8.0.7 255.255.254.0 vlan 100 interface Vlanif100 ip address 192.168.10.7 255.255.255.0 六、配置缺省路由 ip route-static 0.0.0.0 0.0.0.0 10.8.0.1 七、批量配置端口 port-group group-member GigabitEthernet0/0/1 to GigabitEthernet0/0/23 port link-type access port default vlan 11 stp edged-port enable 八、lldp lldp enable 九、dhcp dhcp enable ip pool 11 gateway-list 10.8.0.1 network 10.8.0.0 mask 255.255.254.0 static-bind ip-address 10.8.0.4 mac-address 8005-88f1-fa62 dns-list 114.114.114.114 interface Vlanif11 description === Ke hu duan ip address 10.8.0.1 255.255.254.0 dhcp select global 十、telnet和ssh dsa local-key-pair create telnet server enable stelnet server enable ssh authentication-type default password 这样就完成了一台核心设备的简单配置 ...

2023年03月24日 · 2 分钟 · 229 字 · 八戒

Hubot集成企业钉钉

换了公司,现在的公司用的是钉钉,不是企业微信,那么 hubot 就得改接入钉钉了 前文回顾:Hubot集成企业微信+jenkins+ansible 不明白的可以先看那一篇,那么首先的步骤是一样的,同样要去钉钉开放平台,用管理员登录: https://open.dingtalk.com/ 登陆后,点击应用开发–>企业应用开发: ’ 然后应用开发,机器人,点击创建应用: 建好后,点击应用信息,可以看到应用凭证 我们记录下来 AppSecret,之后要用到 然后再点击开发管理,这里需要你把 hubot 的服务器地址给公布出去,需要有个公网地址 因为hubot是监听的8080端口,所以映射是 xxxx.ip:80 –> hubotip:8080 服务器出口 IP 的地方 , 需要在 hubot 的服务器上,curl http://ipinfo.io,得到地址,然后填上(我们的 ip 非常特殊,每一次访问都有可能会换个ip,所以只好把整段填写进去,而且把公网映射ip也填进去) 消息接收地址填上映射后的地址:https://bot.rendoumi.com/hubot/dingtalk/message/(用不用nginx加证书变https随具体情况定) 然后去hubot安装dingtalk插件,在hubot安装根目录运行 npm install hubot-dingtalk export HUBOT_DINGTALK_AUTH_TYPE=sign export HUBOT_DINGTALK_SECRET=xxxxxxxxxx export HUBOT_DINGTALK_MODE=1 ./bin/hubot -a dingtalk 然后我们去用浏览器访问 https://bot.rendoumi.com/hubot/dingtalk/message/,会返回这个 然后就可以了。至于把 hubot 做成服务,就参考上一篇文章,把jenkins和ansible都加上,做一个好用的机器人。

2023年03月01日 · 1 分钟 · 48 字 · 八戒